Documentation
¶
Overview ¶
Package prometheus provides Prometheus metrics exporters for PromptKit pipelines.
Package prometheus provides Prometheus metrics exporters for PromptKit pipelines.
Package prometheus provides Prometheus metrics exporters for PromptKit pipelines.
Index ¶
- func RecordPipelineEnd(status string, durationSeconds float64)
- func RecordPipelineStart()
- func RecordProviderCost(provider, model string, cost float64)
- func RecordProviderRequest(provider, model, status string, durationSeconds float64)
- func RecordProviderTokens(provider, model string, inputTokens, outputTokens, cachedTokens int)
- func RecordStageDuration(stageName, stageType string, durationSeconds float64)
- func RecordStageElement(stageName, status string)
- func RecordToolCall(toolName, status string, durationSeconds float64)
- func RecordValidation(validator, validatorType, status string, durationSeconds float64)
- type Exporter
- type MetricsListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RecordPipelineEnd ¶
RecordPipelineEnd records a pipeline completion.
func RecordProviderCost ¶
RecordProviderCost records cost from a provider call.
func RecordProviderRequest ¶
RecordProviderRequest records a provider API call.
func RecordProviderTokens ¶
RecordProviderTokens records token consumption.
func RecordStageDuration ¶
RecordStageDuration records the duration of a stage.
func RecordStageElement ¶
func RecordStageElement(stageName, status string)
RecordStageElement records a processed element.
func RecordToolCall ¶
RecordToolCall records a tool call.
func RecordValidation ¶
RecordValidation records a validation check.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter serves Prometheus metrics over HTTP.
func NewExporter ¶
NewExporter creates a new Prometheus exporter that serves metrics at the given address.
func NewExporterWithRegistry ¶
func NewExporterWithRegistry(addr string, registry *prometheus.Registry) *Exporter
NewExporterWithRegistry creates a new Prometheus exporter with a custom registry. This is useful for testing or when you want more control over metric registration.
func (*Exporter) Handler ¶
Handler returns an http.Handler for the metrics endpoint. This is useful when you want to integrate metrics into an existing HTTP server.
func (*Exporter) MustRegister ¶
func (e *Exporter) MustRegister(cs ...prometheus.Collector)
MustRegister registers additional collectors with the exporter's registry. Panics if registration fails.
func (*Exporter) Register ¶
func (e *Exporter) Register(c prometheus.Collector) error
Register registers additional collectors with the exporter's registry. Returns an error if registration fails.
func (*Exporter) Registry ¶
func (e *Exporter) Registry() *prometheus.Registry
Registry returns the underlying Prometheus registry.
type MetricsListener ¶
type MetricsListener struct{}
MetricsListener records pipeline events as Prometheus metrics. It implements the events.Listener signature and should be registered with an EventBus using SubscribeAll.
func NewMetricsListener ¶
func NewMetricsListener() *MetricsListener
NewMetricsListener creates a new MetricsListener.
func (*MetricsListener) Handle ¶
func (l *MetricsListener) Handle(event *events.Event)
Handle processes an event and records relevant metrics. This method is designed to be used with EventBus.SubscribeAll.
func (*MetricsListener) Listener ¶
func (l *MetricsListener) Listener() events.Listener
Listener returns an events.Listener function that can be registered with an EventBus.