Skip to content

Add OpenTelemetry instrumentation#33

Open
AquiGorka wants to merge 4 commits intodevfrom
feat/otel-instrumentation
Open

Add OpenTelemetry instrumentation#33
AquiGorka wants to merge 4 commits intodevfrom
feat/otel-instrumentation

Conversation

@AquiGorka
Copy link

Summary

  • Adds withSpan tracing utility wrapping @opentelemetry/api with automatic span lifecycle, error recording, and exit_with_error events
  • Instruments all auth pipeline functions: P_CreateChallenge, P_VerifyChallenge, P_CompareChallenge, P_GenerateChallengeJWT, and store/update functions
  • Instruments bundle processing (P_AddOperationsBundle, P_GetBundleById, P_ListBundlesByUser) with Bundle.* helper spans
  • Instruments background services: Executor.* (including ensureOpexUtxosAvailable, handleExecutionFailure), Verifier.*, Mempool.* (including reAddBundles)
  • Naming convention: P_* for top-level processes, Class.method for internals
  • Adds OTEL config to .env.example and docker-compose.yml
  • Removes unused fly.provider-b.toml

Tracing is opt-in via OTEL_DENO=true — no overhead when disabled.

How to verify

Run the full E2E flow with Jaeger locally — see the step-by-step Jaeger guide in local-dev.

Note: To test locally before the SDK is published, revert the last commit in the local-dev PR (chore: switch SDK import from local path to JSR) so that the E2E test imports the SDK from the local path.

Test plan

  • Provider starts and serves requests with OTEL_DENO=true
  • E2E with deno task e2e + deno task verify-otel passes 16/16 checks
  • Jaeger shows 75+ provider app spans (auth, bundle, executor, verifier, mempool)
  • Distributed traces link SDK and provider spans via shared trace IDs

@AquiGorka AquiGorka requested review from fazzatti and toruguera March 12, 2026 17:27
Introduces a withSpan helper that wraps async functions in OpenTelemetry
spans with enter/exit events, error recording, and automatic span
lifecycle management. Foundation for function-level instrumentation.
Wraps all auth pipeline functions with OpenTelemetry spans:
P_CreateChallenge, P_CreateChallengeDB, P_CreateChallengeMemory,
P_VerifyChallenge, P_CompareChallenge, P_GenerateChallengeJWT,
and related store/update functions.
Wraps all service functions with withSpan using Class.method naming:
Bundle.validateSession, Bundle.parseOperations, Bundle.persistCreate/Spend,
Executor.buildTransactionFromSlot, Executor.submitTransactionToNetwork,
Executor.ensureOpexUtxosAvailable, Executor.handleExecutionFailure,
Verifier.verifyTransactionOnNetwork, Mempool.reAddBundles, and
P_AddOperationsBundle, P_GetBundle, P_ListBundles process pipelines.
….provider-b.toml

Adds commented-out OTEL configuration section to .env.example, adds
OTEL environment variables to docker-compose provider service, and
removes unused fly.provider-b.toml deployment config.
@AquiGorka AquiGorka force-pushed the feat/otel-instrumentation branch from 3419ba7 to c49391a Compare March 12, 2026 18:11
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