This module provides a collector exporter that exports traces using the OTLP/HTTP JSON format over a Fastly named log provider.
npm install --save @fastly/compute-js-opentelemetry
import { OTLPTraceExporter } from "@fastly/compute-js-opentelemetry/exporter-trace-otlp-fastly-logger";
// Instantiate a trace exporter.
// "@fastly/compute-js-opentelemetry/exporter-trace-otlp-fastly-logger" sends trace data to the named
// log provider, using the OTLP format. Be sure to specify the log provider, rather than a URL.
const traceExporter = new OTLPTraceExporter({
endpoint: 'test_logger'
});
// Specify the traceExporter when instantiating the SDK
import { FastlySDK } from "@fastly/compute-js-opentelemetry/sdk-fastly";
const sdk = new FastlySDK({
traceExporter,
});
await sdk.start();
// or, use it to manually create a span processor.
import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
const spanProcessor = new SimpleSpanProcessor(traceExporter);