[APMSVLS-464][APMSVLS-463] fix: Configure span kind and peer tag stats#1189
Open
lucaspimentel wants to merge 6 commits into
Open
[APMSVLS-464][APMSVLS-463] fix: Configure span kind and peer tag stats#1189lucaspimentel wants to merge 6 commits into
lucaspimentel wants to merge 6 commits into
Conversation
Tests verify that StatsConcentratorService computes stats for spans with span.kind and populates peer_tags in output. Both tests currently fail due to empty span_kinds_stats_computed and peer_tag_keys vecs passed to SpanConcentrator::new(). 🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
Pass STATS_ELIGIBLE_SPAN_KINDS and DEFAULT_PEER_TAG_KEYS to SpanConcentrator::new() to match the Go agent defaults. This enables stats for OTel spans with span.kind and adds per-dependency granularity via peer tags for client/producer/consumer spans. 🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
c06bc9b to
2eb4403
Compare
|
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR configures Bottlecap’s SpanConcentrator to match the Go agent defaults for (1) which span.kind values are eligible for stats computation and (2) which peer-related tag keys are used to populate per-dependency peer_tags, closing gaps in agent-side trace stats aggregation.
Changes:
- Configure
SpanConcentratorwith the Go agent’s default computed span kinds (client,server,producer,consumer) instead of an empty list. - Configure
SpanConcentratorwith the Go agent’s default peer tag key set (basePeerTags) instead of an empty list. - Add end-to-end tests for span-kind-based stats eligibility and peer tag population in emitted stats.
Comment on lines
+304
to
+306
| /// A non-root, non-measured span with `span.kind`="client" should produce stats | ||
| /// when `ComputeStatsBySpanKind` is enabled (i.e. `span_kinds_stats_computed` is | ||
| /// populated). With the current empty vec, this span is silently dropped. |
Comment on lines
+339
to
+341
| /// A client span with peer tag meta keys (`db.instance`, `db.system`) should produce | ||
| /// stats with non-empty `peer_tags` when `peer_tag_keys` is configured. With the | ||
| /// current empty vec, `peer_tags` in the output will always be empty. |
Comment on lines
+356
to
+360
| assert!( | ||
| result.is_some(), | ||
| "Expected stats for a client span with peer tags, but got None. \ | ||
| span.kind-based eligibility is not working." | ||
| ); |
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.
Overview
Configure
SpanConcentratorin bottlecap with the Go agent's defaultComputeStatsBySpanKindspan kinds andbasePeerTagspeer tag keys, fixing two gaps in agent-side trace stats computation:APMSVLS-464:span_kinds_stats_computedwas empty, so non-top-level, non-measured spans withspan.kind=server/client/producer/consumer) were silently excluded from stats.APMSVLS-463:peer_tag_keyswas empty, so client/producer/consumer spans had no per-dependency granularity in stats output (e.g., all S3 buckets, DynamoDB tables, Kafka topics lumped together).Changes
STATS_ELIGIBLE_SPAN_KINDSconstant (4 span kinds matching the Go agent'sKindsComputed)DEFAULT_PEER_TAG_KEYSconstant (43 peer tag keys matching the Go agent'sbasePeerTagsfrommappings.json)SpanConcentrator::new()instead of empty vecsStatsConcentratorServicepipeline for both featuresFollow-up
Both constants are hand-copied from the Go agent (
KindsComputedandbasePeerTags), which is the source of truth, and the same lists are also duplicated inserverless-components. A future refactor should keep the Rust agents in sync with the Go agent rather than each maintaining its own copy.Testing
test_span_kind_stats_computed: sends a non-root, non-measured client span through the service, verifies stats are produced withspan_kind="client"test_peer_tags_populated: sends a client span withdb.instanceanddb.systemmeta, verifiespeer_tagscontains both in the stats output