8000 feat(metrics): add custom collector metrics for spans received/rejeced by service by blazethunderstorm · Pull Request #7335 · jaegertracing/jaeger · GitHub
[go: up one dir, main page]

Skip to content

Conversation

blazethunderstorm
Copy link
@blazethunderstorm blazethunderstorm commented Jul 18, 2025

Resolves #7125

Which problem is this PR solving?

Adds new collector metrics to track spans received and rejected per service. This enables observability into which services are sending traces and how many are being rejected (e.g., due to sampling or validation issues).

Description of the changes

  • Introduced new Prometheus metrics:
    • jaeger_collector_spans_received_by_svc_total
    • jaeger_collector_spans_rejected_by_svc_total
  • Hooked into the collector.ProcessSpans logic to increment metrics for each batch.
  • Added metrics registration and initialization in cmd/collector/app/collector.go.

How was this change tested?

  • Verified via manual curl trace ingestion using OTLP HTTP.
  • Confirmed metric output via:
    curl -s localhost:14269/metrics | grep jaeger_collector_spans_
    

Proof

image image

Checklist

@blazethunderstorm blazethunderstorm requested a review from a team as a code owner July 18, 2025 20:24
@blazethunderstorm
Copy link
Author

@yurishkuro pls review

@dosubot dosubot bot added the enhancement label Jul 18, 2025
return c.spanHandlers
}

type CollectorSpanMetrics struct {
Copy link
Member

Choose a reason for hiding this comment

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

we already have cmd/collector/app/metrics.go, what is missing there?

Copy link
Author

Choose a reason for hiding this comment

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

@yurishkuro The existing metrics.go defines and creates metrics, but it doesn’t automatically update them when spans are processed. My change adds logic to increment the received and rejected counters for each span as they’re handled — that's what was missing.

Copy link
Member

Choose a reason for hiding this comment

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

yes but your change also adds additional storage and lookups by service name, which are already implemented in the file I pointed to.

Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. You may re-open it if you need more time.

@github-actions github-actions bot added the stale The issue/PR has become stale and may be auto-closed label Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement stale The issue/PR has become stale and may be auto-closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Metrics jaeger_collector_spans_* are always zero (Regression in v1.66)
2 participants
0