Skip to content
betterstack-alchemyUnofficial

Cloud.Otlp

Kind ResourceType id BetterStack.Cloud.OtlpSource src/Cloud/Otlp.tsLive test gated Lifecycle test runs against the offline mock; a live run exists but is gated behind BETTERSTACK_TEST_CLOUD_BILLABLE=1 because it bills; live runs need the owner's go-ahead (test/Cloud/Otlp.test.ts).

A Better Stack Cloud OTLP metrics export: every minute, it sends the metrics of the team’s servers in this zone to your OpenTelemetry (OTLP over HTTP) receiver, at endpoint + /v1/metrics.

Everything but teamId and availabilityZone changes in place: name, endpoint, headers, resourceTypes, status (active/paused) and temporality (cumulative by default; Prometheus-based backends refuse delta). headers is write-only (secret values, Redacted): the API answers only headerNames. A failing receiver shows in lastError, and after 24 hours without a delivery the export pauses itself (pausedReason: "delivery_failed").

Ownership. The API keeps no metadata for it, so the generated name (it ends in the resource instance’s random suffix) is what identifies an object this stack created: a create interrupted before its state was saved is found by that name on the next deploy. An explicitly named object can’t be told apart from someone else’s (it is taken over only with --adopt), and list returns every object.

To an OTLP receiver with a bearer token

const otlp = yield* BetterStack.Cloud.Otlp("metrics", {
endpoint: "https://otlp.example.com",
resourceTypes: ["server"],
headers: { Authorization: Redacted.make(`Bearer ${process.env.OTLP_TOKEN}`) },
});

Paused, with delta temporality

yield* BetterStack.Cloud.Otlp("metrics-delta", {
name: "metrics-delta",
endpoint: "https://otlp.example.com",
resourceTypes: ["server"],
temporality: "delta",
status: "paused",
});

Reference an export by id

const existing = BetterStack.Cloud.Otlp.lookup({ id: "42" });

endpoint string required

The base URL of your OTLP receiver over HTTP, such as https://otlp.example.com. We add /v1/metrics unless the URL already ends with it. Must use https and have up to 2048 characters. Can't include credentials, a query string or a fragment. An IP address in a private, loopback, link-local or multicast range is refused.

resourceTypes string[] required

What the export sends metrics of. Use server. Can't be empty.

availabilityZone string

Availability zone the resource lives in, such as us-west-2a. Defaults to the credentials' zone (BETTERSTACK_AVAILABILITY_ZONE, or the profile's). Changing it replaces the resource. A child of a resource in another zone (a firewall rule, a node pool, a snapshot of an instance outside the credentials' zone) must repeat the parent's availabilityZone: it receives only the parent's id, so its zone cannot be derived.

headers { readonly [header: string]: Redacted<string>; }

The headers your receiver needs, such as Authorization, each value Redacted: up to 16 headers, 8 KiB in total (Content-Type, Content-Encoding, User-Agent and hop-by-hop headers aren't allowed). Write-only: the API returns only the names (headerNames), so a change is detected against the previous deploy's values, never the API. An update replaces all headers. Changes in place. Leaving the prop out keeps the headers the export has; {} removes them.

name string

The export's name, up to 255 characters, unique in the organization. Defaults to a unique name generated from the stack, stage and logical id. Changes in place.

status "active" | "paused" | string

Whether the export is sending. A paused export set to active again sends metrics from that moment on. - active: The export sends metrics every minute. - paused: The export sends nothing.

teamId string

Team that owns the resource, such as t123. Defaults to the credentials' team (BETTERSTACK_TEAM_ID, or the profile's team). Changing it replaces the resource.

temporality "cumulative" | "delta" | string

How we send the byte counters. Defaults to cumulative. - cumulative: Each data point holds the total since the series started. - delta: Each data point holds the bytes of one interval. Prometheus-based backends refuse delta.

availabilityZone string always set

Availability zone the resource lives in, such as us-west-2a.

id string always set

The export's ID.

createdAt string

When the export was created.

endpoint string

The base URL of your OTLP receiver over HTTP, such as https://otlp.example.com. We add /v1/metrics unless the URL already ends with it. Must use https and have up to 2048 characters. Can't include credentials, a query string or a fragment. An IP address in a private, loopback, link-local or multicast range is refused.

headerNames string[]

The names of the export's headers, in alphabetical order.

lastDeliveredAt string | null

When the receiver last accepted a request.

lastError string | null

Why the last delivery failed, such as HTTP 401, or how many data points the receiver rejected. last_error is null after a delivery without a problem.

lastErrorAt string | null

When the error in last_error happened.

meta OtlpMeta

name string

The export's name, up to 255 characters. Must be unique in the organization.

pausedReason string | null

Why we paused the export, or null while the export is active or when you paused it. - delivery_failed: No request reached the receiver for 24 hours. - destination_refused: The endpoint's hostname resolved to a private or otherwise refused address.

resourceTypes string[]

What the export sends metrics of. Use server. Can't be empty.

status "active" | "paused"

Whether the export is sending. A paused export set to active again sends metrics from that moment on. - active: The export sends metrics every minute. - paused: The export sends nothing.

teamId string

The ID of the team whose metrics the export sends. betterstack team list shows it.

temporality "cumulative" | "delta"

How we send the byte counters. Defaults to cumulative. - cumulative: Each data point holds the total since the series started. - delta: Each data point holds the bytes of one interval. Prometheus-based backends refuse delta.

updatedAt string

When the export was last updated.

Otlp.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.

id string required

The export's ID.

availabilityZone string

Zone it lives in, such as us-west-2a. Defaults to the credentials' zone.