UNPKG

autotel

Version:
81 lines (80 loc) 2.41 kB
import { f as SamplingPreset } from "./sampling-DfYhDJij.cjs"; import { n as OtlpSignal, t as AutotelConfig } from "./init-DSrRmVnz.cjs"; //#region src/yaml-config.d.ts /** * YAML config structure * Maps to AutotelConfig with user-friendly naming */ interface YamlConfig { service?: { name?: string; version?: string; environment?: string; }; exporter?: { endpoint?: string; protocol?: 'http' | 'grpc'; headers?: Record<string, string>; destinations?: Array<{ endpoint: string; protocol?: 'http' | 'grpc'; headers?: Record<string, string>; signals?: OtlpSignal[]; }>; }; resource?: Record<string, string | number | boolean>; sampling?: { preset?: SamplingPreset; type?: 'adaptive' | 'always_on' | 'always_off' | 'ratio'; ratio?: number; baseline_rate?: number; always_sample_errors?: boolean; always_sample_slow?: boolean; slow_threshold_ms?: number; }; autoInstrumentations?: string[] | Record<string, { enabled?: boolean; }>; debug?: boolean; } /** * Load and parse YAML config file (auto-discovery) * * Automatically finds and loads autotel.yaml or uses AUTOTEL_CONFIG_FILE. * Returns null if no config file found (not an error - YAML config is optional). * * @returns Partial AutotelConfig or null if no config file found * * @example * const yamlConfig = loadYamlConfig(); * if (yamlConfig) { * init({ ...yamlConfig, debug: true }); * } */ declare function loadYamlConfig(): Partial<AutotelConfig> | null; /** * Load YAML config from a specific file path * * Unlike loadYamlConfig(), this throws if the file cannot be read. * * @param filePath - Path to YAML config file * @returns Partial AutotelConfig * @throws Error if file cannot be read or parsed * * @example * import { loadYamlConfigFromFile } from 'autotel/yaml'; * import { init } from 'autotel'; * * const config = loadYamlConfigFromFile('./config/otel.yaml'); * init({ ...config, debug: true }); */ declare function loadYamlConfigFromFile(filePath: string): Partial<AutotelConfig>; /** * Check if a YAML config file exists (without loading it) * * @returns true if a config file would be found by loadYamlConfig() */ declare function hasYamlConfig(): boolean; //#endregion export { YamlConfig, hasYamlConfig, loadYamlConfig, loadYamlConfigFromFile }; //# sourceMappingURL=yaml-config.d.cts.map