///
///
import { CppWrapperSdkChildSpan, CppWrapperSdkSpan, HiResTime } from './binding';
import { DurabilityLevel } from './generaltypes';
import { ObservabilityInstruments } from './observabilitytypes';
import { AttributeValue, CppOpAttributeName, OpType, OpAttributeName, SpanStatus, ServiceName } from './observabilitytypes';
import { HttpOpAttributesOptions, KeyValueKeyspace } from './observabilityutilities';
import { RequestSpan, RequestTracer } from './tracing';
/**
* Returns true when both tracer and meter are NoOp, enabling the fast-path bypass in KV ops.
* @internal
*/
export declare function isNoopObservabilityInstruments(instruments: ObservabilityInstruments): boolean;
/**
* @internal
*/
export declare class ObservableRequestHandler {
private _opType;
private _requestHasEnded;
private readonly _observabilityInstruments;
private readonly _tracerImpl;
private readonly _meterImpl;
constructor(opType: OpType, observabilityInstruments: ObservabilityInstruments, parentSpan?: RequestSpan);
/**
* @internal
*/
get opType(): OpType;
/**
* Starts a handler for an operation nested in this one, whose span is a
* child of this handler's span.
*
* @internal
*/
child(opType: OpType): ObservableRequestHandler;
/**
* @internal
*/
get requestHasEnded(): boolean;
/**
* @internal
*/
get wrapperSpanName(): string;
/**
* @internal
*/
get wrappedSpan(): WrappedSpan | undefined;
/**
* @internal
*/
get clusterName(): string | undefined;
/**
* @internal
*/
get clusterUUID(): string | undefined;
/**
* Ends the request. A request is recorded once, so a call after the
* request has ended does nothing.
*
* @internal
*/
end(): void;
/**
* Ends the request with an error. As with end, a call after the request
* has ended does nothing.
*
* @internal
*/
endWithError(error?: any): void;
/**
* Runs fn, then ends the request, so that a failure in fn is recorded as
* an error rather than as a success.
*
* @internal
*/
endAfter(fn: () => T): T;
/**
* @internal
*/
maybeAddEncodingSpan(encodeFn: () => [Buffer, number]): [Buffer, number];
/**
* @internal
*/
maybeCreateEncodingSpan(encodeFn: () => [Buffer, number]): [Buffer, number];
/**
* @internal
*/
reset(opType: OpType, parentSpan?: RequestSpan, withError?: boolean): void;
/**
* @internal
*/
processCoreSpan(coreSpan?: CppWrapperSdkSpan): void;
/**
* Records how many times a request that retries outside the core, as a
* couchbase2 request does, has retried so far. The span reports the last
* count recorded when it ends.
*
* @internal
*/
recordRetries(count: number): void;
/**
* @internal
*/
setRequestHttpAttributes(options?: HttpOpAttributesOptions): void;
/**
* @internal
*/
setRequestKeyValueAttributes(keyspace: KeyValueKeyspace, durability?: DurabilityLevel): void;
}
/**
* @internal
*/
export declare class WrappedSpan implements RequestSpan {
private readonly _serviceName;
private readonly _opType;
private readonly _tracer;
private readonly _hasMultipleEncodingSpans;
readonly _requestSpan: RequestSpan;
private readonly _isRecording;
private _parentSpan;
private _endedEncodingSpans;
private _encodingSpan;
private _encodingSpans;
private _clusterName;
private _clusterUUID;
private _startTime;
private _endTimeWatermark;
constructor(serviceName: ServiceName, opType: OpType, tracer: RequestTracer, startTime: HiResTime, parentSpan?: RequestSpan | WrappedSpan);
/**
* @internal
*/
get clusterName(): string | undefined;
/**
* @internal
*/
get clusterUUID(): string | undefined;
/**
* @internal
*/
get name(): string;
/**
* @internal
*/
get requestSpan(): RequestSpan;
/**
* @internal
*/
isRecording(): boolean;
/**
* @internal
*/
maybeAddEncodingSpan(encodeFn: () => [Buffer, number]): [Buffer, number];
/**
* @internal
*/
maybeCreateEncodingSpan(encodeFn: () => [Buffer, number]): [Buffer, number];
/**
* @internal
*/
maybeUpdateEndTimeWatermark(endTime: HiResTime): void;
/**
* @internal
*/
_setAttributeOnAllSpans(attrName: OpAttributeName, attrValue: AttributeValue, skip_encoding_span?: boolean): void;
/**
* @internal
*/
_maybeSetAttributeFromCoreSpan(coreSpan: CppWrapperSdkSpan, attrName: CppOpAttributeName | OpAttributeName, skip_encoding_span?: boolean): void;
/**
* @internal
*/
_buildCoreSpans(coreSpans: CppWrapperSdkChildSpan[], parentSpan?: RequestSpan | WrappedSpan): void;
/**
* @internal
*/
_buildDispatchCoreSpan(coreSpan: CppWrapperSdkChildSpan, parentSpan?: RequestSpan | WrappedSpan): void;
/**
* @internal
*/
_buildNonDispatchCoreSpan(coreSpan: CppWrapperSdkChildSpan, parentSpan?: RequestSpan | WrappedSpan): void;
/**
* @internal
*/
_endEncodingSpans(): void;
/**
* @internal
*/
processCoreSpan(coreSpan: CppWrapperSdkSpan): void;
/**
* Starts a child span for one dispatch made outside the core, as each
* attempt of a couchbase2 request is. The threshold logging tracer counts
* it as a dispatch whatever its name.
*
* @internal
*/
startDispatchSpan(name: string): RequestSpan;
/**
* Ends a span from {@link startDispatchSpan}, marking it failed if the
* dispatch failed.
*
* @internal
*/
endDispatchSpan(span: RequestSpan, failed: boolean): void;
/**
* @internal
*/
setClusterLabels(clusterLabels: Record): void;
/**
* @internal
*/
setRetryAttribute(retrCount?: number): void;
/**
* @internal
*/
addEvent(): void;
/**
* @internal
*/
end(endTime: HiResTime): void;
/**
* @internal
*/
setAttribute(key: string, value: AttributeValue): void;
/**
* @internal
*/
setStatus(status: SpanStatus): void;
/**
* @internal
*/
_createRequestSpan(spanName: string, startTime: HiResTime, parentSpan?: RequestSpan): RequestSpan;
}