@vtex/diagnostics-nodejs
Version:
Diagnostics library for Node.js applications
163 lines • 5.1 kB
TypeScript
import { SamplingConfig } from './sampling';
export interface DiagnosticsConfig {
instrumentation?: InstrumentationConfig;
traces?: TracesConfig;
metrics?: MetricsConfig;
logs?: LogsConfig;
discovery?: DiscoveryConfig;
processors?: ProcessorsConfig;
globalResourceAttributes?: Record<string, string | number | boolean>;
globalHeaders?: Record<string, string>;
customAttributes?: Record<string, string>;
envAttributeMapping?: Record<string, string>;
}
export interface InstrumentationConfig {
http?: HttpInstrumentationConfig;
aspNetCore?: AspNetCoreInstrumentationConfig;
httpClient?: HttpClientInstrumentationConfig;
}
export interface HttpInstrumentationConfig {
captureHeaders?: boolean;
recordException?: boolean;
}
export interface AspNetCoreInstrumentationConfig {
}
export interface HttpClientInstrumentationConfig {
}
export interface TracesConfig {
endpoint?: string;
headers?: Record<string, string>;
resourceAttributes?: Record<string, string>;
exporters?: ExportersConfig;
httpClient?: HttpClientConfig;
sampling?: SamplingConfig;
enableHttpInstrumentation?: boolean;
spanProcessors?: SpanProcessorConfig[];
enableActivityCreation?: boolean;
recordException?: boolean;
batchTimeoutMs?: number;
maxBatchSize?: number;
maxQueueSize?: number;
}
export interface LogsConfig {
endpoint?: string;
logLevel?: string;
headers?: Record<string, string>;
resourceAttributes?: Record<string, string>;
exporters?: ExportersConfig;
httpClient?: HttpClientConfig;
includeScopes?: boolean;
includeFormattedMessage?: boolean;
parseStateValues?: boolean;
maxLogAttributeCount?: number;
maxLogAttributeValueLength?: number;
logProcessors?: LogProcessorConfig[];
enableConsoleFormatter?: boolean;
batchTimeoutMs?: number;
maxBatchSize?: number;
maxQueueSize?: number;
}
export interface MetricsConfig {
endpoint?: string;
exportIntervalMs?: number;
headers?: Record<string, string>;
resourceAttributes?: Record<string, string>;
exporters?: ExportersConfig;
httpClient?: HttpClientConfig;
maxMetricsPoints?: number;
maxMetricsStreams?: number;
cardinalityLimit?: number;
temporality?: string;
aggregationTemporality?: Record<string, string>;
views?: any[];
readerType?: string;
instrumentationScope?: boolean;
enableExemplars?: boolean;
deltaAggregationTemporalitySelector?: Record<string, boolean>;
maxHistogramBuckets?: number;
maxMetricAttributes?: number;
maxMetricAttributeValueLength?: number;
batchTimeoutMs?: number;
maxBatchSize?: number;
maxQueueSize?: number;
}
export interface DiscoveryConfig {
envVariableMappings?: EnvVariableMapping[];
environment?: string;
region?: string;
resourceEnvMappings?: ResourceEnvMapping[];
envPrefix?: string;
disableEnvPrefixDetection?: boolean;
disableEnvMappingsFromEnv?: boolean;
additionalResourceAttributes?: Record<string, string | number | boolean>;
}
export interface ProcessorsConfig {
vtexAttributes?: VtexAttributesProcessorConfig;
}
export interface VtexAttributesProcessorConfig {
}
export interface ExportersConfig {
mode?: 'otlp' | 'console' | 'none';
otlp?: OtlpExporterConfig;
console?: ConsoleExporterConfig;
}
export interface OtlpExporterConfig {
enabled?: boolean;
endpoint: string;
headers?: Record<string, string>;
timeoutMs?: number;
batchTimeout?: number;
maxBatchSize?: number;
maxQueueSize?: number;
}
export interface ConsoleExporterConfig {
}
export interface HttpClientConfig {
timeoutMs?: number;
pooledConnectionLifetimeMs?: number;
connectionIdleTimeoutMs?: number;
maxConnectionsPerServer?: number;
dnsRefreshTimeoutMs?: number;
enableKeepAlive?: boolean;
keepAliveIntervalMs?: number;
allowInsecureConnections?: boolean;
}
export interface SpanProcessorConfig {
type?: 'Simple' | 'Batch';
sendBatchSize?: number;
scheduleDelayMilliseconds?: number;
maxQueueSize?: number;
}
export interface MetricViewConfig {
instrumentName: string;
meterName?: string;
name?: string;
description?: string;
aggregation?: 'Default' | 'Sum' | 'Histogram' | 'LastValue' | 'ExplicitBucketHistogram';
histogramBoundaries?: number[];
tagKeys?: string[];
}
export interface LogProcessorConfig {
type?: 'Simple' | 'Batch';
sendBatchSize?: number;
scheduleDelayMilliseconds?: number;
maxQueueSize?: number;
}
export interface EnvVariableMapping {
envVar: string;
attributeName: string;
defaultValue?: string;
}
export interface ResourceEnvMapping {
envVar: string;
attributeName: string;
defaultValue?: string;
}
export interface ConfigProvider {
load(): Promise<DiagnosticsConfig | undefined>;
}
export interface ConfigProviderWithReload extends ConfigProvider {
onChange(callback: (config: DiagnosticsConfig) => void): void;
dispose(): void;
}
//# sourceMappingURL=config.d.ts.map