testOtlpTarget
tcmts.cli.web.testOtlpTarget · #gcp3sz3t · term
import { otlpTarget } from "#codebase/tcmts/cli/web";
import assert from "node:assert/strict";
export const testOtlpTarget = () => {
assert.equal(otlpTarget({}), undefined);
assert.deepEqual(
otlpTarget({
OTEL_EXPORTER_OTLP_ENDPOINT: "https://api.honeycomb.io/",
OTEL_EXPORTER_OTLP_HEADERS: "x-honeycomb-team=abc%3D, x-other = 1",
}),
{
url: "https://api.honeycomb.io/v1/traces",
headers: { "x-honeycomb-team": "abc=", "x-other": "1" },
},
);
// the traces endpoint is used as it is, and its own headers are first
assert.deepEqual(
otlpTarget({
OTEL_EXPORTER_OTLP_ENDPOINT: "http://a",
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: "http://b/traces",
OTEL_EXPORTER_OTLP_TRACES_HEADERS: "k=v",
OTEL_EXPORTER_OTLP_HEADERS: "x=y",
}),
{ url: "http://b/traces", headers: { k: "v" } },
);
assert.ok(
"problem" in
otlpTarget({ OTEL_EXPORTER_OTLP_ENDPOINT: "http://a", OTEL_EXPORTER_OTLP_PROTOCOL: "grpc" })!,
);
}
uses