[Hybrid Agent] Decorate OpenTelemetry dimensional metrics with otlp_resource_attributes from connect response#2956
Open
jasonjkeller wants to merge 9 commits into
Open
[Hybrid Agent] Decorate OpenTelemetry dimensional metrics with otlp_resource_attributes from connect response#2956jasonjkeller wants to merge 9 commits into
jasonjkeller wants to merge 9 commits into
Conversation
…dd-otel-metric-attributes
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2956 +/- ##
============================================
+ Coverage 70.76% 70.79% +0.02%
- Complexity 10659 10664 +5
============================================
Files 879 874 -5
Lines 42971 42970 -1
Branches 6501 6503 +2
============================================
+ Hits 30409 30419 +10
+ Misses 9627 9613 -14
- Partials 2935 2938 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2875
This PR is currently pending the agent spec being approved: https://source.datanerd.us/agents/agent-specs/pull/821
Dynamically updates the OTel resource with the
otlp_resource_attributesreceived in the connect response so that OTel dimensional metrics get decorated with the same attributes as timeslice metrics/events.The general approach is:
getServiceMetadataAPI to theAgentBridgethat provides a map ofotlp_resource_attributesparsed from the latest connect response.MetricExporterwhich delegates to the original exporter and allows for adding custom logic to the export calls.exportcalls, it polls theAgentBridgeAPI for the latest connect attributes and builds a newResource(if one isn’t already cached) with the attributes that we want to decorate onto the metrics. ThatResourceis cached until a subsequent call toexportoccurs and it detects that the connect attributes have changed, which will trigger an updatedResourceto be built and cached.MetricDatathat delegates to the originalMetricDatabut overrides thegetResourcemethod. Effectively, it merges the existingResourcefor eachMetricDatawith the customizedResourceand exports a batch of the extended wrapperMetricDatainstances so thatgetResourcereturns the merged attributes.Example
otlp_resource_attributesfield:Related: