diff --git a/pkg/amqp10_client/consumer.go b/pkg/amqp10_client/consumer.go index 0b5d772..73e72a2 100644 --- a/pkg/amqp10_client/consumer.go +++ b/pkg/amqp10_client/consumer.go @@ -10,6 +10,7 @@ import ( "github.com/rabbitmq/omq/pkg/config" "github.com/rabbitmq/omq/pkg/log" "github.com/rabbitmq/omq/pkg/topic" + "github.com/rabbitmq/omq/pkg/utils" "github.com/relvacode/iso8601" "github.com/rabbitmq/omq/pkg/metrics" @@ -73,8 +74,7 @@ func (c Amqp10Consumer) Start(ctx context.Context, subscribed chan bool) { close(subscribed) log.Debug("consumer subscribed", "protocol", "amqp-1.0", "consumerId", c.Id, "terminus", c.Topic, "durability", durability) - // TODO: disabled due to performance issues - // m := metrics.EndToEndLatency.With(prometheus.Labels{"protocol": "amqp-1.0"}) + m := metrics.EndToEndLatency.With(prometheus.Labels{"protocol": "amqp-1.0"}) log.Info("consumer started", "protocol", "amqp-1.0", "consumerId", c.Id, "terminus", c.Topic) @@ -91,7 +91,7 @@ func (c Amqp10Consumer) Start(ctx context.Context, subscribed chan bool) { } payload := msg.GetData() - // m.Observe(utils.CalculateEndToEndLatency(c.Config.UseMillis, &payload)) + m.Observe(utils.CalculateEndToEndLatency(c.Config.UseMillis, &payload)) log.Debug("message received", "protocol", "amqp-1.0", "consumerId", c.Id, "terminus", c.Topic, "size", len(payload)) diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index abf1fdd..80909cd 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -31,7 +31,7 @@ var ( MessagesPublished *prometheus.CounterVec MessagesConsumed *prometheus.CounterVec PublishingLatency *prometheus.SummaryVec - EndToEndLatency *prometheus.SummaryVec + EndToEndLatency *prometheus.HistogramVec ) func RegisterMetrics(globalLabels prometheus.Labels) { @@ -58,10 +58,10 @@ func RegisterMetrics(globalLabels prometheus.Labels) { }, []string{"protocol"}) } if EndToEndLatency == nil { - EndToEndLatency = promauto.NewSummaryVec(prometheus.SummaryOpts{ + EndToEndLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{ Name: "omq_end_to_end_latency_seconds", Help: "Time from sending a message to receiving the message", - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.95: 0.005, 0.99: 0.001}, + Buckets: []float64{.001, .002, .003, .004, .005, .006, .007, 0.008, .009, 0.01, 0.025, 0.05, 0.1, 0.5, 1, 2, 3, 4, 5, 10, 20, 30, 60}, ConstLabels: globalLabels, }, []string{"protocol"}) }