-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
URL
https://opentelemetry.io/docs/languages/js/getting-started/nodejs/
Description
I think this page should include an example with OTLP exporters and otel-lgtm. Many users expect to find such an example in the getting-started guide, and they may feel confused when it’s missing.
As an alternative, this content could be placed in a separate getting-started page, such as "Node.js - OTLP".
sdk.ts
import { NodeSDK, tracing, metrics, logs } from '@opentelemetry/sdk-node';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
const sdk = new NodeSDK({
spanProcessors: [new tracing.SimpleSpanProcessor(new OTLPTraceExporter())],
logRecordProcessors: [
new logs.SimpleLogRecordProcessor(new OTLPLogExporter())
],
metricReader: new metrics.PeriodicExportingMetricReader({ exporter: new OTLPMetricExporter(), exportIntervalMillis: 1000 }),
instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start();
.env
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_SERVICE_NAME=test-service
OTEL_SERVICE_VERSION=1.0.0
docker-compose.yml
services:
otel-lgtm:
image: grafana/otel-lgtm:0.11.6
ports:
- "3000:3000" # Grafana
- "4317:4317" # OpenTelemetry Collector gRPC
- "4318:4318" # OpenTelemetry Collector HTTP
- "9090:9090" # Prometheus
- "3100:3100" # Loki
- "3200:3200" # Tempo
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1
or me too
, to help us triage it. Learn more here.
kholiavko-roman
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status