Skip to content

fix(adapter-opentelemetry): convert HTTP SERVER spans to access serve - #81

Open
Cid-oe wants to merge 1 commit into
aoto-tech:mainfrom
Cid-oe:fix/issue-78-otel-span-kind-server
Open

fix(adapter-opentelemetry): convert HTTP SERVER spans to access serve#81
Cid-oe wants to merge 1 commit into
aoto-tech:mainfrom
Cid-oe:fix/issue-78-otel-span-kind-server

Conversation

@Cid-oe

@Cid-oe Cid-oe commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Resolves #78

Summary

When an HTTP server span from OpenTelemetry (OTLP JSON) was processed by openTelemetryToResourceEvidence, the HTTP operation was normalized into access: "call" because span.kind was not inspected and HTTP method names (e.g. GET, POST) did not match the /server|serve/i regex. According to the OpenTelemetry trace specification and OTLP proto definitions, SpanKind.SERVER (2, "SPAN_KIND_SERVER") handles incoming requests and should be captured as access: "serve".

Changes

  • Updated SpanLike in packages/adapter-opentelemetry/src/index.ts to include kind?: unknown.
  • Updated normalizeOperation and accessFromSpan to inspect span.kind for HTTP spans, defaulting to "serve" when the span kind represents a server span (2, "2", "SPAN_KIND_SERVER", "SERVER"), while maintaining full support for explicit operation overrides (e.g., cellfence.resource.operation).
  • Added unit tests in tests/official-plugins.test.mjs verifying that HTTP SERVER spans (numeric 2 and string "SPAN_KIND_SERVER") produce access: "serve", CLIENT spans (3) produce access: "call", and explicit operation attributes take precedence.

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.

bug: [P2] OpenTelemetry HTTP SERVER spans are converted to outbound calls

1 participant