Add optional OpenTelemetry instrumentation#37
Merged
Conversation
Adds OpenTelemetry tracing to monitor sync operation performance: - Traces overall fetchActivity operation with user count - Spans for per-user API calls (starred/owned repos, events) - Pagination instrumentation showing page fetches Features: - Optional: only enabled when OTEL_EXPORTER_OTLP_ENDPOINT is set - Zero overhead when disabled (uses no-op tracer) - Works with any OTLP-compatible collector (e.g., Jaeger) Usage: export OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4318 ./gitstreams Includes: - otel package for setup/initialization - Docker Compose + config for local testing with Jaeger - OTEL_SETUP.md with full documentation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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 OpenTelemetry tracing to monitor sync operation performance. The instrumentation is completely optional and only activates when OTEL environment variables are configured.
Changes
otelpackage with optional initialization logicfetchActivityfunction with main sync spanFeatures
OTEL_EXPORTER_OTLP_ENDPOINTenvironment variableTesting
All existing tests pass. The instrumentation is transparent and doesn't change application behavior.
To test with local collector:
```bash
docker-compose up -d
export OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4318
./gitstreams
Open http://localhost:16686 to view traces in Jaeger UI
```
Benefits
See OTEL_SETUP.md for full documentation.