Skip to content

Commit eb33b33

Browse files
feat: add metrics and tracing support for image generation
This commit extends the observability infrastructure to support image generation operations. Changes include: - New image generation metrics implementation with OpenTelemetry integration - Image generation span and tracer implementations for distributed tracing - OpenInference schema support for image generation operations - Updated tracing API to include image generation tracer interface - Enhanced metrics constants to support image generation operations The implementation provides comprehensive observability for image generation requests including latency, success rates, and detailed tracing information following OpenInference standards. Signed-off-by: Hrushikesh Patil <[email protected]>
1 parent 47d6880 commit eb33b33

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

internal/tracing/api/api.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ func (NoopTracing) ImageGenerationTracer() ImageGenerationTracer {
6767
return NoopImageGenerationTracer{}
6868
}
6969

70-
// EmbeddingsTracer implements Tracing.EmbeddingsTracer.
71-
func (NoopTracing) EmbeddingsTracer() EmbeddingsTracer {
72-
return NoopEmbeddingsTracer{}
73-
}
74-
7570
// Shutdown implements Tracing.Shutdown.
7671
func (NoopTracing) Shutdown(context.Context) error {
7772
return nil
@@ -204,35 +199,6 @@ type ImageGenerationSpan interface {
204199
EndSpan()
205200
}
206201

207-
// EmbeddingsTracer creates spans for OpenAI embeddings requests.
208-
type EmbeddingsTracer interface {
209-
// StartSpanAndInjectHeaders starts a span and injects trace context into
210-
// the header mutation.
211-
//
212-
// Parameters:
213-
// - ctx: might include a parent span context.
214-
// - headers: Incoming HTTP headers used to extract parent trace context.
215-
// - headerMutation: The new Embeddings Span will have its context
216-
// written to these headers unless NoopTracing is used.
217-
// - req: The OpenAI embeddings request. Used to record request attributes.
218-
// - body: contains the original raw request body as a byte slice.
219-
//
220-
// Returns nil unless the span is sampled.
221-
StartSpanAndInjectHeaders(ctx context.Context, headers map[string]string, headerMutation *extprocv3.HeaderMutation, req *openai.EmbeddingRequest, body []byte) EmbeddingsSpan
222-
}
223-
224-
// EmbeddingsSpan represents an OpenAI embeddings request.
225-
type EmbeddingsSpan interface {
226-
// RecordResponse records the response attributes to the span.
227-
RecordResponse(resp *openai.EmbeddingResponse)
228-
229-
// EndSpanOnError finalizes and ends the span with an error status.
230-
EndSpanOnError(statusCode int, body []byte)
231-
232-
// EndSpan finalizes and ends the span.
233-
EndSpan()
234-
}
235-
236202
// ImageGenerationRecorder records attributes to a span according to a semantic
237203
// convention.
238204
type ImageGenerationRecorder interface {

0 commit comments

Comments
 (0)