Getting started
Install the extension, start the receiver, and point your app's OTLP exporter at it. Your instance, logs, traces and metrics appear as data arrives.
1. Install
Search “OpenTelemetry” in the Extensions view, open it directly in VS Code, or install from a terminal:
code --install-extension SukantaSaha.opentelemetry
Requires VS Code 1.95 or later.
2. Start the receiver
Open the OpenTelemetry view in the Activity Bar and click Start Receiver (or click the OTel status bar item and choose Start Receiver). The status bar then shows the active gRPC and HTTP ports.
The Get Started walkthrough opens after install and covers these steps; reopen it any time with OpenTelemetry: Get Started. Want the receiver running all the time? Set otel.launchOnStartup to true.
3. Send telemetry
Apps launched from VS Code
When you run or debug an app from VS Code, the extension automatically injects the OTEL_EXPORTER_OTLP_ENDPOINT environment variable so a configured OTLP exporter sends data to the receiver. You can disable this with the otel.overwriteEnvVars setting.
Apps running outside VS Code
Point the exporter at the receiver yourself. OpenTelemetry: Connect Your App… (also a plug button in the OpenTelemetry view) copies the environment variables for bash/zsh or PowerShell, copies an endpoint, opens a terminal with the variables already set, or shows a per-language snippet. The variables it sets:
export OTEL_EXPORTER_OTLP_ENDPOINT='http://127.0.0.1:4317'
export OTEL_EXPORTER_OTLP_PROTOCOL='grpc'
export OTEL_TRACES_EXPORTER='otlp'
export OTEL_METRICS_EXPORTER='otlp'
export OTEL_LOGS_EXPORTER='otlp'
OpenTelemetry: Open Terminal With OTLP Environment opens a new terminal with these already set.
You can also route data through an OpenTelemetry Collector by adding the receiver as an OTLP exporter target, so the same data reaches both your production backend and VS Code.
Per-language snippets
import { NodeSDK } from '@opentelemetry/sdk-node';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
const sdk = new NodeSDK({
traceExporter: new OTLPTraceExporter({ url: 'http://127.0.0.1:4317' }),
});
sdk.start();
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
exporter = OTLPSpanExporter(endpoint="http://127.0.0.1:4317", insecure=True)
exporter, _ := otlptracegrpc.New(ctx,
otlptracegrpc.WithEndpointURL("http://127.0.0.1:4317"),
otlptracegrpc.WithInsecure())
builder.Services.AddOpenTelemetry()
.WithTracing(t => t.AddOtlpExporter(o => o.Endpoint = new Uri("http://127.0.0.1:4317")));
-Dotel.exporter.otlp.endpoint=http://127.0.0.1:4317 -Dotel.exporter.otlp.protocol=grpc
Common workflows
Debug a failing request
- Start your app and generate some traffic.
- Open Traces and set status to Error (or type
status=error dur>200msin the query bar). - Select the failed trace to open its waterfall. Log markers on the bars show where logs were written; click one, or a span, to see its attributes, events, links and logs in the details pane.
- Click View logs to open Logs filtered to that span (or View logs for trace for the whole request), then Navigate To Code to jump to the source.
Going the other way works too: select a log and click View Trace (or click its Trace ID) to open the waterfall with the log's span selected. OpenTelemetry: Find Trace by ID accepts a trace ID or a W3C traceparent pasted from your terminal.
Share a reproduced bug (traces, logs and metrics)
- Reproduce the problem with the receiver running.
- Click Save Session… in the Instances view toolbar. To save less, use Save Instance… on an instance, or right-click a trace in the Traces panel and choose Export Trace… to get that trace and its correlated logs.
- Your teammate runs OpenTelemetry: Load Session…. The file opens under Imported, and the waterfall, logs, metrics charts and service map all work. A loaded file is kept separate from live data and from other files, so the same trace never shows twice.
Open CI or Collector output: Load Session… also accepts a bare OTLP/JSON request, or the JSON Lines written by the OpenTelemetry Collector file exporter.
Share a log sample with a teammate
- Open Logs and narrow the table with the search, level, attribute and time-range controls.
- Optionally select specific rows (Cmd/Ctrl+click, or Shift+click for a range).
- Click Export, pick a format and scope, and save the file.
- Your teammate runs OpenTelemetry: Import Logs From File to open it under Imported — read-only, retention-exempt, and unaffected by Clear Collected Data.
Bring in logs from another vendor
- Export logs from your log platform as JSON Lines (one JSON object per line,
.jsonl/.ndjson). - Run OpenTelemetry: Import Logs From File and pick the file.
- Nested objects are flattened to dotted attribute keys, and the timestamp, severity, message, trace/span IDs, scope and service name are recognised from common field names. Epochs in seconds, milliseconds, microseconds or nanoseconds are detected automatically. Unreadable lines are skipped and counted rather than failing the whole import.
Understand what a service talks to
- Generate distributed traffic (HTTP calls, database queries, queue messages).
- Open the Service Map to see services, databases and queues and how they connect.
Find telemetry that will cost you in production
- Run your app and send representative traffic for a few minutes.
- Click Open Cardinality & Cost Analyzer in the Instances view's … menu or the flame status bar item, or right-click a service and choose Analyze Cardinality & Cost. Services with findings show a badge in the Instances view.
- On Overview, start with the critical findings. Select one for redacted example values, how its unique values grew, and the fix (for example “group by
http.routeinstead ofurl.full”). - Open Pricing, enter your backend's prices and a traffic multiplier (production volume ÷ local volume), and click Calculate to see a monthly estimate. Save for this workspace keeps the prices.
- Capture a baseline before and after a fix: the Baseline tab lists new, grown and resolved findings. See Cardinality & cost analyzer.