mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 14:03:45 +03:00
[hw-7] add metrics, tracing
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"route256/loms/internal/domain/entity"
|
||||
"route256/loms/internal/infra/tracing"
|
||||
|
||||
"github.com/IBM/sarama"
|
||||
"github.com/rs/zerolog/log"
|
||||
@@ -64,6 +65,9 @@ func (p *statusProducer) runCallbacks() {
|
||||
}
|
||||
|
||||
func (p *statusProducer) Send(ctx context.Context, id entity.ID, status string) error {
|
||||
ctx, span := tracing.Tracer().Start(ctx, "Producer.Send")
|
||||
defer span.End()
|
||||
|
||||
log.Debug().Msgf("sending event for id: %d; status: %s", id, status)
|
||||
|
||||
newStatus, err := mapOrderStatus(status)
|
||||
@@ -86,6 +90,9 @@ func (p *statusProducer) Send(ctx context.Context, id entity.ID, status string)
|
||||
}
|
||||
|
||||
func (p *statusProducer) SendRaw(ctx context.Context, id entity.ID, value []byte) error {
|
||||
ctx, span := tracing.Tracer().Start(ctx, "Producer.SendRaw")
|
||||
defer span.End()
|
||||
|
||||
if len(value) == 0 {
|
||||
return fmt.Errorf("empty message value")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user