انتقل إلى المحتوى

لم تُترجم هذه الصفحة بعد، لذا تُعرض بالإنجليزية.

OpenTelemetry

Export OpenTelemetry traces, metrics, logs, errors, and profiles from Elide and your code over OTLP, with no SDK in the application: quick start, configuration, providers, and language APIs.

في هذه الصفحة

Elide is an OpenTelemetry SDK. JavaScript, TypeScript, and Python code uses the standard OpenTelemetry API for its language, and Elide supplies the implementation and the OTLP exporter. Elide’s own spans and metrics for served requests, fetch, errors, the process, and builds and tests join the same traces.

No SDK, exporter, or agent

Import the standard API and configure a destination; there is nothing else to install.

Off until configured

With no destination configured, Elide starts no telemetry threads and opens no connections.

Quick start

Start an OpenTelemetry Collector that prints what it receives:

docker run --rm -p 4317:4317 -p 4318:4318 otel/opentelemetry-collector:0.115.1

Write a script that creates a span:

// app.ts
import { trace } from "@opentelemetry/api";

const tracer = trace.getTracer("checkout");
await tracer.startActiveSpan("charge", async (span) => {
  span.setAttribute("order.id", 42);
  console.log("charged order 42");
  span.end();
});

Run it with the collector as its endpoint:

OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 OTEL_SERVICE_NAME=checkout elide run app.ts

The collector prints the span, and the console.log line as a log record carrying the span’s ids (excerpt):

Resource attributes:
     -> telemetry.sdk.name: Str(elide)
     -> service.name: Str(checkout)
InstrumentationScope checkout
Span #0
    Trace ID       : 5162303c77b9dab62b1d536ce955c103
    ID             : 410c19dcae7eda3c
    Name           : charge
    Kind           : Internal
Attributes:
     -> order.id: Int(42)

InstrumentationScope console
LogRecord #0
SeverityText: INFO
Body: Str(charged order 42)
Trace ID: 5162303c77b9dab62b1d536ce955c103
Span ID: 410c19dcae7eda3c

Elide exports pending data before it exits, so short scripts need no flush call.

@opentelemetry/api needs no install: Elide provides it when the project has no copy.

Configure a project

In a project, put the settings in elide.pkl. Credentials stay in environment variables, named by the manifest:

amends "elide:project.pkl"

name = "checkout"

opentelemetry {
  service { name = "checkout"; version = "1.4.2"; environment = "production" }
  destinations {
    ["collector"] { endpoint = "http://localhost:4318" }
    ["honeycomb"] { provider = "honeycomb" }
  }
}

Variables override the block and --otel-* flags override both; see Configuration.

Turn it off

elide run --no-otel app.ts          # one run
OTEL_SDK_DISABLED=true elide serve  # one process

Languages

LanguageAPIElide records
JavaScript and TypeScript@opentelemetry/api, @opentelemetry/api-logs, elide:telemetryServer spans, fetch client spans, console.* logs, errors
Pythonopentelemetry, logging, elide.telemetrylogging records, errors
Java and KotlinNoneNothing

Java and Kotlin programs that Elide runs get no OpenTelemetry API, agent, or trace context from Elide. Use the OpenTelemetry Java SDK or agent in the program as you would on any JVM. elide build and elide test still record their own spans for JVM projects; see Builds and tests in CI.

In this section

PageCovers
Configurationelide.pkl, environment variables, flags, precedence
ProvidersOTLP, Sentry, Datadog, PostHog, Honeycomb, Grafana Cloud
SignalsTraces, metrics, logs, errors, profiles
Runtime instrumentationServing, fetch, process metrics, CI spans
Correlation and baggageLinked signals, traceparent, W3C baggage
JavaScript and TypeScriptAPI, SDK takeover, elide:telemetry
PythonAPI, logging, elide.telemetry
Emitted telemetryEvery span, metric, and attribute Elide emits
TroubleshootingNothing arrives, rejected data, status counters

Samples

هل كانت هذه الصفحة مفيدة؟