Skip to content

feat: add OpenTelemetry metrics middleware alongside go-metrics#531

Open
adityakrmishra wants to merge 1 commit intopalantir:developfrom
adityakrmishra:feature/opentelemetry-metrics
Open

feat: add OpenTelemetry metrics middleware alongside go-metrics#531
adityakrmishra wants to merge 1 commit intopalantir:developfrom
adityakrmishra:feature/opentelemetry-metrics

Conversation

@adityakrmishra
Copy link
Copy Markdown

Addresses #439

Hi team,

Following up on the discussion in #439, this PR introduces OpenTelemetry as an alternative metrics layer. It runs entirely parallel to the existing rcrowley/go-metrics implementation to ensure zero disruption to internal Palantir systems that rely on the legacy metrics.

What this solves:
The legacy go-metrics lacks label/tag support, forcing high-cardinality data like installation_id into the metric names. This new OTel middleware maps the exact same data points but uses proper OTel attributes (e.g., github.rate.remaining{installation.id="42"}).

Changes:

  • Added go.opentelemetry.io/otel/metric to go.mod (API only, keeping it lightweight without SDK bloat).
  • Added githubapp/middleware_otel.go containing the parallel implementation.
  • Zero modifications to existing files (middleware.go, dispatcher.go, scheduler.go).

New Entry Points:
Users can now opt-in via:

  • OTelClientMetrics(mp)
  • OTelErrorCallback(mp)
  • OTelAsyncErrorCallback(mp)
  • WrapSchedulerWithOTel(inner, mp)

All existing tests pass, and the code has been written to match the idiomatic style and comment density of the current project. Let me know if any adjustments are needed!

@palantirtech
Copy link
Copy Markdown
Member

Thanks for your interest in palantir/go-githubapp, @adityakrmishra! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@changelog-app
Copy link
Copy Markdown

changelog-app Bot commented Apr 16, 2026

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

feat: add OpenTelemetry metrics middleware alongside go-metrics

Check the box to generate changelog(s)

  • Generate changelog entry

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.

2 participants