Do we need additional features?
From prometheus middleware experience I assume there will be some people that want custom metrics support or disable/replace built-in metrics.
Additional metrics can be incremented in echootel.Config.MetricAttributes callback and Metrics attributes can be modified/added in that same callback. This is not very elequant solution but maybe we do not anything more complex than this
e.Use(echootel.NewMiddlewareWithConfig(echootel.Config{
MetricAttributes: func(c *echo.Context, v *echootel.Values, attr []attribute.KeyValue) []attribute.KeyValue {
// increment a metric here
return append(attr, attribute.String("custom_attr", "value"))
},
}))
edit:
custom metrics can be provided by implementing this interface
|
// MetricsRecorder is used to record metrics. This interface is used to allow custom metrics recording with access to |
|
// the Echo context, so additional attributes can be extracted from it. |
|
type MetricsRecorder interface { |
|
Record(c *echo.Context, v RecordValues) |
|
} |
default
implementation
Do we need additional features?
From prometheus middleware experience I assume there will be some people that want custom metrics support or disable/replace built-in metrics.
Additional metrics can be incremented in
echootel.Config.MetricAttributescallback and Metrics attributes can be modified/added in that same callback. This is not very elequant solution but maybe we do not anything more complex than thisedit:
custom metrics can be provided by implementing this interface
echo-opentelemetry/otel.go
Lines 92 to 96 in a98d1db
default implementation