Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instrumentation raw objects should be sent as custom properties #1099

Merged

Conversation

CodeBlanch
Copy link
Member

We talked about this on the SIG today. Instrumentation should make the raw objects available.

  • .NET Core SqlClient now exposes Command.
  • Grpc exposes Request.
  • ASP.NET Core exposes Request, Response, & Exception.

@CodeBlanch CodeBlanch requested a review from a team August 19, 2020 03:18
@codecov
Copy link

codecov bot commented Aug 19, 2020

Codecov Report

Merging #1099 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1099   +/-   ##
=======================================
  Coverage   74.48%   74.48%           
=======================================
  Files         223      223           
  Lines        6345     6350    +5     
=======================================
+ Hits         4726     4730    +4     
- Misses       1619     1620    +1     
Impacted Files Coverage Δ
src/OpenTelemetry/Trace/ActivityExtensions.cs 80.00% <ø> (ø)
...umentation.AspNet/Implementation/HttpInListener.cs 92.68% <100.00%> (ø)
...rpc/Implementation/GrpcClientDiagnosticListener.cs 89.65% <100.00%> (+0.36%) ⬆️
...tp/Implementation/HttpHandlerDiagnosticListener.cs 88.00% <100.00%> (+0.50%) ⬆️
...ient/Implementation/SqlClientDiagnosticListener.cs 78.46% <100.00%> (+0.33%) ⬆️
...us/Implementation/PrometheusExporterEventSource.cs 63.63% <0.00%> (-9.10%) ⬇️

@@ -48,6 +48,7 @@ public override void OnStartActivity(Activity activity, object payload)

activity.SetKind(ActivityKind.Client);
activity.DisplayName = grpcMethod?.Trim('/');
activity.SetCustomProperty("GrpcHandler.Request", request);
Copy link
Member

Choose a reason for hiding this comment

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

Curious - do we want this to be OTel.GrpcHandler.Request? For example, if someone is debugging a crash dump, they would get some hint that it was added by OpenTelemetry.

Copy link
Member

Choose a reason for hiding this comment

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

I also think we should expose these strings as public constants in someway, part of the respective instrumentation projects, so that users dont have to remember the string property name.

Copy link
Member

Choose a reason for hiding this comment

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

Agree to prefix "Otel."

Copy link
Member Author

Choose a reason for hiding this comment

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

I added the "OTel" prefix everywhere we were calling SetCustomProperty. Moved most things to constants. But didn't tackle exposing them right now. Looked around Grpc, it doesn't have really anything that is public other than the builder extension. So we need to figure out how we want that to work. Have a constants class in each project or something? Future PR 😄

Copy link
Member

Choose a reason for hiding this comment

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

It is unclear to me who is going to benefit from these constants. My take is that if the string literal is only going to show up in the repo once, twice or three times, literal string seems to provide better readability.

Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM.

@cijothomas cijothomas merged commit 8bd8641 into open-telemetry:master Aug 19, 2020
@CodeBlanch CodeBlanch deleted the instrumentation-raw-objects branch August 19, 2020 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants