Skip to content

Commit

Permalink
Added fake bump to report Metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Wise-Wizard <[email protected]>
  • Loading branch information
Wise-Wizard committed Aug 8, 2024
1 parent 452e505 commit ea6abf0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/metrics/otelmetrics/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func NewFactory(meterProvider metric.MeterProvider) metrics.Factory {
func (f *otelFactory) Counter(opts metrics.Options) metrics.Counter {
name := CounterNamingConvention(f.subScope(opts.Name))
counter, err := f.meter.Int64Counter(name)
counter.Add(context.Background(), 1)
if err != nil {
log.Printf("Error creating OTEL counter: %v", err)
return metrics.NullCounter
Expand Down Expand Up @@ -63,6 +64,7 @@ func (f *otelFactory) Gauge(opts metrics.Options) metrics.Gauge {
func (f *otelFactory) Histogram(opts metrics.HistogramOptions) metrics.Histogram {
name := f.subScope(opts.Name)
histogram, err := f.meter.Float64Histogram(name)
histogram.Record(context.Background(), 1.0)
if err != nil {
log.Printf("Error creating OTEL histogram: %v", err)
return metrics.NullHistogram
Expand All @@ -78,6 +80,7 @@ func (f *otelFactory) Histogram(opts metrics.HistogramOptions) metrics.Histogram
func (f *otelFactory) Timer(opts metrics.TimerOptions) metrics.Timer {
name := f.subScope(opts.Name)
timer, err := f.meter.Float64Histogram(name, metric.WithUnit("s"))
timer.Record(context.Background(), 1.0)
if err != nil {
log.Printf("Error creating OTEL timer: %v", err)
return metrics.NullTimer
Expand Down

0 comments on commit ea6abf0

Please sign in to comment.