UNPKG

@splunk/otel

Version:

The Splunk distribution of OpenTelemetry Node Instrumentation provides a Node agent that automatically instruments your Node application to capture and report distributed traces to Splunk APM.

65 lines 3.9 kB
import { Attributes, SpanStatusCode, Span, DiagLogger } from '@opentelemetry/api'; import { ClientRequest, IncomingHttpHeaders, IncomingMessage, OutgoingHttpHeaders, ServerResponse } from 'http'; import { Err, SemconvStability } from './internal-types'; /** * Get an absolute url */ export declare function getAbsoluteUrl(req: ClientRequest): string; /** * Parse status code from HTTP response. [More details](https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/data-http.md#status) */ export declare function parseResponseStatus(upperBound: number, statusCode?: number): SpanStatusCode; /** * Sets the span with the error passed in params * @param {Span} span the span that need to be set * @param {Error} error error that will be set to span * @param {SemconvStability} semconvStability determines which semconv version to use */ export declare const setSpanWithError: (span: Span, error: Err, semconvStability: SemconvStability) => void; /** * Adds attributes for request content-length and content-encoding HTTP headers * @param { IncomingMessage } Request object whose headers will be analyzed * @param { Attributes } Attributes object to be modified */ export declare const setRequestContentLengthAttribute: (request: IncomingMessage, attributes: Attributes) => void; export declare const isCompressed: (headers: OutgoingHttpHeaders | IncomingHttpHeaders) => boolean; /** * Returns attributes related to the kind of HTTP protocol used * @param {string} [kind] Kind of HTTP protocol used: "1.0", "1.1", "2", "SPDY" or "QUIC". */ export declare const setAttributesFromHttpKind: (kind: string | undefined, attributes: Attributes) => void; /** * Returns outgoing request attributes scoped to the response data * @param {IncomingMessage} response the response object * @param {SemconvStability} semconvStability determines which semconv version to use */ export declare const getOutgoingRequestAttributesOnResponse: (request: ClientRequest, response: IncomingMessage, semconvStability: SemconvStability) => Attributes; export declare function getOutgoingRequestAttributes(request: ClientRequest, semconvStability: SemconvStability): Attributes; /** * Get server.address and port according to http semconv 1.27 * https://github.com/open-telemetry/semantic-conventions/blob/bf0a2c1134f206f034408b201dbec37960ed60ec/docs/http/http-spans.md#setting-serveraddress-and-serverport-attributes */ export declare function getRemoteClientAddress(request: IncomingMessage): string | null; /** * Returns incoming request attributes scoped to the request data * @param {IncomingMessage} request the request object * @param {{ component: string, serverName?: string, hookAttributes?: Attributes }} options used to pass data needed to create attributes * @param {SemconvStability} semconvStability determines which semconv version to use */ export declare const getIncomingRequestAttributes: (request: IncomingMessage, options: { serverName?: string; hookAttributes?: Attributes; semconvStability: SemconvStability; }, logger: DiagLogger) => Attributes; /** * Returns incoming request attributes scoped to the response data * @param {(ServerResponse & { socket: Socket; })} response the response object */ export declare const getIncomingRequestAttributesOnResponse: (request: IncomingMessage, response: ServerResponse, semconvStability: SemconvStability) => Attributes; /** * Returns incoming request Metric attributes scoped to the request data * @param {Attributes} spanAttributes the span attributes */ export declare const getIncomingStableRequestMetricAttributesOnResponse: (spanAttributes: Attributes) => Attributes; export declare function headerCapture(type: 'request' | 'response', headers: string[]): (span: Span, getHeader: (key: string) => undefined | string | string[] | number) => void; //# sourceMappingURL=utils.d.ts.map