Skip to content

Zipkin expected a long #4056

Closed
Closed
@n0cloud

Description

@n0cloud

What happened?

When using exporter-zipkin, I'm not getting any trace in zipkin.

Steps to Reproduce

  1. Start Zipkin with --logging.level.zipkin=DEBUG --logging.level.zipkin2=DEBUG
  2. Export any trace with @opentelemetry/exporter-zipkin.

Expected Result

Trace should be accepted by Zipkin.

Actual Result

Zipkin throwing an exception when receiving the trace:

2023-08-11 16:18:00.097 DEBUG [/] 1 --- [rker-epoll-2-19] z.s.i.ZipkinHttpCollector                : Cannot decode spans due to IllegalArgumentException(Expected a long but was 51920.504 at line 1 column 151 path $[0].duration reading List<Span> from json)

Additional Details

I think rounding the duration in the exporter should fix the issue.

I'm using Zipkin version 2.24.3

OpenTelemetry Setup Code

import { ZipkinExporter } from '@opentelemetry/exporter-zipkin';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { NestInstrumentation } from '@opentelemetry/instrumentation-nestjs-core';
import { Resource } from '@opentelemetry/resources';
import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';

const provider = new NodeTracerProvider({
  resource: new Resource({
    [SemanticResourceAttributes.SERVICE_NAME]: 'myServiceName',
  }),
});

const zipkinExporter = new ZipkinExporter();

provider.addSpanProcessor(new SimpleSpanProcessor(zipkinExporter));

provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));

provider.register();

registerInstrumentations({
  instrumentations: [
    new NestInstrumentation(),
  ],
  tracerProvider: provider,
});

package.json

...
    "@opentelemetry/api": "^1.4.1",
    "@opentelemetry/auto-instrumentations-node": "^0.38.0",
    "@opentelemetry/exporter-zipkin": "^1.15.2",
    "@opentelemetry/sdk-metrics": "^1.15.2",
    "@opentelemetry/sdk-node": "^0.41.2",
...

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p2Bugs and spec inconsistencies which cause telemetry to be incomplete or incorrect

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions