question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@opentelemetry/exporter-collector-grpc not connecting after 0.20.0 upgrade

See original GitHub issue

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

  • Collector: otel/opentelemetry-collector-contrib:0.27.0
  • SDK: 0.20.0

What version of Node are you using?

v12.20.0

Please provide the code you used to setup the OpenTelemetry SDK

import { SimpleSpanProcessor } from '@opentelemetry/tracing';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { CollectorTraceExporter } from '@opentelemetry/exporter-collector-grpc';
import { NodeTracerProvider } from '@opentelemetry/node';

export class OpenTelemetry {
  static register({ serviceName, collectorUrl, instrumentations }) {
    const provider = new NodeTracerProvider();

    if (collectorUrl != false && collectorUrl != undefined) {
      const collectorExporter = new CollectorTraceExporter({
        serviceName: serviceName,
        url: collectorUrl,
      });
      provider.addSpanProcessor(new SimpleSpanProcessor(collectorExporter));
    }

    provider.register();

    registerInstrumentations({
      tracerProvider: provider,
      instrumentations,
    });

    ['SIGINT', 'SIGTERM'].forEach((signal) => {
      process.on(signal, () => provider.shutdown().catch(console.error));
    });
  }
}

What did you do?

Call OpenTelemetry.register({ serviceName: 'service', url: 'localhost:4317', instrumentations: [] ); on the top of src/index.js.

What did you expect to see?

My OpenTelemetry collector is running in kube (port-forwarded). I was expecting the NodeJS service to connect to it, returning a Handling connection for 4317 and registering the trace at our internal Jaeger (could be other tracing service).

What did you see instead?

No Handling connection for 4317 and no trace available

Additional context

I ran the code above with both 0.20.0 and 0.19.0 versions. It only give the expected behaviour on version 0.19.0.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sv2commented, Jun 18, 2021

I managed to set service name like this:

// Set service name
tracerProvider.resource.attributes['service.name'] = 'spectest';
const collectorOptions = {
  url: 'grpc://localhost:4327',
};
const exporterCollector = new CollectorTraceExporter(collectorOptions);
tracerProvider.addSpanProcessor(new SimpleSpanProcessor(exporterCollector));

There are notes in readmes of opentelemetry-exporter-* packages, which says service name is now not the part of exporter config. So looks like it was removed …

Service Name The OpenTelemetry Collector Exporter does not have a service name configuration. In order to set the service name, use the service.name resource attribute as prescribed in the OpenTelemetry Resource Semantic Conventions.

https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-exporter-collector

1reaction
brunoluizcommented, Jun 8, 2021

Well, updating the URL to grpc://... definitely worked in terms of connection. But, it still didn’t register any traces 😞

Read more comments on GitHub >

github_iconTop Results From Across the Web

OTLP exporter endpoint config should require scheme #2539
Running collector version 0.20.0 configured to use the OTLP exporter as follows: exporters: otlp: endpoint: https://my-otlp-endpoint:4317/ I ...
Read more >
@opentelemetry/exporter-collector-grpc - npm
The CollectorTraceExporter in Node expects the URL to only be the hostname. It will not work with /v1/metrics . All options that work...
Read more >
@opentelemetry/exporter-trace-otlp-proto - Package Manager
OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector using protobuf over HTTP.
Read more >
OpenTelemetry Operator Helm Chart - Artifact Hub
The following example configuration deploys the Collector as Deployment resource. The receiver is Jaeger receiver and the exporter is logging exporter. $ ...
Read more >
OTLP Exporter Configuration - OpenTelemetry
The following environment variables let you configure an OTLP/gRPC or OTLP/HTTP endpoint for your traces, metrics, and logs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found