Skip to content

Commit

Permalink
Added histogram buckets and renamed metrics (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraliv13 authored Dec 3, 2021
1 parent ea3c167 commit 9a6d9b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions internal/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package metrics

import (
"context"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"go.opentelemetry.io/otel/metric/global"
Expand Down Expand Up @@ -34,9 +35,9 @@ func newServiceMetrics() *serviceMetrics {

return &serviceMetrics{
pubsubMeter: meter,
publishCount: pubsubM.NewInt64Counter("pubsub.publish.count",
publishCount: pubsubM.NewInt64Counter("rusi.pubsub.publish.count",
metric.WithDescription("The number of publishes")),
subscribeDuration: pubsubM.NewInt64Histogram("pubsub.subscribe.duration",
subscribeDuration: pubsubM.NewInt64Histogram("rusi.pubsub.processing.duration",
metric.WithDescription("The duration of a message execution"),
metric.WithUnit("milliseconds")),
}
Expand Down
5 changes: 3 additions & 2 deletions internal/metrics/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package metrics

import (
"context"
"time"

"go.opentelemetry.io/otel/exporters/prometheus"
"go.opentelemetry.io/otel/metric/global"
"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
Expand All @@ -12,11 +14,10 @@ import (
"go.opentelemetry.io/otel/sdk/resource"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
"k8s.io/klog/v2"
"time"
)

func SetupPrometheusMetrics(appId string) *prometheus.Exporter {
config := prometheus.Config{}
config := prometheus.Config{DefaultHistogramBoundaries: []float64{10, 100, 1000, 10000, 100000}}
r, _ := resource.New(context.Background(),
resource.WithHost(),
resource.WithAttributes(semconv.ServiceNameKey.String(appId)))
Expand Down

0 comments on commit 9a6d9b5

Please sign in to comment.