Fix OTel span attribute naming convention (#2409)

* rename spans according to convention

* low cardinality
This commit is contained in:
Mohammed Nafees
2025-10-16 18:43:40 +02:00
committed by GitHub
parent d9268c7270
commit e2b1f1353e
61 changed files with 174 additions and 160 deletions

View File

@@ -13,10 +13,10 @@ import (
"github.com/hatchet-dev/hatchet/internal/cache"
"github.com/hatchet-dev/hatchet/internal/msgqueue"
"github.com/hatchet-dev/hatchet/internal/queueutils"
"github.com/hatchet-dev/hatchet/internal/telemetry"
"github.com/hatchet-dev/hatchet/pkg/logger"
"github.com/hatchet-dev/hatchet/pkg/repository"
"github.com/hatchet-dev/hatchet/pkg/repository/postgres/dbsqlc"
"github.com/hatchet-dev/hatchet/pkg/telemetry"
)
type PostgresMessageQueue struct {

View File

@@ -15,9 +15,9 @@ import (
"github.com/rs/zerolog"
"github.com/hatchet-dev/hatchet/internal/msgqueue"
"github.com/hatchet-dev/hatchet/internal/telemetry"
"github.com/hatchet-dev/hatchet/pkg/logger"
"github.com/hatchet-dev/hatchet/pkg/random"
"github.com/hatchet-dev/hatchet/pkg/telemetry"
)
const MAX_RETRY_COUNT = 15

View File

@@ -14,10 +14,10 @@ import (
"github.com/hatchet-dev/hatchet/internal/cache"
msgqueue "github.com/hatchet-dev/hatchet/internal/msgqueue/v1"
"github.com/hatchet-dev/hatchet/internal/queueutils"
"github.com/hatchet-dev/hatchet/internal/telemetry"
"github.com/hatchet-dev/hatchet/pkg/logger"
"github.com/hatchet-dev/hatchet/pkg/repository"
"github.com/hatchet-dev/hatchet/pkg/repository/postgres/dbsqlc"
"github.com/hatchet-dev/hatchet/pkg/telemetry"
)
type PostgresMessageQueue struct {
@@ -111,7 +111,7 @@ func (p *PostgresMessageQueue) SendMessage(ctx context.Context, queue msgqueue.Q
ctx, span := telemetry.NewSpan(ctx, "PostgresMessageQueue.SendMessage")
defer span.End()
telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "tenant_id", Value: task.TenantID})
telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "tenant.id", Value: task.TenantID})
err := p.addMessage(ctx, queue, task)
@@ -128,7 +128,7 @@ func (p *PostgresMessageQueue) addMessage(ctx context.Context, queue msgqueue.Qu
ctx, span := telemetry.NewSpan(ctx, "add-message")
defer span.End()
telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "tenant_id", Value: task.TenantID})
telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "tenant.id", Value: task.TenantID})
// inject otel carrier into the message
if task.OtelCarrier == nil {

View File

@@ -17,9 +17,9 @@ import (
msgqueue "github.com/hatchet-dev/hatchet/internal/msgqueue/v1"
"github.com/hatchet-dev/hatchet/internal/queueutils"
"github.com/hatchet-dev/hatchet/internal/telemetry"
"github.com/hatchet-dev/hatchet/pkg/logger"
"github.com/hatchet-dev/hatchet/pkg/random"
"github.com/hatchet-dev/hatchet/pkg/telemetry"
)
const MAX_RETRY_COUNT = 15
@@ -281,7 +281,7 @@ func (t *MessageQueueImpl) pubMessage(ctx context.Context, q msgqueue.Queue, msg
ctx, span := telemetry.NewSpanWithCarrier(ctx, "publish-message", otelCarrier)
defer span.End()
telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "tenant_id", Value: msg.TenantID})
telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "tenant.id", Value: msg.TenantID})
msg.SetOtelCarrier(otelCarrier)