Skip to content

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

Description

@aoto-tech

Scope

Commit: 1a88d503e83ceb6688d41be1e00495abfd17f054 (0.4.0)

Actual and expected behavior

When an HTTP server span in OTLP JSON is converted, the operation that served the HTTP request is recorded as access:"call". The expected result is access:"serve".

OpenTelemetry's SpanKind specification distinguishes SERVER spans, which handle incoming requests, from CLIENT spans, which represent outgoing requests. The OTLP definitions assign SERVER=2 and CLIENT=3 (distinct from SDK-specific enum values).

Reproduction

Run the following after building. This can be verified by passing input to the conversion function; no HTTP traffic is required.

import { openTelemetryToResourceEvidence } from "./packages/adapter-opentelemetry/dist/index.js";

const result = openTelemetryToResourceEvidence({
  resourceSpans: [{
    scopeSpans: [{
      spans: [{
        name: "GET /users",
        kind: 2,
        attributes: [
          { key: "http.route", value: { stringValue: "/users" } },
          { key: "http.request.method", value: { stringValue: "GET" } }
        ]
      }]
    }]
  }]
}, {
  commitSha: "0000000000000000000000000000000000000000",
  generatedAt: "2026-09-08T00:00:00Z"
});
console.log(result.accesses);

Both kind:2 and kind:"SPAN_KIND_SERVER" produced {kind:"http",access:"call",selector:"/users",...}. The CLIENT inputs used for comparison (3 and SPAN_KIND_CLIENT) also produced call.

Cause and fix requirements

SpanLike/accessFromSpan does not read span.kind. normalizeOperation looks for the strings serve/server in the HTTP method GET, so server operations also become call. Direction should be determined from the standard span kind while preserving support for existing explicit CellFence operation settings.

Validation scope

The entire adapter source at the affected commit was transpiled in memory using TypeScript 5.9.3, and the four input variants above were passed to the public conversion function. No files were created and no actual network traffic was generated. The full test suite was not run.

If you find this repository useful, please consider giving it a star.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions