-
Notifications
You must be signed in to change notification settings - Fork 236
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
2554 Enhance REST OTEL instrumentation with custom metrics and traces #2617
base: main
Are you sure you want to change the base?
Conversation
@Aniruddh25 is March realistic? |
Co-authored-by: Aaron Powell <[email protected]>
Co-authored-by: Aaron Powell <[email protected]>
/azp run |
Commenter does not have sufficient privileges for PR 2617 in repo Azure/data-api-builder |
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
…a-api-builder into features/2554-enh-otel
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
Co-authored-by: RubenCerna2079 <[email protected]>
…a-api-builder into features/2554-enh-otel
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Files not reviewed (1)
- src/Service/Azure.DataApiBuilder.Service.csproj: Language not supported
Comments suppressed due to low confidence (2)
src/Service/Telemetry/TelemetryTracesHelper.cs:94
- The method name 'TrackRestControllerActivityFinishedWithWithException' contains a duplicate 'With'. Consider renaming it to 'TrackRestControllerActivityFinishedWithException' for clarity.
public static void TrackRestControllerActivityFinishedWithWithException(
src/Service/Controllers/RestController.cs:249
- Manual disposal of 'queryActivity' is redundant since it is declared within a 'using' block, which will automatically dispose it. Removing the explicit call can prevent potential unexpected behavior from double disposal.
if (queryActivity is not null && queryActivity.IsAllDataRequested)
{
queryActivity.Dispose();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I just left one more comment. Thank you for working on this feature, it is really cool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thank you for adding this support!
@tommasodotNET Seems like queryActivity.Dispose() could be removed? Can it? |
30c61ca
Hey @Aniruddh25, I've addressed copilot review |
Co-authored-by: RubenCerna2079 <[email protected]>
…a-api-builder into features/2554-enh-otel
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 6 pipeline(s). |
}); | ||
|
||
}) | ||
//.WithLogging(logging => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we dont need this to enable logging, please remove the commented out code from Startup.cs
@tommasodotNET, waiting on all tests to pass.. |
Why make this change?
What is this change?
This PR enhances the OTEL instrumentation for the REST APIs by adding custom traces and metrics.
I have removed ASP NET Core standard instrumentation since it does not provide great value given the custom nature of the webservice. I have written two main Helper classes:
TelemetryMetricsHelper
andTelemetryTracesHelper
to provide a single point of management for custom traces and metrics.Metrics can be filtered for
status_code
,api_type
,endpoint
andmethod
.I have also fixed the loggings which are now sent to the configured OTEL endpoint.
Logs
Metrics
Traces
How was this tested?
Sample Request(s)
To test everything locally I recommend using this repo that allows to run the local build of the dab cli and send metrics to the .NET Aspire OTEL endoint.