feat: add OpenTelemetry metrics for credential issuance and verification#495
Open
leifj wants to merge 1 commit into
Open
feat: add OpenTelemetry metrics for credential issuance and verification#495leifj wants to merge 1 commit into
leifj wants to merge 1 commit into
Conversation
Wire OTel Metrics SDK alongside existing tracing infrastructure: - pkg/metric: MeterProvider with OTLP push + Prometheus scrape exporter - pkg/metric/vci.go: VCI counters (offers, tokens, credentials, notifications) and histograms (token latency, issuance latency) - pkg/metric/vp.go: VP counters (requests, presentations, failures) and histogram (verification latency) Instrument key handlers: - apigw: OAuthToken, VCICredential, VCIDeferredCredential, VCINotification, OIDC RP credential offer creation - verifier: CreateRequestObject, HandleDirectPost All metric labels use protocol-level metadata only (format, grant_type, credential_config_id, source, error_class) — no PII is ever recorded. Adds /metrics Prometheus scrape endpoint to apigw HTTP server. Adds common.metrics config section (mirrors common.tracing).
|
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.



Closes #494
What
Adds OTel Metrics SDK instrumentation alongside existing tracing, covering the full OpenID4VCI and OpenID4VP flows.
Changes
New:
pkg/metric/MeterProviderwith OTLP push + Prometheus scrape readerModified
common.metricsconfig section (OTEL struct, same as tracing)/metricshandlervci *metric.VCIfield, update constructorOAuthToken(counter + latency)VCICredential(issued/failed counters + latency),VCIDeferredCredential,VCINotification/metricsPrometheus scrape endpointvp *metric.VPfield, update constructorCreateRequestObject,HandleDirectPostPII Safety
All labels are protocol-level only:
format,grant_type,credential_config_id,source,error_class,event,status. No identifiers, session IDs, or claim values are ever recorded.Cardinality
Worst case ~60 series for VCI + ~9 for VP. Well within Prometheus comfort zone.
Testing
pkg/metrichas 6 tests covering construction, no-op, recording, and Prometheus exportervci/vpis not injected)go build ./...andgo vet ./...clean