Skip to content

feedback from users #4

@aldas

Description

@aldas

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions