Skip to content

Commit

Permalink
Implement rate as counter
Browse files Browse the repository at this point in the history
  • Loading branch information
olegbespalov committed May 23, 2024
1 parent 8ddf863 commit c47abf6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/opentelemetry/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,15 @@ func (o *Output) dispatch(entry metrics.Sample) error {
}

trend.Record(ctx, entry.Value, otelMetric.WithAttributes(MapTagSet(entry.Tags)...))
case metrics.Rate:
rate, err := o.getOrCreateCounter(name)
if err != nil {
return err
}

rate.Add(ctx, entry.Value, otelMetric.WithAttributes(MapTagSet(entry.Tags)...))
default:
// TODO: add support for other metric types
o.logger.Debugf("Drop unsupported metric type: %s", entry.Metric.Name)
o.logger.Warnf("metric %q has unsupported metric type", entry.Metric.Name)
}

return nil
Expand Down

0 comments on commit c47abf6

Please sign in to comment.