Skip to content

Commit 9d87e96

Browse files
committed
eventbus supports configurable
Signed-off-by: jyjiangkai <[email protected]>
1 parent 7ddd6ed commit 9d87e96

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

observability/tracing/exporter/event_trace_exporter.go

+8
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ type Option func(*Options)
3030

3131
type Options struct {
3232
Endpoints string
33+
Eventbus string
3334
}
3435

3536
func defaultOptions() *Options {
3637
return &Options{
3738
Endpoints: "127.0.0.1:8080",
39+
Eventbus: "event-tracing",
3840
}
3941
}
4042

@@ -44,6 +46,12 @@ func WithEndpoint(endpoint string) Option {
4446
}
4547
}
4648

49+
func WithEventbus(eventbus string) Option {
50+
return func(options *Options) {
51+
options.Eventbus = eventbus
52+
}
53+
}
54+
4755
// Exporter exports trace data in the OTLP wire format.
4856
type Exporter struct {
4957
endpoints string

observability/tracing/tracing.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type Config struct {
4747
OtelCollector string `yaml:"otel_collector"`
4848
EventTracingEnable bool `yaml:"event_tracing_enable"`
4949
EventCollector string `yaml:"event_collector"`
50+
Eventbus string `yaml:"eventbus"`
5051
}
5152

5253
var tp *tracerProvider
@@ -188,7 +189,9 @@ func newTracerProvider(serviceName string, cfg Config) (*trace.TracerProvider, e
188189

189190
if cfg.EventTracingEnable && cfg.EventCollector != "" {
190191
// Set up a event exporter
191-
eventExporter, err := exporter.New(ctx, exporter.WithEndpoint(cfg.EventCollector))
192+
endpoint := exporter.WithEndpoint(cfg.EventCollector)
193+
eventbus := exporter.WithEventbus(cfg.Eventbus)
194+
eventExporter, err := exporter.New(ctx, endpoint, eventbus)
192195
if err != nil {
193196
return nil, fmt.Errorf("failed to create event exporter: %w", err)
194197
}

0 commit comments

Comments
 (0)