Skip to content

fix(tracing): set OTel service.name resource (default codex)#23

Draft
tyler-b4innova wants to merge 1 commit into
langfuse:mainfrom
tyler-b4innova:fix/service-name-resource
Draft

fix(tracing): set OTel service.name resource (default codex)#23
tyler-b4innova wants to merge 1 commit into
langfuse:mainfrom
tyler-b4innova:fix/service-name-resource

Conversation

@tyler-b4innova

Copy link
Copy Markdown

Problem

setupInstrumentation() constructs NodeTracerProvider with only spanProcessors and no resource. The provider falls back to defaultResource()service.name=unknown_service:node (Node argv0).

This makes multi-service Langfuse projects (shared ingest) unable to filter interactive Codex traces by service.name. The sibling Claude Code Python plugin already picks up OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES via the SDK's always-on OTEL env detector.

Fix

  • Build a resource with resourceFromAttributes
  • Default service.name to codex (override via OTEL_SERVICE_NAME)
  • Merge OTEL_RESOURCE_ATTRIBUTES (comma-separated k=v)
  • When unset, map plugin config.environmentdeployment.environment.name
  • Add direct dependency on @opentelemetry/resources

Test plan

  • pnpm test (existing suite)
  • pnpm run build
  • Manual: enable plugin with OTEL_SERVICE_NAME=codex and confirm resource attrs in Langfuse

NodeTracerProvider was constructed without a resource, so traces landed as
unknown_service:node. Honor OTEL_SERVICE_NAME / OTEL_RESOURCE_ATTRIBUTES and
default service.name=codex; map config.environment to deployment.environment.name.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jannikmaierhoefer

Copy link
Copy Markdown
Member

@claude review

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.

3 participants