/**
 * @fileoverview Performance measurement for tool, resource, and prompt execution.
 * Wraps handler logic with OpenTelemetry spans, metric counters/histograms,
 * payload size capture, and structured logs. All three handler types get
 * symmetric instrumentation so dashboards and traces cover the full MCP surface.
 * @module src/utils/internal/performance
 */
import type { RequestContext } from '../../utils/internal/requestContext.js';
/** Eagerly creates tool, resource, and prompt metric instruments so series exist from startup. */
export declare function initHandlerMetrics(): void;
/**
 * @deprecated No longer needed. `globalThis.performance.now` is universally
 * available on Node ≥24 and Bun ≥1.3. Kept as a no-op export to avoid a
 * breaking change for consumers that call it during startup.
 */
export declare function loadPerfHooks(): Promise<{
    performance: {
        now: () => number;
    };
}>;
/**
 * @deprecated No longer needed. `nowMs` now delegates directly to
 * `globalThis.performance.now()`, which is universally available on Node ≥24
 * and Bun ≥1.3. This function is a no-op and will be removed in a future
 * major release.
 *
 * @returns A promise that resolves immediately.
 */
export declare function initHighResTimer(_perfLoader?: typeof loadPerfHooks): Promise<void>;
/**
 * Returns the current time in milliseconds using `globalThis.performance.now()`.
 *
 * Sub-millisecond resolution is guaranteed on all supported engine floors
 * (Node ≥24, Bun ≥1.3, Cloudflare Workers). The returned value is suitable for
 * computing durations but its epoch origin is implementation-defined — do not
 * treat it as a wall-clock timestamp.
 *
 * @returns Current time in milliseconds.
 */
export declare const nowMs: () => number;
/**
 * Wraps a tool's logic function with observability: an OpenTelemetry span,
 * OTel metric counters/histogram, payload size capture, and structured log.
 *
 * The caller supplies the raw tool logic as `toolLogicFn`; this function handles
 * all instrumentation so tool handlers stay free of telemetry boilerplate.
 *
 * On success the resolved value is passed through transparently.
 * On failure the error is re-thrown after being recorded on the span and metrics;
 * `McpError` instances surface their numeric `code` as the error code attribute.
 *
 * @template T - The resolved type of the tool's return value.
 * @param toolLogicFn - Zero-argument async function containing the tool's business logic.
 * @param context - Request context extended with `toolName`; used for span/log correlation.
 * @param inputPayload - The raw input object passed to the tool, serialized to compute byte size.
 * @param successAttributes - Optional thunk evaluated after a successful run; its
 *   returned key/value map is set on the span as extra attributes. Lets callers
 *   attach post-hoc signals (e.g. `mcp.tool.enriched`) without coupling this
 *   function to their domain. Not called on the error path.
 * @returns A promise that resolves with the tool's return value or rejects with the original error.
 */
export declare function measureToolExecution<T>(toolLogicFn: () => Promise<T>, context: RequestContext & {
    toolName: string;
}, inputPayload: unknown, successAttributes?: () => Record<string, boolean | number | string>): Promise<T>;
/**
 * Wraps a resource handler with observability: OTel span, metric counters/histogram,
 * and a structured log. Mirrors {@link measureToolExecution} but tuned for resource reads.
 *
 * @template T - The resolved type of the resource handler's return value.
 * @param resourceLogicFn - Zero-argument async function containing the resource handler.
 * @param context - Request context extended with `resourceName`; used for span/log correlation.
 * @param meta - Resource metadata: URI and MIME type for span attributes.
 * @returns A promise that resolves with the handler's return value or rejects with the original error.
 */
export declare function measureResourceExecution<T>(resourceLogicFn: () => Promise<T>, context: RequestContext & {
    resourceName: string;
}, meta: {
    uri: string;
    mimeType: string;
}): Promise<T>;
/**
 * Wraps a prompt generate function with observability: an OpenTelemetry span,
 * OTel metric counters/histograms, payload size capture, and structured log.
 *
 * Prompts can now perform meaningful work (conditional logic, async data fetches,
 * multi-message assembly), so they get the same instrumentation depth as tools
 * and resources. Kept symmetric to {@link measureToolExecution} and
 * {@link measureResourceExecution}.
 *
 * @template T - The resolved type of the prompt generate function's return value.
 * @param promptLogicFn - Zero-argument async function containing the prompt's generate logic.
 * @param context - Request context extended with `promptName`; used for span/log correlation.
 * @param inputPayload - The validated args object passed to the prompt, serialized to compute byte size.
 * @returns A promise that resolves with the generate result or rejects with the original error.
 */
export declare function measurePromptGeneration<T>(promptLogicFn: () => Promise<T>, context: RequestContext & {
    promptName: string;
}, inputPayload: unknown): Promise<T>;
//# sourceMappingURL=performance.d.ts.map