solarwinds-apm
Version:
OpenTelemetry-based SolarWinds APM library
57 lines • 2.4 kB
TypeScript
import { type Attributes, type Context, type DiagLogger, type Link, SpanKind } from "@opentelemetry/api";
import { type LocalSettings, OboeSampler, type RequestHeaders, type ResponseHeaders, type Settings } from "@solarwinds-apm/sampling";
import { type Configuration } from "../shared/config.js";
/**
* Returns whether a span represents an HTTP request, and if so
* some useful attributes of the request.
*
* @param kind - Span kind
* @param attributes - Span attributes
*/
export declare function httpSpanMetadata(kind: SpanKind, attributes: Attributes): {
readonly http: false;
readonly method?: undefined;
readonly status?: undefined;
readonly scheme?: undefined;
readonly hostname?: undefined;
readonly path?: undefined;
readonly url?: undefined;
} | {
readonly http: true;
readonly method: string;
readonly status: number;
readonly scheme: string;
readonly hostname: string;
readonly path: string;
readonly url: string;
};
/**
* Parses sampling settings from a raw JSON object
*
* @param unparsed - Raw JSON object
* @returns - Valid parsed settings object or undefined
*/
export declare function parseSettings(unparsed: unknown): (Settings & {
warning?: string;
}) | undefined;
/**
* Abstract core sampler to extend from other samplers
*
* This extends {@link OboeSampler} to retrieve local settings from
* the configuration and manage request headers retrieval and
* response headers setting. The only piece of logic left to implement
* by specific sampler is remote setting retrieval.
*/
export declare abstract class Sampler extends OboeSampler {
#private;
constructor(config: Configuration, logger: DiagLogger, initial?: Settings);
waitUntilReady(timeout: number): Promise<boolean>;
/** Computes local settings for the current configuration */
protected localSettings(_context: Context, _traceId: string, spanName: string, spanKind: SpanKind, attributes: Attributes, _links: Link[]): LocalSettings;
/** Retrieves request headers in the {@link HEADERS_STORAGE} */
protected requestHeaders(context: Context): RequestHeaders;
/** Sets response headers in the {@link HEADERS_STORAGE} */
protected setResponseHeaders(headers: ResponseHeaders, context: Context): void;
protected updateSettings(settings: unknown): Settings | undefined;
}
//# sourceMappingURL=sampler.d.ts.map