/** * Shared OTLP configuration for the dev-server CLI. * * This is the single source of truth for where the dev-server sends telemetry * and how it tags it. It is imported by three places that must agree: * - the early telemetry preload (`preload.mts`, full OTel SDK), * - the SDK telemetry init (`util.ts` / `index.ts`), * - the lightweight dev-server parent (`parent-otlp-metric.mts`), which hand- * rolls OTLP because it must stay small and cannot load the OTel SDK. * * Because the parent imports this, the module MUST depend only on `node:` * builtins and other import-free modules in this package (`attributes.ts`). Do * NOT import OpenTelemetry, dd-trace, or the `@superblocksteam/sdk` barrel * here — that would drag the SDK into the lightweight parent. * * Endpoint policy: the dev-server always exports through the Superblocks server's * OTLP proxy at `/api/v1/{traces,metrics,logs}`. The server forwards to * the LGTM collector locally and to the in-cluster collector when deployed, so * the client behaves identically in every environment — there is no * direct-to-collector path. */ /** Resource `service.name` for every dev-server telemetry signal. */ export declare const SERVICE_NAME = "sdk-dev-server"; /** * Base URL the dev-server exports OTLP to: `/api`. Callers append * `/v1/traces`, `/v1/metrics`, or `/v1/logs`. Returns undefined when the base URL * is missing or unparseable so callers can skip emission rather than crash. */ export declare function otlpBaseUrl(baseUrl: string | URL | undefined): string | undefined; /** * Full OTLP metrics endpoint derived from `SUPERBLOCKS_BASE_URL`. Used by the * lightweight parent's hand-rolled emitter. */ export declare function otlpMetricsUrl(env?: NodeJS.ProcessEnv): string | null; /** * Derives the `deployment.environment.name` resource attribute from * `SUPERBLOCKS_BASE_URL` so every dev-server signal carries the same environment * tag. Defaults to `"other"` when the host is unknown or unavailable. */ export declare function deploymentEnvironment(env?: NodeJS.ProcessEnv): string; export declare function warnIfCollectorUrlIgnored(env?: NodeJS.ProcessEnv): void; /** * Builds a minimal OTLP/HTTP `ExportMetricsServiceRequest` body for a single * monotonic DELTA counter increment (value 1). Timestamps are nanosecond * decimal strings built with BigInt so JS number precision can't corrupt them; * `startTimeUnixNano <= timeUnixNano` is required by the protocol. */ export declare function buildDeltaCounterPayload(opts: { name: string; description: string; attributes: Record; environment: string; serviceName?: string; scopeName?: string; nowMs?: number; }): unknown; /** * Fire-and-forget POST of a single counter increment as OTLP/HTTP JSON. * * Never throws and never rejects: any failure (no endpoint, DNS, timeout, * non-2xx) resolves quietly so telemetry cannot break or delay the parent's * supervision loop or shutdown. In production the request socket and timeout are * `unref`'d so a slow collector can't keep the parent alive; tests pass * `unref: false` and `await` to observe the request deterministically. */ export declare function emitOtlpCounter(opts: { name: string; description: string; attributes: Record; env?: NodeJS.ProcessEnv; timeoutMs?: number; unref?: boolean; }): Promise; //# sourceMappingURL=otlp-config.d.ts.map