Skip to content

feat(telemetry): add configurable OTEL exporter#36

Merged
doganarif merged 5 commits intodoganarif:mainfrom
mereba:feature/otel
Feb 8, 2026
Merged

feat(telemetry): add configurable OTEL exporter#36
doganarif merged 5 commits intodoganarif:mainfrom
mereba:feature/otel

Conversation

@mereba
Copy link
Contributor

@mereba mereba commented Jan 30, 2026

  • BREAKING CHANGE (Internal): telemetry.InitTracer now takes a Config struct.
  • add stdout exporter for easier local development and debugging
  • add noop exporter for benchmarking and verification
  • fix(middleware): ensure proper trace context propagation to user handlers (Fixes Is Middleware Tracing Implemented without OTel? #32) Benchmark Results (Apple M3):

Testing with Jaegar

Screenshot 2026-01-30 at 23 49 53

Benchmark Results (Apple M3):

Metric Without OTEL With OTEL (NoOp) Overhead (Cost)
Latency (ns/op) 474.3 2955.0 +2480.7 ns
Memory (B/op) 264 3784 +3520 B
Allocations (allocs) 3 20 +17

@mereba mereba changed the title feat(telemetry): add configurable OTEL exporter and secure implementa… feat(telemetry): add configurable OTEL exporter, secure implementation Jan 30, 2026
@mereba mereba changed the title feat(telemetry): add configurable OTEL exporter, secure implementation feat(telemetry): add configurable OTEL exporter Jan 30, 2026
…tion

- BREAKING CHANGE (Internal): telemetry.InitTracer now takes a Config struct.
- add stdout exporter for easier local development and debugging
- add noop exporter for benchmarking and verification
- fix(middleware): ensure proper trace context propagation to user handlers (Fixes doganarif#32)
Benchmark Results (Apple M3):
+----------------------+--------------+------------------+-----------------+
| Metric               | Without OTEL | With OTEL (NoOp) | Overhead (Cost) |
+----------------------+--------------+------------------+-----------------+
| Latency (ns/op)      | 474.3        | 2955.0           | +2480.7 ns      |
| Memory (B/op)        | 264          | 3784             | +3520 B         |
| Allocations (allocs) | 3            | 20               | +17             |
+----------------------+--------------+------------------+-----------------+
@mereba
Copy link
Contributor Author

mereba commented Jan 31, 2026

@doganarif, thanks for the presentation at the meet up!
I thought I could use the momentum from our conversation to move the OTEL topic forward. I hope this issue fix helps?

- Add ExporterNoop constant for no-operation exporter
- Implement noopExporter that satisfies SpanExporter interface
- Add validation for unknown exporter types with clear error message
- Useful for benchmarking tracing overhead without network I/O
- Replace deprecated grpc.DialContext with otlptracegrpc.New
- Use otlptracegrpc options directly instead of manual gRPC connection
- Remove unused direct grpc imports (now indirect dependencies)
- Cleaner code with better connection management by OTEL SDK
- Test noop exporter initialization and shutdown
- Test stdout exporter initialization and shutdown
- Test unknown exporter type validation returns error
- Test noopExporter interface implementation
- Test exporter constant values
- Update WithOTelExporter doc comment with all valid values
- Update example flag description to mention noop exporter
@doganarif doganarif merged commit 0ffc049 into doganarif:main Feb 8, 2026
1 check passed
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.

Is Middleware Tracing Implemented without OTel?

2 participants