Skip to content

feat(observability): opt-in OpenTelemetry tracing for manager and dns-server - #70

Merged
PenguinzTech merged 1 commit into
v2.1.xfrom
feature/otel-tracing
Jul 27, 2026
Merged

feat(observability): opt-in OpenTelemetry tracing for manager and dns-server#70
PenguinzTech merged 1 commit into
v2.1.xfrom
feature/otel-tracing

Conversation

@PenguinzTech

@PenguinzTech PenguinzTech commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Opt-in OpenTelemetry tracing for the manager (Flask + requests instrumentation) and dns-server (ASGI middleware + requests). Initializes ONLY when OTEL_EXPORTER_OTLP_ENDPOINT is set — default is completely off: lazy imports, no provider, apps boot fine without the packages loaded. W3C traceparent propagation manager↔dns-server, service.name/version resource attributes, OTLP HTTP exporter with BatchSpanProcessor. Deps exact-pinned (otel 1.24.0 / instrumentation 0.45b0) in both services' requirements. Ops section added to docs/DEVELOPMENT.md (enablement, sampling knobs, Jaeger example).

Tests: 210 green (147 manager + 63 dns-server; 10 new using InMemorySpanExporter — no collector dependency, disabled-by-default proven).


Stack note: bases on chore/dedup-reusable-code (top of the #53#59 chain); auto-retargets toward v2.1.x as the stack merges bottom-up.

🤖 Generated with Claude Code

Summary by Sourcery

Add opt-in OpenTelemetry tracing for the manager and DNS server, initializing only when configured via environment and remaining disabled by default.

New Features:

  • Introduce OpenTelemetry-based request tracing for the manager (Flask) and DNS server (ASGI) including HTTP client instrumentation and W3C trace context propagation.

Enhancements:

  • Attach service metadata (service.name and service.version) to trace resources for both manager and DNS server.
  • Provide pluggable exporters for tracing to support in-memory testing and OTLP HTTP export in production.

Build:

  • Pin OpenTelemetry core, SDK, OTLP HTTP exporter, and instrumentation packages in manager and DNS server dependency lists.

Documentation:

  • Add observability documentation describing OpenTelemetry tracing enablement, configuration via environment variables, sampling strategies, and Jaeger-based local testing.
  • Clarify separation of logs, metrics, and traces in the observability section.

Tests:

  • Add observability tests for manager and DNS server verifying disabled-by-default behavior, optional initialization via exporters, and basic instrumentation wiring.

…-server

Add OpenTelemetry tracing support with opt-in gate via OTEL_EXPORTER_OTLP_ENDPOINT:
- Zero overhead when disabled (no SDK init, lazy import)
- Manager (Flask): TracerProvider + Flask/Requests instrumentation
- DNS-server (Quart/ASGI): TracerProvider + ASGI middleware + Requests instrumentation
- Service metadata: service.name + service.version in resource
- Exact-pinned compatible dependencies (api/sdk/exporter/instrumentation)
- Tests: verify disabled-by-default, InMemorySpanExporter for testing
- Docs: enable/config/sampling in DEVELOPMENT.md

Manager: opentelemetry-api/sdk/exporter/instrumentation-flask/instrumentation-requests
DNS-server: same + instrumentation-asgi for ASGI middleware

All tests pass (147 manager + 63 dns-server).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@PenguinzTech PenguinzTech self-assigned this Jul 26, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 26, 2026

Copy link
Copy Markdown

🧙 Sourcery is reviewing your pull request!


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@socket-security

Copy link
Copy Markdown

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Low
Filesystem access: pypi opentelemetry-api

Location: Package overview

From: dns-server/requirements.txtpypi/opentelemetry-api@1.24.0

ℹ Read more on: This package | This alert | What is filesystem access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: If a package must read the file system, clarify what it will read and ensure it reads only what it claims to. If appropriate, packages can leave file system access to consumers and operate on data passed to it instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore pypi/opentelemetry-api@1.24.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Low
Filesystem access: pypi opentelemetry-sdk

Location: Package overview

From: dns-server/requirements.txtpypi/opentelemetry-sdk@1.24.0

ℹ Read more on: This package | This alert | What is filesystem access?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: If a package must read the file system, clarify what it will read and ensure it reads only what it claims to. If appropriate, packages can leave file system access to consumers and operate on data passed to it instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore pypi/opentelemetry-sdk@1.24.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @PenguinzTech, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@PenguinzTech
PenguinzTech changed the base branch from chore/dedup-reusable-code to v2.1.x July 27, 2026 00:55
@PenguinzTech
PenguinzTech merged commit aa09fdf into v2.1.x Jul 27, 2026
3 of 4 checks passed
@PenguinzTech
PenguinzTech deleted the feature/otel-tracing branch July 27, 2026 01:15
PenguinzTech added a commit that referenced this pull request Jul 27, 2026
requirements.in/.txt: both sides added dependencies (boto3 for KMS,
opentelemetry-* for #70's tracing, already merged) -- combined,
neither dropped. No hash conflicts (unhashed pins). Both packages
already present in the shared venv; import-verified.

flake8-bugbear (enforced since #78 merged) caught one genuine unused
import surfaced by the combine: typing.List in auth_service.py.

Full manager suite: 255/255 passing. flake8 clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant