Skip to content

Missing root span #53

@d2verb

Description

@d2verb

What version of Elysia is running?

1.4.4

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

  1. bun create elysia elysia-otel -> bun add @elysiajs/opentelemetry.
  2. Edit src/index.ts like below.
import { Elysia } from "elysia";
import { opentelemetry } from "@elysiajs/opentelemetry";
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";

const app = new Elysia()
  .use(opentelemetry({
    serviceName: "api",
    spanProcessors: [
      new BatchSpanProcessor(new OTLPTraceExporter({
        url: "https://api.honeycomb.io/v1/traces",
        headers: {
          "x-honeycomb-team": Bun.env.HONEYCOMB_TOKEN!,
        },
      })),
    ],
  }))
  .get("/health", () => ({ status: "ok" }))
  .listen(3000);

console.log(
  `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
);
  1. bun run dev
  2. Access http://localhost:3000/health from browser (I used Chrome).
  3. Go to dashboard of honeycomb to see sent traces.
  4. Click any random trace to see the details, and you will notice that no trace has a root span as shown below.
Image

What is the expected behavior?

All trace should have a root span.

What do you see instead?

No trace has a root span.

Additional information

I don't know if it's a bug or just me using it wrong, but I'll open an issue as a bug anyway. I'd be glad if someone could help me. 😢

Have you try removing the node_modules and bun.lockb and try again yet?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions