Skip to content

Commit 1298932

Browse files
dinoolivatigrannajaryan
authored andcommitted
Update Stackdriver Exporter insecure trace and monitoring clients
Exporter now explicitly connects with insecure connections.
1 parent 946d0a9 commit 1298932

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

exporter/stackdriverexporter/stackdriver.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,17 @@ func newStackdriverExporter(cfg *Config) (*stackdriver.Exporter, error) {
8989
DefaultMonitoringLabels: &stackdriver.Labels{},
9090
}
9191
if cfg.Endpoint != "" {
92-
dOpts := []option.ClientOption{}
9392
if cfg.UseInsecure {
94-
dOpts = append(dOpts, option.WithGRPCDialOption(grpc.WithInsecure()))
93+
conn, err := grpc.Dial(cfg.Endpoint, grpc.WithInsecure())
94+
if err != nil {
95+
return nil, fmt.Errorf("cannot configure grpc conn: %v", err)
96+
}
97+
options.TraceClientOptions = []option.ClientOption{option.WithGRPCConn(conn)}
98+
options.MonitoringClientOptions = []option.ClientOption{option.WithGRPCConn(conn)}
99+
} else {
100+
options.TraceClientOptions = []option.ClientOption{option.WithEndpoint(cfg.Endpoint)}
101+
options.MonitoringClientOptions = []option.ClientOption{option.WithEndpoint(cfg.Endpoint)}
95102
}
96-
dOpts = append(dOpts, option.WithEndpoint(cfg.Endpoint))
97-
options.TraceClientOptions = dOpts
98-
options.MonitoringClientOptions = dOpts
99103
}
100104
if cfg.NumOfWorkers > 0 {
101105
options.NumberOfWorkers = cfg.NumOfWorkers

0 commit comments

Comments
 (0)