Add OTLP metrics #1
Merged
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.
Add OpenTelemetry Metrics Support
Summary
Extends the existing
otlpexporter to support OpenTelemetry metrics in addition to logs. This enables efficient aggregation, querying, and analysis of REPL usage patterns.Motivation
While the existing
otlpexporter sends data as OpenTelemetry logs, metrics are better suited for:Implementation
Unified OTLP Exporter
The
otlpexporter now supports both logs and metrics:metrepl.events.total:metric- Event type (e.g.,:event/op-completed):operation- REPL operation name (e.g.,"eval") - only present for operation events:correlation-id- Session identifier for grouping related events:hostname,:os, etc.Users control which signals are exported via standard OpenTelemetry configuration:
"otel.logs.exporter"- logs export control"otel.metrics.exporter"- metrics export controlChanges
Backward Compatibility
:otlpconfig key preserved (no breaking changes)"otel.metrics.exporter": "otlp"Testing
To test the metrics exporter, create
.metrepl.edn:{:exporters {:otlp {:enabled? true :config {"otel.logs.exporter" "none" "otel.metrics.exporter" "otlp" "otel.exporter.otlp.metrics.protocol" "http/protobuf" "otel.exporter.otlp.metrics.endpoint" "https://your-endpoint/metrics"}}}}Tested with real project REPL sessions. Both logs and metrics successfully exported and visible in Grafana.