@fiberplane/hono-otel
Version:
Hono middleware to forward OpenTelemetry traces to a local instance of @fiberplane/studio
30 lines (29 loc) • 1.39 kB
TypeScript
import type { FpHonoEnv } from "../utils/index.js";
import type { FpConfig, FpConfigOptions, FpMode } from "./types.js";
export type FpResolvedConfig = {
enabled: boolean;
mode: FpMode;
redactedHeaders: Set<string>;
redactedQueryParams: Set<string>;
otelEndpoint: string | null;
otelToken: string | null;
logLevel: string | null;
serviceName: string;
libraryDebugMode: boolean;
monitor: {
fetch: boolean;
logging: boolean;
cfBindings: boolean;
};
};
/**
* OpenTelemetry advises that instrumentations should require explicit configuration of which headers to capture.
*
* We want to minimize configuration, so instead, we've chosen to ignore the following headers by default.
*
* In practice, the library only redacts their values when running in "production" mode.
*/
export declare const DEFAULT_REDACTED_HEADERS: readonly ["authorization", "cookie", "set-cookie", "x-api-key", "x-amz-security-token", "x-real-ip", "x-forwarded-for", "proxy-authorization", "www-authenticate", "proxy-authenticate", "x-real-ip", "x-auth-token", "x-csrf-token", "x-session-id", "neon-connection-string"];
export declare const DEFAULT_REDACTED_QUERY_PARAMS: string[];
export declare const DEFAULT_CONFIG: FpConfig;
export declare function resolveConfig(userConfig: FpConfigOptions | undefined, env: FpHonoEnv): FpResolvedConfig;