Skip to content

Commit

Permalink
service name as function input
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal committed May 6, 2024
1 parent 1ae80b2 commit 28c5999
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion flow/cmd/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func WorkerSetup(opts *WorkerSetupOptions) (*workerSetupResponse, error) {
var metricsProvider *sdkmetric.MeterProvider
var otelManager *otel_metrics.OtelManager
if opts.EnableOtelMetrics {
metricsProvider, err = otel_metrics.SetupOtelMetricsExporter()
metricsProvider, err = otel_metrics.SetupOtelMetricsExporter("flow-worker")
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions flow/otel_metrics/otel_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ func newOtelResource(otelServiceName string) (*resource.Resource, error) {
return r, err
}

func SetupOtelMetricsExporter() (*sdkmetric.MeterProvider, error) {
func SetupOtelMetricsExporter(otelServiceName string) (*sdkmetric.MeterProvider, error) {
metricExporter, err := otlpmetrichttp.New(context.Background(),
otlpmetrichttp.WithCompression(otlpmetrichttp.GzipCompression),
)
if err != nil {
return nil, fmt.Errorf("failed to create OpenTelemetry metrics exporter: %w", err)
}

resource, err := newOtelResource("flow-worker")
resource, err := newOtelResource(otelServiceName)
if err != nil {
return nil, fmt.Errorf("failed to create OpenTelemetry resource: %w", err)
}
Expand Down

0 comments on commit 28c5999

Please sign in to comment.