solarwinds-apm
Version:
OpenTelemetry-based SolarWinds APM library
129 lines • 8.02 kB
TypeScript
import { DiagLogLevel } from "@opentelemetry/api";
import { type ReadableSpan } from "@opentelemetry/sdk-trace-base";
import * as v from "valibot";
/** Processed configuration shared by web and Node.js */
export interface Configuration {
enabled: boolean;
service: string;
token?: string;
collector: URL;
headers: Record<string, string>;
otlp: {
traces: string;
metrics: string;
logs: string;
};
logLevel: DiagLogLevel;
tracingMode?: boolean;
triggerTraceEnabled: boolean;
exportLogsEnabled: boolean;
transactionName?: (span: ReadableSpan) => string | undefined;
transactionSettings?: {
tracing: boolean;
matcher: (ident: string) => boolean;
}[];
}
export declare const schemas: {
readonly boolean: v.UnionSchema<[v.BooleanSchema<undefined>, v.SchemaWithPipe<readonly [v.PicklistSchema<["true", "false", "1", "0"], undefined>, v.TransformAction<"0" | "1" | "true" | "false", boolean>]>], undefined>;
readonly logLevel: v.SchemaWithPipe<readonly [v.PicklistSchema<["all", "verbose", "debug", "info", "warn", "error", "none"], undefined>, v.TransformAction<"all" | "verbose" | "debug" | "info" | "warn" | "error" | "none", DiagLogLevel>]>;
readonly regex: v.UnionSchema<[v.InstanceSchema<RegExpConstructor, undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RawTransformAction<string, RegExp>]>], undefined>;
readonly serviceKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, {
token: string | undefined;
name: string;
}>]>;
readonly tracingMode: v.SchemaWithPipe<readonly [v.PicklistSchema<["enabled", "disabled"], undefined>, v.TransformAction<"enabled" | "disabled", boolean>]>;
readonly url: v.UnionSchema<[v.InstanceSchema<{
new (url: string | URL, base?: string | URL): URL;
prototype: URL;
canParse(url: string | URL, base?: string | URL): boolean;
createObjectURL(obj: Blob | MediaSource): string;
parse(url: string | URL, base?: string | URL): URL | null;
revokeObjectURL(url: string): void;
}, undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RawTransformAction<string, URL>]>], undefined>;
};
export interface Defaults {
serviceKey?: string;
triggerTraceEnabled: boolean;
}
export declare const schema: (defaults: Defaults) => v.SchemaWithPipe<readonly [v.ObjectSchema<{
readonly enabled: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.SchemaWithPipe<readonly [v.PicklistSchema<["true", "false", "1", "0"], undefined>, v.TransformAction<"0" | "1" | "true" | "false", boolean>]>], undefined>, true>;
readonly serviceKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, {
token: string | undefined;
name: string;
}>]> | v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>, v.TransformAction<string, {
token: string | undefined;
name: string;
}>]>, string>;
readonly collector: v.OptionalSchema<v.UnionSchema<[v.InstanceSchema<{
new (url: string | URL, base?: string | URL): URL;
prototype: URL;
canParse(url: string | URL, base?: string | URL): boolean;
createObjectURL(obj: Blob | MediaSource): string;
parse(url: string | URL, base?: string | URL): URL | null;
revokeObjectURL(url: string): void;
}, undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RawTransformAction<string, URL>]>], undefined>, "apm.collector.na-01.cloud.solarwinds.com">;
readonly logLevel: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["all", "verbose", "debug", "info", "warn", "error", "none"], undefined>, v.TransformAction<"all" | "verbose" | "debug" | "info" | "warn" | "error" | "none", DiagLogLevel>]>, "warn">;
readonly tracingMode: v.OptionalSchema<v.SchemaWithPipe<readonly [v.PicklistSchema<["enabled", "disabled"], undefined>, v.TransformAction<"enabled" | "disabled", boolean>]>, undefined>;
readonly triggerTraceEnabled: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.SchemaWithPipe<readonly [v.PicklistSchema<["true", "false", "1", "0"], undefined>, v.TransformAction<"0" | "1" | "true" | "false", boolean>]>], undefined>, boolean>;
readonly exportLogsEnabled: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.SchemaWithPipe<readonly [v.PicklistSchema<["true", "false", "1", "0"], undefined>, v.TransformAction<"0" | "1" | "true" | "false", boolean>]>], undefined>, false>;
readonly transactionName: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, () => string>]>, v.SchemaWithPipe<readonly [v.CustomSchema<(span: ReadableSpan) => string | undefined, undefined>, v.TransformAction<(span: ReadableSpan) => string | undefined, (span: ReadableSpan) => string | undefined>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
readonly scheme: v.LiteralSchema<"spanAttribute", undefined>;
readonly delimiter: v.StringSchema<undefined>;
readonly attributes: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
}, undefined>, undefined>, v.TransformAction<{
scheme: "spanAttribute";
delimiter: string;
attributes: string[];
}[], (span: ReadableSpan) => string | undefined>]>], undefined>, undefined>;
readonly transactionSettings: v.OptionalSchema<v.ArraySchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.ObjectSchema<{
readonly tracing: v.SchemaWithPipe<readonly [v.PicklistSchema<["enabled", "disabled"], undefined>, v.TransformAction<"enabled" | "disabled", boolean>]>;
readonly regex: v.UnionSchema<[v.InstanceSchema<RegExpConstructor, undefined>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RawTransformAction<string, RegExp>]>], undefined>;
}, undefined>, v.TransformAction<{
tracing: boolean;
regex: RegExp;
}, {
tracing: boolean;
matcher: (ident: string) => boolean;
}>]>, v.SchemaWithPipe<readonly [v.ObjectSchema<{
readonly tracing: v.SchemaWithPipe<readonly [v.PicklistSchema<["enabled", "disabled"], undefined>, v.TransformAction<"enabled" | "disabled", boolean>]>;
readonly matcher: v.CustomSchema<(ident: string) => boolean, undefined>;
}, undefined>, v.TransformAction<{
tracing: boolean;
matcher: (ident: string) => boolean;
}, {
tracing: boolean;
matcher: (ident: string) => boolean;
}>]>], undefined>, undefined>, undefined>;
}, undefined>, v.TransformAction<{
enabled: boolean;
serviceKey: {
token: string | undefined;
name: string;
};
collector: URL;
logLevel: DiagLogLevel;
tracingMode?: boolean | undefined;
triggerTraceEnabled: boolean;
exportLogsEnabled: boolean;
transactionName?: (() => string) | ((span: ReadableSpan) => string | undefined) | ((span: ReadableSpan) => string | undefined) | undefined;
transactionSettings?: ({
tracing: boolean;
matcher: (ident: string) => boolean;
} | {
tracing: boolean;
matcher: (ident: string) => boolean;
})[] | undefined;
}, Configuration>]>;
export declare const env: {
PREFIX: string;
/**
* Returns a config object from an environment object by filtering the keys
* by prefix then stripping it and renaming them to camelCase
*/
object(object: Record<string, unknown>, prefix?: string): Record<string, unknown>;
/** Converts an environment variable name to a config key */
fromKey(k: string, prefix?: string): string;
/** Converts a config key to an environment variable name */
toKey(k: string, prefix?: string): string;
};
//# sourceMappingURL=config.d.ts.map