/** * Get the default tracer for UNRDF operations * @returns {import('@opentelemetry/api').Tracer} OTEL tracer instance */ export function getTracer(): import("@opentelemetry/api").Tracer; /** * @typedef {Object} SpanOptions * @property {Record} [attributes] - Initial span attributes * @property {import('@opentelemetry/api').SpanKind} [kind] - Span kind (internal, server, client, etc.) */ /** * Create a new span with the given name and attributes * @param {string} name - Span name (e.g., 'query.sparql', 'rpc.call') * @param {Record} [attributes={}] - Initial attributes * @returns {import('@opentelemetry/api').Span} Created span */ export function createSpan(name: string, attributes?: Record): import("@opentelemetry/api").Span; /** * Execute a function within a span context * Automatically handles span lifecycle, timing, and error recording * * @template T * @param {string} name - Span name * @param {() => T | Promise} fn - Function to execute * @param {Record} [attrs={}] - Span attributes * @returns {Promise} Function result * @throws {Error} Rethrows any error from fn after recording to span */ export function withSpan(name: string, fn: () => T | Promise, attrs?: Record): Promise; /** * Record a custom attribute on a span * @param {import('@opentelemetry/api').Span} span - Target span * @param {string} key - Attribute key * @param {string|number|boolean} value - Attribute value * @returns {void} */ export function recordAttribute(span: import("@opentelemetry/api").Span, key: string, value: string | number | boolean): void; /** * Record multiple attributes on a span * @param {import('@opentelemetry/api').Span} span - Target span * @param {Record} attributes - Attributes to record * @returns {void} */ export function recordAttributes(span: import("@opentelemetry/api").Span, attributes: Record): void; /** * Record an error on a span * Sets span status to ERROR and records exception details * * @param {import('@opentelemetry/api').Span} span - Target span * @param {Error} error - Error to record * @returns {void} */ export function recordError(span: import("@opentelemetry/api").Span, error: Error): void; /** * Record a metric value on a span * Useful for tracking counts, sizes, and durations * * @param {import('@opentelemetry/api').Span} span - Target span * @param {string} name - Metric name (e.g., 'result.count', 'duration.ms') * @param {number} value - Metric value * @returns {void} */ export function recordMetric(span: import("@opentelemetry/api").Span, name: string, value: number): void; /** * Trace a triple pattern match operation * @template T * @param {string|null} subject - Subject pattern * @param {string|null} predicate - Predicate pattern * @param {string|null} object - Object pattern * @param {() => T | Promise} fn - Function to execute * @returns {Promise} Function result */ export function traceTriplePattern(subject: string | null, predicate: string | null, object: string | null, fn: () => T | Promise): Promise; /** * Trace a SPARQL query execution * @template T * @param {string} query - SPARQL query string * @param {() => T | Promise} fn - Function to execute * @returns {Promise} Function result */ export function traceSPARQLQuery(query: string, fn: () => T | Promise): Promise; /** * Trace an RPC call to a remote target * @template T * @param {string} target - RPC target address * @param {string} module - Module name * @param {() => T | Promise} fn - Function to execute * @returns {Promise} Function result */ export function traceRPCCall(target: string, module: string, fn: () => T | Promise): Promise; /** * Trace a message validation operation * @template T * @param {() => T | Promise} fn - Function to execute * @returns {Promise} Function result */ export function traceMessageValidation(fn: () => T | Promise): Promise; /** * Trace a cache operation (hit or miss) * @template T * @param {string} cacheKey - Cache key * @param {boolean} isHit - Whether cache hit * @param {() => T | Promise} fn - Function to execute * @returns {Promise} Function result */ export function traceCacheOperation(cacheKey: string, isHit: boolean, fn: () => T | Promise): Promise; /** * Trace a batch operation (e.g., bulk triple insert) * @template T * @param {string} operationType - Type of batch operation * @param {number} batchSize - Number of items in batch * @param {() => T | Promise} fn - Function to execute * @returns {Promise} Function result */ export function traceBatchOperation(operationType: string, batchSize: number, fn: () => T | Promise): Promise; /** * Trace a performance-sensitive operation with timing * @template T * @param {string} operationName - Operation name * @param {() => T | Promise} fn - Function to execute * @returns {Promise<{result: T, duration: number}>} Result with duration */ export function traceWithTiming(operationName: string, fn: () => T | Promise): Promise<{ result: T; duration: number; }>; /** * Get the current active span from context * @returns {import('@opentelemetry/api').Span|undefined} Active span or undefined */ export function getActiveSpan(): import("@opentelemetry/api").Span | undefined; /** * Check if tracing is enabled * @returns {boolean} True if tracing is available */ export function isTracingEnabled(): boolean; /** * Create a child span under the current active span * @param {string} name - Child span name * @param {Record} [attributes={}] - Span attributes * @returns {import('@opentelemetry/api').Span} Child span */ export function createChildSpan(name: string, attributes?: Record): import("@opentelemetry/api").Span; /** * Service name for OTEL tracer * @constant {string} */ export const SERVICE_NAME: "unrdf"; /** * Default tracer version * @constant {string} */ export const TRACER_VERSION: "[VERSION]"; export namespace tracer { /** * Get the underlying tracer * @returns {import('@opentelemetry/api').Tracer} */ function get(): import("@opentelemetry/api").Tracer; } declare namespace _default { export { getTracer }; export { tracer }; export { createSpan }; export { withSpan }; export { recordAttribute }; export { recordAttributes }; export { recordError }; export { recordMetric }; export { traceTriplePattern }; export { traceSPARQLQuery }; export { traceRPCCall }; export { traceMessageValidation }; export { traceCacheOperation }; export { traceBatchOperation }; export { traceWithTiming }; export { getActiveSpan }; export { isTracingEnabled }; export { createChildSpan }; export { SpanStatusCode }; export { SERVICE_NAME }; export { TRACER_VERSION }; } export default _default; export type SpanOptions = { /** * - Initial span attributes */ attributes?: Record; /** * - Span kind (internal, server, client, etc.) */ kind?: import("@opentelemetry/api").SpanKind; }; import { SpanStatusCode } from '@opentelemetry/api';