Skip to content

Commit

Permalink
fix batch ionsert time metric name
Browse files Browse the repository at this point in the history
  • Loading branch information
tomershafir committed Jan 16, 2024
1 parent 73bf9d5 commit e06d451
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions exporter/clickhouseprofileexporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ func newClickhouseProfileExporter(ctx context.Context, set *exporter.CreateSetti
func (exp *clickhouseProfileExporter) send(ctx context.Context, logs plog.Logs) error {
start := time.Now().UnixMilli()
if err := exp.ch.InsertBatch(logs); err != nil {
otelcolExporterClickhouseProfileFlushTimeMillis.Record(ctx, time.Now().UnixMilli()-start, metric.WithAttributeSet(*newOtelcolAttrSetBatch(errorCodeError)))
otelcolExporterClickhouseProfileBatchInsertTimeMillis.Record(ctx, time.Now().UnixMilli()-start, metric.WithAttributeSet(*newOtelcolAttrSetBatch(errorCodeError)))
exp.logger.Error(fmt.Sprintf("failed to insert batch: [%s]", err.Error()))
return err
}
otelcolExporterClickhouseProfileFlushTimeMillis.Record(ctx, time.Now().UnixMilli()-start, metric.WithAttributeSet(*newOtelcolAttrSetBatch(errorCodeSuccess)))
otelcolExporterClickhouseProfileBatchInsertTimeMillis.Record(ctx, time.Now().UnixMilli()-start, metric.WithAttributeSet(*newOtelcolAttrSetBatch(errorCodeSuccess)))
exp.logger.Info("inserted batch", zap.Int("size", logs.ResourceLogs().Len()))
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions exporter/clickhouseprofileexporter/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
const prefix = "exporter_clickhouse_profile_"

var (
otelcolExporterClickhouseProfileFlushTimeMillis metric.Int64Histogram
otelcolExporterClickhouseProfileBatchInsertTimeMillis metric.Int64Histogram
)

func initMetrics(meter metric.Meter) error {
var err error
if otelcolExporterClickhouseProfileFlushTimeMillis, err = meter.Int64Histogram(
fmt.Sprint(prefix, "flush_time_millis"),
metric.WithDescription("Clickhouse profile exporter flush time in millis"),
if otelcolExporterClickhouseProfileBatchInsertTimeMillis, err = meter.Int64Histogram(
fmt.Sprint(prefix, "batch_insert_time_millis"),
metric.WithDescription("Clickhouse profile exporter batch insert time in millis"),
metric.WithExplicitBucketBoundaries(0, 5, 10, 20, 50, 100, 200, 500, 1000, 5000),
); err != nil {
return err
Expand Down

0 comments on commit e06d451

Please sign in to comment.