feat: add OpenTelemetry metrics (requests, duration, errors)#336
Merged
Conversation
Publishes three instruments from a new GoogleMapsMetrics meter
("GoogleMapsApi", same name as the trace source): gmaps.client.requests
(counter), gmaps.client.request.duration (histogram, seconds), and
gmaps.client.request.errors (counter). Recorded once per call in the
engine and zero-cost until a listener subscribes, mirroring the existing
tracing; no new package dependency. The ILogger half of the issue is
intentionally left out and documented as a non-goal.
Closes #296
🔬 TestGlance✅ 265 passed across 1 job — 100.0% · ⏱️ 2.1s
🟡 build — details✅ 265 passed vs
Updated 2026-06-30T21:46:53.390Z |
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.
Summary
Adds optional OpenTelemetry metrics — three instruments (request counter, latency histogram, error counter) published from a
MeternamedGoogleMapsApi, recorded once per call and zero-cost until a listener subscribes. This is the metrics half of #296; theILoggerhalf is intentionally left out and documented as a non-goal.Related issue
Closes #296
Changes
GoogleMapsApi.Diagnostics.GoogleMapsMetrics(publicMeterNameconst; internalMeter+gmaps.client.requests/gmaps.client.request.duration/gmaps.client.request.errorsinstruments) with a zero-costRecord()helper; no new package dependency.MapsAPIGenericEnginerecords metrics once per call in the existingfinally, surfacing the HTTP status code via a callback — no behavioural change to request flow, exceptions, or tracing.PublicAPI.Unshipped.txt, added hermeticDiagnosticsMetricsTests(MeterListener-based), and documented metrics inREADME.md+.agents/observability.md(removed the resolved B5 item; recorded theILoggernon-goal).Test plan
dotnet buildclean on all three TFMs (PublicAPI lock satisfied);dotnet formatclean on the new files.IntegrationTestsrequire aGOOGLE_API_KEYand were not run in this environment.Checklist
dotnet formathas been run.dotnet testpasses locally (with a validGOOGLE_API_KEYfor integration tests).