InstrumentedImageGenerationClient
org.llm4s.imagegeneration.InstrumentedImageGenerationClient
class InstrumentedImageGenerationClient(delegate: ImageGenerationClient, config: ImageGenerationConfig, metrics: MetricsCollector, tracing: Tracing) extends ImageGenerationClient
Decorator that wraps an ImageGenerationClient with metrics collection and trace event emission.
Records:
observeImageGenerationfor every generate/edit call (success or failure)recordImageGenerationCostwhen pricing is available via ImagePricingRegistryTraceEvent.ImageGenerationCompletedfor observability
Note: Cost estimation uses the requested size, not the actual provider-billed dimensions. For models like dall-e-3 that normalize sizes (e.g., mapping non-standard requested sizes to their nearest supported size), the estimate may differ from actual billing. When size is unknown (e.g., edit operations without an explicit size), cost estimation is skipped.
Value parameters
- config
-
Image generation configuration (provides model/provider info)
- delegate
-
The underlying client to delegate actual generation to
- metrics
-
Metrics collector for Prometheus counters/histograms
- tracing
-
Tracing backend for structured event emission
Attributes
- Graph
-
- Supertypes
Members list
In this article