Skip to content

Commit

Permalink
Fix recording issue
Browse files Browse the repository at this point in the history
  • Loading branch information
utr1903 committed Feb 4, 2024
1 parent a67edcd commit 06d7359
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/golang/commons/otel/kafka/kafka_consumer_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type KafkaConsumeTelemetryContext struct {
}

func (k *KafkaConsumeTelemetryContext) End(
ctx context.Context,
err error,
) {
elapsedTime := float64(time.Since(k.startTime)) / float64(time.Millisecond)
Expand All @@ -113,7 +114,7 @@ func (k *KafkaConsumeTelemetryContext) End(
if err != nil {
attrs = append(attrs, semconv.ErrorType.String(err.Error()))
}
k.latency.Record(k.ctx, elapsedTime,
k.latency.Record(ctx, elapsedTime,
metric.WithAttributes(
attrs...,
))
Expand Down
4 changes: 2 additions & 2 deletions apps/golang/kafkaconsumer/consumer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ func (g *groupHandler) consumeMessage(
err := g.storeIntoDb(ctx, name)
if err != nil {
g.logger.Log(logrus.ErrorLevel, ctx, name, "Consuming message is failed.")
kctCtx.End(err)
kctCtx.End(ctx, err)
return nil
}

// Acknowledge message
session.MarkMessage(msg, "")
g.logger.Log(logrus.InfoLevel, ctx, name, "Consuming message is succeeded.")

kctCtx.End(nil)
kctCtx.End(ctx, nil)
return nil
}

Expand Down

0 comments on commit 06d7359

Please sign in to comment.