Docs · Product guides
Runtime instrumentation and retained traces
Source: docs/
Porthole receives stock OpenTelemetry OTLP HTTP with protobuf and HTTP with JSON at
/v1/traces. Use the installation's HTTPS origin in production. Mint an ingest
credential in Settings with only the application's named services, environments,
teams, traces signal and telemetry.write action. Keep the credential in the
process supervisor's private environment or secret store; never put it in code,
URLs, command arguments, images or shared logs. A collector forwarding several
services needs that explicit union of service grants and has no read authority.
Set OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES (including
service.version, deployment.environment.name and team.name),
OTEL_EXPORTER_OTLP_ENDPOINT to the origin and
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT to the origin plus /v1/traces, and
OTEL_EXPORTER_OTLP_PROTOCOL=http/. Configure exporter authentication
through its private OTEL_EXPORTER_OTLP_HEADERS setting. Do not copy the value
into a support packet. Preserve the original source code and release identifier in
resource attributes; Porthole does not infer one from arrival time.
Use W3C tracecontext with Porthole's policy propagator. Baggage is off
without a valid owner-deployed policy file, regardless of the stock baggage
propagator setting. The supplied register modules replace the global propagator;
do not install a competing baggage propagator or request-header capture plugin.
The native owner opens /app/settings/instrumentation, reviews forwarding keys
and the separate span-attribute allowlist, and saves with a fresh five-minute
proof. Admins, nonowners and credentials cannot read or change this policy.
Saving requires the current revision and explicit consent and records a private
audit fact. Download policy.json, deploy it read-only, and set
PORTHOLE_BAGGAGE_POLICY to its path in every process. Restart after deployment.
A saved Settings revision does not remotely replace existing process files;
operators must deploy and restart all affected processes, including when turning
forwarding off. Missing, invalid or unreadable files disable baggage and emit a
value-free diagnostic. Archive restore preserves the lists but disables the
policy until the destination owner explicitly approves and redeploys it.
Each supplied propagator filters extraction and injection, preserving explicit
trace IDs independently. Only owner-allowlisted keys pass, with at most eight
entries and 256 UTF-8 bytes per decoded value. A 16-KiB incoming header cap
refuses the entire baggage header. Sensitive key patterns (auth, token,
email, name, secret, password, cookie, credential, session, API key,
address, phone, case-insensitive) always win, including over an allowlist.
Malformed members and every copy of a duplicate key are refused before native
parsers see them. Refusal logs contain revision, reason and counts, never refused
keys or values. Node
also emits porthole.baggage.refused span events, visible in the trace API and
waterfall details. Node copies only separately approved attributes with the
baggage. prefix; the other six supplied paths copy no baggage into attributes.
Forwarding never grants content capture. Telemetry an application independently
emits remains subject to existing ingestion and data scope; this policy grants no
wider reader or request-header collection.
For adoption outside these examples, retain the matching policy module:
Node loads ./ before clients and frameworks; Python
imports porthole_policy.py before serving; Go installs policyPropagator beside
propagation.TraceContext; .NET installs PolicyPropagator before building the
host; Ruby loads porthole_policy.rb after SDK configuration and before serving;
PHP registers policy.php before the framework obtains Globals; Java uses the
shipped extension JAR, OTEL_JAVAAGENT_EXTENSIONS=/ and
OTEL_PROPAGATORS=tracecontext,. The Dockerfile builds that extension
against the pinned published OTel API and SPI. The Java process classpath must also
include the matching opentelemetry-common runtime JAR; the supplied launch uses
-cp ".:lib/*". Keep each process's documented
framework setup and release metadata. No egress proxy or vendor key is added.
Seven install paths
The executable examples under ./instrumentation/polyglot are ordinary services,
not a Porthole-specific telemetry generator. They call each other over real
HTTP. The stock libraries create the spans and inject and extract context.
- Node 22, HTTP and gRPC: install the exact
@opentelemetry/sdk-node,@opentelemetry/,exporter-trace-otlp-proto @opentelemetry/andinstrumentation-http @opentelemetry/versions in the root package manifest (0.300.0), plusinstrumentation-grpc @opentelemetry/api1.10.0. The supplied register also loads@opentelemetry/0.33.0; install that package even if the application has no Kafka client. Loadinstrumentation-kafkajs ./before importinginstrumentation/ node/ register.cjs node:http,node:httpsor@grpc/grpc-js, for example with Node's--requireflag. Applications with an ESM dependency graph must use OpenTelemetry's supported ESM instrumentation loader before those libraries load. The example and qualification use CJS. - Python 3.12, Flask and Requests: create a virtual environment, install
instrumentation/, then launch withpolyglot/ python/ requirements.txt opentelemetry-instrument python app.py. Flask server and Requests client instrumentation is configured before the application imports either library. No custom span payloads are needed. - Java 21, HttpServer and HttpClient: fetch OpenTelemetry Java agent 2.32.0
from Maven Central, verify SHA-256
f787eb6c7f3d18e69a431e108a15278d25ee37f83d68b678f621e063f3988f82, and add-javaagent:/to the real Java process. The example'sabsolute/ path/ opentelemetry-javaagent.jar jdk.httpservermodule and normal JDK HTTP client are instrumented by the agent. No exporter implementation is copied into the application. - Go 1.25, net/http: use the pinned modules and initialization in
instrumentation/polyglot/go. Go requires a rebuild: wrap the server handler with stockotelhttp.NewHandler, the outbound transport withotelhttp.NewTransport, and use the inbound request's context for outbound calls. Start the stock OTLP exporter/tracer provider and shut it down on a graceful application exit. Omitting the context is a visible broken boundary, not a reason to merge traces by time. - .NET 8, ASP.NET Core and HttpClient: add the 1.20.1 package references in
instrumentation/, registerpolyglot/ dotnet/ Polyglot.csproj AddOpenTelemetry(), explicitly set the service resource withAddService, and useWithTracing(...)withAddAspNetCoreInstrumentation,AddHttpClientInstrumentationandAddOtlpExporter, then rebuild. Use the general OTLP endpoint setting as well: this exporter registration readsOTEL_EXPORTER_OTLP_ENDPOINT, then adds the HTTP trace path. Hosting starts and stops the provider. The example uses the actual framework middleware and HttpClient diagnostic listeners, with no hand-built spans. - Ruby 3.3, Rack and Net::HTTP: install the pinned Gemfile, require the SDK,
exporter and instrumentation before the application, configure both stock
integrations, and mount the Rack tracer middleware as in
ruby/app.rb. Install a C compiler, make and libc headers when Bundler builds numeric dependencies; these are build prerequisites, not a silent unsupported path. - PHP 8.3, Slim: install the stock
opentelemetryextension 1.4.2 and the pinned Composer dependencies inphp/composer.json. EnableOTEL_PHP_AUTOLOAD_ENABLED=trueand load Composer's autoloader before creating Slim. The extension hooks the framework; the SDK/exporter auto-configuration consumes the same OTLP resource/export settings. PHP requires the extension's normal native build tooling and Composer's archive tools.
For KafkaJS 2.2.4 install @opentelemetry/ 0.33.0 and
load the supplied Node register module before importing KafkaJS. Keep the
instrumentation's context headers on actual producer messages and consumer
processing. Do not create unrelated timestamp-based parent links. The
qualification uses Apache Kafka 3.9.1 with a real topic and consumer group, plus
HTTP and gRPC and asynchronous fanout. This does not claim compatibility with every
Kafka client or deployment; missing framework/context boundaries remain gaps.
Read and diagnose
Open /app/traces, paste an original 32-hex trace ID, and open its retained
waterfall. / exposes the same graph to native
sessions or scoped read credentials. Both enforce current service, environment
and team grants and immediate credential revocation. Finance readers cannot
read telemetry. Trace reads are privately audited without copying query contents.
Original start and end nanoseconds, durations, status and errors, resource and version, instrumentation scope, attributes, events and causal links remain inspectable. Bars show offsets and durations against the observed trace window. Async work may overlap or outlive its producer; it is never shortened to fit a parent. Identical re-deliveries are counted as copies. Different content under the same span ID remains separate conflicting variants, and cannot be selected as an unambiguous parent. Missing or out-of-scope parents have the same diagnostic so a restricted reader cannot infer hidden services. Cycles are never attached. A connected retained graph is not a claim of complete upstream instrumentation or sampling coverage. Empty, incomplete and unavailable states remain explicit.
One transaction reads at most 2,000 authorized retained records. More records
produce truncated: true and an Incomplete graph. The generic records/query
API accepts the same trace filter and bounded limit. A completion-sequence
snapshot freezes the read and survives restart; the trace's JSON link repeats
it. Later deliveries never alter an earlier snapshot. Current scope still
applies to every replay. The graph derives from the existing archived telemetry;
it adds no separate durable domain or restore authority.
Qualification
Push Verify's parallel traces shard runs traceJourney in
tests/porthole/traces.mjs through the emitted Worker and native auth. It drives
stock Node HTTP and gRPC, real overlapping operations and a real TCP forwarder with
a deliberately incorrect parent, plus schema-edge conflicting and cyclic identities.
It checks original timing/restart/snapshot, role/scope/revocation, independently owned inactive archive restore/replay, and all changed
screen states at 1440 and 390. It does not stand in for the seven-runtime drill.
For that drill, on a dedicated Docker-capable machine, build the six examples
with bash instrumentation/ (set PORTHOLE_CA_FILE when the
host's trust bundle is elsewhere), build the product, commit the candidate,
and run:
PORTHOLE_TRACE_ONLY=1 PORTHOLE_POLYGLOT=1 \PORTHOLE_CANDIDATE_SHA="$(git rev-parse HEAD)" node tests/runtime.mjsThe journey starts only its own named containers, a disposable Kafka and a local
OTLP forwarding gateway. It creates a native scoped ingest credential, executes
one Node/Python/Java/Go/.NET/Ruby/PHP trace and asserts the whole returned graph.
Warm-up calls have different trace identities. The gateway forwards stock bytes
to the real intake and supplies no telemetry or product/storage responses. It
holds the test's credential so the containers do not need a persistent secret.
The journey removes its own containers and closes its own listener, including on
failure. Screenshots, when requested with PORTHOLE_EVIDENCE_DIR, belong outside
the product repository. A recorded pass on the exact candidate is required;
successfully building an image alone proves no application clause.
Run the native archive drill serially after the runtime drill:
node tests/porthole/native-archive.mjs It invokes the pinned native rer setup, export and import commands against separate
source and destination checkouts, including independent owner bootstrap and disabled
policy restoration. Intact archives containing malformed allowlists or broader
attribute permission refuse before any domain rows are published. Keep these
qualification commands serial when they share dependencies and compiler caches. On
a dedicated CI VM, the CLI's documented CI=true mode skips its local admission
queue; it retains migrations, build, readiness and all journey assertions.
Docker collection and the Linux Kubernetes DaemonSet are documented in Collector installation, including privilege gaps, zero-code instrumentation limits and uninstall effects.