Skip to content

Conversation

@beniwohli
Copy link
Contributor

@beniwohli beniwohli commented Nov 30, 2022

What does this pull request do?

Instrument GRPC using interceptors. We use our instrumentation to insert our server and client interceptors, the interceptors take care of creating transactions and spans.

Testing is somewhat... interesting. We spawn a subprocess that runs the GRPC server, giving it the URL to our fake APM Server that runs in a thread of the main process. The GRPC client runs in the main thread. This allows for a full end-to-end test and introspection of all events (spans, transactions) from both the client and server.

Related issues

Closes #645

@ghost
Copy link

ghost commented Dec 2, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-12-13T11:10:26.974+0000

  • Duration: 18 min 26 sec

Test stats 🧪

Test Results
Failed 0
Passed 5079
Skipped 3600
Total 8679

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /test linters : Run the Python linters only.

  • /test full : Run the full matrix of tests.

  • /test benchmark : Run the APM Agent Python benchmarks tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@ghost
Copy link

ghost commented Dec 2, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (71/71) 💚
Files 100.0% (236/236) 💚
Classes 100.0% (236/236) 💚
Lines 92.073% (18677/20285) 👎 -0.115
Conditionals 75.163% (2878/3829) 👎 -0.067
Copy link
Contributor

@basepi basepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits and questions, but looks excellent overall!



Once you have configured the agent, it will automatically track transactions
and capture uncaught exceptions within sanic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanic copy pasta

args[2] = interceptors
else:
kwargs["interceptors"] = interceptors
return wrapper(*args, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a typo? Usually we use wrapped not wrapper, right?

@basepi basepi mentioned this pull request Dec 5, 2022
@beniwohli beniwohli requested a review from basepi December 13, 2022 11:10
Copy link
Contributor

@basepi basepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! 👍

@beniwohli beniwohli merged commit a7f44ac into elastic:main Dec 14, 2022
@beniwohli beniwohli deleted the grpc-interceptor branch December 14, 2022 12:51
This was referenced Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants