Skip to content

Commit aa868d5

Browse files
authored
Clarify HTTP/gRPC exporter examples (#3492)
Signed-off-by: Yuri Shkuro <[email protected]>
1 parent d7b3115 commit aa868d5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

example/otel-collector/main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ func initProvider() (func(context.Context) error, error) {
5757
// microk8s), it should be accessible through the NodePort service at the
5858
// `localhost:30080` endpoint. Otherwise, replace `localhost` with the
5959
// endpoint of your cluster. If you run the app inside k8s, then you can
60-
// probably connect directly to the service through dns
60+
// probably connect directly to the service through dns.
6161
ctx, cancel := context.WithTimeout(ctx, time.Second)
6262
defer cancel()
63-
conn, err := grpc.DialContext(ctx, "localhost:30080", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
63+
conn, err := grpc.DialContext(ctx, "localhost:30080",
64+
// Note the use of insecure transport here. TLS is recommended in production.
65+
grpc.WithTransportCredentials(insecure.NewCredentials()),
66+
grpc.WithBlock(),
67+
)
6468
if err != nil {
6569
return nil, fmt.Errorf("failed to create gRPC connection to collector: %w", err)
6670
}

exporters/otlp/otlptrace/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ go get -u go.opentelemetry.io/otel/exporters/otlp/otlptrace
1212

1313
## Examples
1414

15-
- [Exporter setup and examples](./otlptracehttp/example_test.go)
16-
- [Full example sending telemetry to a local collector](../../../example/otel-collector)
15+
- [HTTP Exporter setup and examples](./otlptracehttp/example_test.go)
16+
- [Full example of gRPC Exporter sending telemetry to a local collector](../../../example/otel-collector)
1717

1818
## [`otlptrace`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace)
1919

0 commit comments

Comments
 (0)