Skip to content

Commit

Permalink
use logger
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanos committed Jan 10, 2025
1 parent 4d2709c commit 026df7b
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 185 deletions.
2 changes: 1 addition & 1 deletion common/persistence/client/fx.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func DataStoreFactoryProvider(
}

if otel.IsEnabled(tracerProvider) {
dataStoreFactory = telemetry.NewTelemetryDataStoreFactory(dataStoreFactory, tracerProvider.Tracer("persistence"))
dataStoreFactory = telemetry.NewTelemetryDataStoreFactory(dataStoreFactory, logger, tracerProvider.Tracer("persistence"))
}

return dataStoreFactory
Expand Down
40 changes: 23 additions & 17 deletions common/persistence/telemetry/cluster_metadata_store_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions common/persistence/telemetry/data_store_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ package telemetry

import (
"go.opentelemetry.io/otel/trace"
"go.temporal.io/server/common/log"
"go.temporal.io/server/common/persistence"
)

type (
TelemetryDataStoreFactory struct {
baseFactory persistence.DataStoreFactory
logger log.Logger
tracer trace.Tracer

taskStore persistence.TaskStore
Expand All @@ -47,10 +49,12 @@ type (

func NewTelemetryDataStoreFactory(
baseFactory persistence.DataStoreFactory,
logger log.Logger,
tracer trace.Tracer,
) *TelemetryDataStoreFactory {
return &TelemetryDataStoreFactory{
baseFactory: baseFactory,
logger: logger,
tracer: tracer,
}
}
Expand All @@ -65,7 +69,7 @@ func (d *TelemetryDataStoreFactory) NewTaskStore() (persistence.TaskStore, error
if err != nil {
return nil, err
}
d.taskStore = newTelemetryTaskStore(baseStore, d.tracer)
d.taskStore = newTelemetryTaskStore(baseStore, d.logger, d.tracer)
}
return d.taskStore, nil
}
Expand All @@ -76,7 +80,7 @@ func (d *TelemetryDataStoreFactory) NewShardStore() (persistence.ShardStore, err
if err != nil {
return nil, err
}
d.shardStore = newTelemetryShardStore(baseStore, d.tracer)
d.shardStore = newTelemetryShardStore(baseStore, d.logger, d.tracer)
}
return d.shardStore, nil
}
Expand All @@ -87,7 +91,7 @@ func (d *TelemetryDataStoreFactory) NewMetadataStore() (persistence.MetadataStor
if err != nil {
return nil, err
}
d.metadataStore = newTelemetryMetadataStore(baseStore, d.tracer)
d.metadataStore = newTelemetryMetadataStore(baseStore, d.logger, d.tracer)
}
return d.metadataStore, nil
}
Expand All @@ -98,7 +102,7 @@ func (d *TelemetryDataStoreFactory) NewExecutionStore() (persistence.ExecutionSt
if err != nil {
return nil, err
}
d.executionStore = newTelemetryExecutionStore(baseStore, d.tracer)
d.executionStore = newTelemetryExecutionStore(baseStore, d.logger, d.tracer)
}
return d.executionStore, nil
}
Expand All @@ -109,7 +113,7 @@ func (d *TelemetryDataStoreFactory) NewQueue(queueType persistence.QueueType) (p
if err != nil {
return baseQueue, err
}
d.queue = newTelemetryQueue(baseQueue, d.tracer)
d.queue = newTelemetryQueue(baseQueue, d.logger, d.tracer)
}
return d.queue, nil
}
Expand All @@ -120,7 +124,7 @@ func (d *TelemetryDataStoreFactory) NewQueueV2() (persistence.QueueV2, error) {
if err != nil {
return baseQueue, err
}
d.queueV2 = newTelemetryQueueV2(baseQueue, d.tracer)
d.queueV2 = newTelemetryQueueV2(baseQueue, d.logger, d.tracer)
}
return d.queueV2, nil
}
Expand All @@ -131,7 +135,7 @@ func (d *TelemetryDataStoreFactory) NewClusterMetadataStore() (persistence.Clust
if err != nil {
return nil, err
}
d.clusterMDStore = newTelemetryClusterMetadataStore(baseStore, d.tracer)
d.clusterMDStore = newTelemetryClusterMetadataStore(baseStore, d.logger, d.tracer)
}
return d.clusterMDStore, nil
}
Expand All @@ -142,7 +146,7 @@ func (d *TelemetryDataStoreFactory) NewNexusEndpointStore() (persistence.NexusEn
if err != nil {
return nil, err
}
d.nexusEndpointStore = newTelemetryNexusEndpointStore(baseStore, d.tracer)
d.nexusEndpointStore = newTelemetryNexusEndpointStore(baseStore, d.logger, d.tracer)
}
return d.nexusEndpointStore, nil
}
Loading

0 comments on commit 026df7b

Please sign in to comment.