import { Link, Span } from '@opentelemetry/api'; import { ad as Registry, ae as HasRegistry } from '../action-2eSGxHx0.js'; import { Instrumentation } from './instrumentation-api.js'; export { ATTR_PREFIX, GenkitLogRecord, GenkitSpanContext, InstrumentationNext, InstrumentationSpanInfo, LogRecordingInstrumentation, SPAN_TYPE_ATTR, disableOTelRootSpanDetection, spanMetadataAlsKey } from './instrumentation-api.js'; import { SpanMetadata } from './types.js'; export { DirectTelemetryInstrumentation } from './direct-instrumentation.js'; export { OTelInstrumentation } from './otel-instrumentation.js'; import 'json-schema'; import 'zod'; import '../context.js'; import '../statusTypes.js'; import 'dotprompt'; import 'ajv'; /** * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ interface RunInNewSpanOpts { metadata: SpanMetadata; labels?: Record; links?: Link[]; } type RunInNewSpanFn = (metadata: SpanMetadata, otSpan: Span) => Promise; /** * Replaces the implicit default (`OTelInstrumentation`) with the provided * instrumentation. `DirectTelemetryInstrumentation` is still prepended in dev * (when a telemetry server is configured), so a typical dev chain becomes * `[Direct, x]`. * * @hidden */ declare function configureInstrumentation(i: Instrumentation): void; /** * Clears configured/auto-injected instrumentation. Tests only. * * @hidden */ declare function resetInstrumentation(): void; /** * Resolves the active instrumentation chain for this call. * - base: `[configured]` if `configureInstrumentation` was called, else the * implicit `[OTelInstrumentation]` default. * - dev: `DirectTelemetryInstrumentation` is prepended when a telemetry server * is configured, so ids from Direct win and the Dev UI is fed without OTel. * * @hidden */ declare function activeInstrumentations(): Instrumentation[]; /** * Runs the provided function in a new span. * @deprecated * @hidden */ declare function runInNewSpan(registry: Registry | HasRegistry, opts: RunInNewSpanOpts, fn: RunInNewSpanFn): Promise; /** * Runs the provided function in a new span. * @hidden */ declare function runInNewSpan(opts: RunInNewSpanOpts, fn: RunInNewSpanFn): Promise; /** * Creates a new child span and attaches it to a previously created trace. This * is useful, for example, for adding deferred user engagement metadata. * * @hidden */ declare function appendSpan(traceId: string, parentSpanId: string, metadata: SpanMetadata, labels?: Record): Promise; /** * Sets provided attribute value in the current span. * * @hidden */ declare function setCustomMetadataAttribute(key: string, value: string): void; /** * Sets provided attribute values in the current span. * * @hidden */ declare function setCustomMetadataAttributes(values: Record): void; /** * Converts a fully annotated path to a friendly display version for logs * * @hidden */ declare function toDisplayPath(path: string): string; export { Instrumentation, activeInstrumentations, appendSpan, configureInstrumentation, resetInstrumentation, runInNewSpan, setCustomMetadataAttribute, setCustomMetadataAttributes, toDisplayPath };