Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenTracing collector exporter throws ReferenceError after trace export in Web application #1610

Closed
Sebosek opened this issue Oct 21, 2020 · 1 comment · Fixed by #1641
Closed
Labels
bug Something isn't working

Comments

@Sebosek
Copy link

Sebosek commented Oct 21, 2020

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

0.12.0

What version of Node are you using?

v12.18.3

Please provide the code you used to setup the OpenTelemetry SDK

opentelemetry.js

import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/tracing';
import { WebTracerProvider } from '@opentelemetry/web';
import { XMLHttpRequestPlugin } from '@opentelemetry/plugin-xml-http-request';
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';

const provider = new WebTracerProvider({
  plugins: [
    new XMLHttpRequestPlugin({
      ignoreUrls: [/localhost:8080\/sockjs-node/],
      propagateTraceHeaderCorsUrls: [],
    }),
  ],
});

provider.addSpanProcessor(new SimpleSpanProcessor(new CollectorTraceExporter({
  serviceName: 'user-management',
  url: 'http://localhost:30681/v1/trace',
})));
provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
provider.register();

const tracer = provider.getTracer('User-management');

export { tracer };

docker-compose.yaml

version: '3.4'

services:
  jaeger:
    image: jaegertracing/all-in-one:latest
    restart: always
    ports:
      - 5775:5775/udp
      - 6831:6831/udp
      - 6832:6832/udp
      - 5778:5778
      - 9411:9411
      - 14250:14250
      - 14268:14268
      - 16686:16686
    environment:
      COLLECTOR_ZIPKIN_HTTP_PORT: 9411
  
  collector:
    image: otel/opentelemetry-collector:0.12.0
    command: ["--config=/etc/collector-config.yaml", "--log-level=DEBUG"]
    restart: always
    ports:
      - "9464:9464"
      - "30680:55680"
      - "30681:55681"
    volumes:
      - ./collector-config.yaml:/etc/collector-config.yaml

collector-config.yaml

receivers:
  otlp:
    protocols:
      grpc:
      http:
        cors_allowed_origins:
          - http://*
          - https://*

exporters:
  jaeger:
    endpoint: jaeger:14250
    insecure: true

processors:
  batch:
  queued_retry:

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [jaeger]
      processors: [batch, queued_retry]

What did you do?

I'm using the XHR plugin, each reported span after the reporting throws the error: "Uncaught (in promise) ReferenceError: can't access lexical declaration 'promise' before initialization". Console exporter works without any issue.

What did you expect to see?

No error is thrown.

What did you see instead?

Unhandled error in dev. console.

Additional context

Firefox 81.0.2.
Here is a stack trace.

Uncaught (in promise) ReferenceError: can't access lexical declaration 'promise' before initialization
    _onFinish CollectorExporterBrowserBase.js:64
    _onSuccess CollectorExporterBrowserBase.js:57
    sendWithBeacon util.js:29
    promise CollectorExporterBrowserBase.js:72
    send CollectorExporterBrowserBase.js:54
    _export CollectorExporterBase.js:70
    _export CollectorExporterBase.js:67
    export CollectorExporterBase.js:52
    onEnd SimpleSpanProcessor.js:44
    with StackContextManager.js:103
    with context.js:60
    onEnd SimpleSpanProcessor.js:43
    onEnd MultiSpanProcessor.js:51
    end Span.js:134
    endSpanTimeout xhr.js:253
    endSpan xhr.js:271
@Sebosek Sebosek added the bug Something isn't working label Oct 21, 2020
@Sebosek Sebosek changed the title OpenTracing collector exporter throws ReferenceError after trace export OpenTracing collector exporter throws ReferenceError after trace export in Web application Oct 21, 2020
@jufab
Copy link
Contributor

jufab commented Oct 23, 2020

I think this is the same bug than #1601

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants