@genkit-ai/core
Version:
Genkit AI framework core libraries.
46 lines (42 loc) • 1.53 kB
text/typescript
import { Context } from '@opentelemetry/api';
import { SpanProcessor, SpanExporter, Span, ReadableSpan } from '@opentelemetry/sdk-trace-base';
/**
* 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.
*/
/**
* RealtimeSpanProcessor exports spans both when they start and when they end.
* This enables real-time trace visualization in development.
*/
declare class RealtimeSpanProcessor implements SpanProcessor {
private readonly exporter;
constructor(exporter: SpanExporter);
/**
* Called when a span is started. Exports immediately for real-time updates.
*/
onStart(span: Span, _parentContext: Context): void;
/**
* Called when a span ends. Exports again with complete data.
*/
onEnd(span: ReadableSpan): void;
/**
* Forces the exporter to flush any buffered spans.
*/
forceFlush(): Promise<void>;
/**
* Shuts down the processor and exporter.
*/
shutdown(): Promise<void>;
}
export { RealtimeSpanProcessor };