API referenceConsole
Connect

Requests, traces and fields

Add a request id and a trace id to your events, so Polylane groups them into requests and connects logs to traces. Also the field names that Polylane reads, and how it scrubs secrets.

Polylane reads some fields of each event as standard fields. Two of them connect your events:

  • A request id groups all the events of one request. The Requests tab on the Telemetry page shows each request with its duration, its status and all its logs.
  • A trace id connects a log to the spans of its trace. From a log, select View trace to open the trace. From a request, select Open trace.

Add both to every event. Then you can go from an error log to the request that caused it, and from the request to the slow call in its trace.

Group events by request

Give each request one id, and put that id on every event that the request makes. A request can be an HTTP request, a queue message, a scheduled job or a build.

JSON events

Add a requestId field to each event:

curl -X POST "https://events.polylane.com/v1/checkout-api" \
  -H "Content-Type: application/json" \
  -H "x-polylane-telemetry-token: <your-telemetry-token>" \
  -H "x-polylane-service: checkout" \
  -d '[
    { "message": "Checkout started", "level": "info", "requestId": "req_8f2c" },
    { "message": "Stripe declined the card", "level": "error", "requestId": "req_8f2c", "error": "card_declined" },
    { "message": "Checkout done", "level": "info", "requestId": "req_8f2c", "duration": 412 }
  ]'

Use the request id that your platform or load balancer gives you when there is one, such as the x-request-id header. Otherwise make one when the request starts. Add it to your logger once, so that each log line carries it:

server.ts
import { randomUUID } from "node:crypto";
import express from "express";
import pino from "pino";

const logger = pino();
const app = express();

app.use((req, res, next) => {
  const requestId = req.get("x-request-id") ?? randomUUID();
  req.log = logger.child({ requestId });
  res.set("x-request-id", requestId);
  next();
});

app.post("/checkout", (req, res) => {
  req.log.info("Checkout started");
  res.sendStatus(201);
});

Polylane reads the request id from the first of these fields that has a value. A dot in a name is a nested field, so request.id is { "request": { "id": "..." } }.

requestId, requestID, requestid, request_id, request.id, reqId, @requestId, aws_request_id, function_request_id, integrationrequestid, integration_request_id, faas.invocation_id, faas.execution

OpenTelemetry

Set a requestId attribute (or request_id) on the spans and log records of the request. Polylane also uses faas.execution and cloudflare.invocation_id when your instrumentation sets them, so AWS Lambda and Cloudflare Workers spans get a request id with no change.

Node.js
import { trace } from "@opentelemetry/api";

trace.getActiveSpan()?.setAttribute("requestId", requestId);

What the Requests tab shows

Each row is one request. Polylane takes:

  • the service and the route from the first event that has them;
  • the duration from the largest duration of its events, or from the first and the last event;
  • the status from the first status code of its events;
  • a failure when any event has an error, an error level or a status code of 500 or more.

Expand a row to see the logs of the request. Expand a log to see all its fields. The Trace tab shows the spans of the request on a timeline.

Connect logs to traces

A log with a trace id shows View trace. A log with a span id also shows under its span in the trace.

OpenTelemetry logs

When you send logs over OTLP, the trace id and the span id of each log record connect it to its trace. The OpenTelemetry instrumentations for common loggers, such as Pino, Winston, the Python logging module and Go slog, add them to each record when a span is active. You do not have to add fields.

JSON logs

Read the ids from the active span and add them as traceId and spanId:

import { trace } from "@opentelemetry/api";

const context = trace.getActiveSpan()?.spanContext();
logger.info({ traceId: context?.traceId, spanId: context?.spanId }, "Checkout started");

Polylane reads the trace id from traceId, traceID, trace_id, trace.id or xray_trace_id, and the span id from spanId, spanID, span_id or span.id.

Standard fields

Polylane reads these fields from JSON events. It takes the first name in each list that has a value. All other fields are attributes, and you can filter, group and calculate on each of them.

FieldNames that Polylane readsNotes
Messagemessage, Message, msg, log, Log, content, @message, data.message, data.msgThe text of the event.
Levellevel, Level, lvl, logLevel, LogLevel, log_level, loglevel, log.levelerror, err, fatal and critical make the event an error.
Errorerror, error.message, error.name, error.code, err, err.message, e, e.message, data.errorMessageAn event with an error counts as a failure. Send a string, such as the message of the exception.
Durationduration, durationMS, durationms, responseTime, @durationMilliseconds. Put it on at least one event of each request.
Status codestatusCode, status_code, http.status_codeA code of 500 or more counts as a failure.
Timestamptimestamp, @timestamp, time, ts, date, datetimeMilliseconds since the Unix epoch, or an ISO 8601 string. When it is not set, Polylane uses the time it received the event.
Serviceservice, or the x-polylane-service header, or the path /v1/<dataset>/<service>Use the same service name on all the events of a service.
Request idSee Group events by request
Trace id, span idSee Connect logs to traces

OpenTelemetry data uses the OpenTelemetry fields: service.name for the service, the span and log record fields for the ids, times and status, and the severity for the level.

Scrubbing

Polylane scrubs the values of fields whose names show a secret, before it stores the event. It does this for JSON events and for OpenTelemetry spans, span events, logs and metrics.

Polylane splits each field name at its dots, and compares each part to the names below. Case does not matter, so clientSecret matches clientsecret. The part must be equal to a name in the list.

KindNames
Passwordspassword, passwd, pwd, passphrase
Secrets and keyssecret, client_secret, client-secret, clientsecret, secret_key, secret-key, secretkey, secret_access_key, secretaccesskey, aws_secret_access_key, private_key, private-key, privatekey, api_key, api-key, apikey, x-api-key, access_key, accesskey
Tokenstoken, access_token, access-token, accesstoken, refresh_token, refresh-token, refreshtoken, id_token, idtoken, auth_token, auth-token, authtoken, x-auth-token, x-access-token, session_token, sessiontoken, bearer, jwt, csrf_token, csrftoken, x-csrf-token, x-xsrf-token
Authorizationauth, authorization, proxy-authorization, authorizer, credentials, creds
Cookiescookie, cookies, set-cookie
Connection stringsconnection_string, connectionstring, database_url, databaseurl, dsn
Payment and identitycard_number, cardnumber, credit_card, creditcard, cvv, cvc, ssn
Client addressessourceip, clientip

For example, Polylane scrubs password, user.Password, headers.authorization, http.request.header.cookie and config.privateKey. It does not scrub userPassword or gen_ai.usage.input_tokens, because no part of these names is equal to a name in the list. It keeps session.id, requestId and traceId, because Polylane uses them to group your events.

Polylane replaces a scrubbed value with stars, one for each character, up to 16 stars. You can still see that the field was there, but not its value.

Polylane does not look inside values. A secret in a message, in an error text or in the query string of a URL stays as you send it. Remove secrets and personal data before you send an event, or put them in a field whose name is in the list.

Polylane does not store the headers of the requests that you send to it. It reads your telemetry token, the dataset and the service from them. For browser events from the Polylane React library, it also keeps the device, the browser and the country.

Limits

LimitValue
Event size16 KB for each event
Attribute value2,048 characters
Attribute name256 characters
Message and error3 KB each
Request id, trace id, span id, service and level256 bytes each
Span name, route and URL512 bytes each
Event timeUp to 2 days before or after the time Polylane receives it

Polylane shortens a value that is longer than its limit. When an event is larger than 16 KB, Polylane keeps the standard fields and the first attributes, and drops the attributes that do not fit. Polylane marks a shortened event as truncated. Polylane does not store an event whose time is out of range.

  • Telemetry for the endpoints, the tokens and the OpenTelemetry setup.
  • Threads for how agents use telemetry in an investigation.