Skip to content

Commit a2da3b6

Browse files
authored
Fix Go telemetry examples: NewClient takes *ClientOptions and returns one value (#2086)
The Go OpenTelemetry example bound two return values and passed ClientOptions by value, so copying it into a program failed to compile with an assignment mismatch and a pointer type error. NewClient is declared as `func NewClient(options *ClientOptions) *Client`: it takes a pointer and returns no error. Errors surface later from Start and CreateSession. Correct the three duplicated copies of the snippet to the single-return pointer form already used by NewClient's own doc comment. Co-authored-by: examon <examon@users.noreply.github.com>
1 parent 4f9bc8d commit a2da3b6

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2158,7 +2158,7 @@ Install with telemetry extras: `pip install copilot-sdk[telemetry]` (provides `o
21582158

21592159
<!-- docs-validate: skip -->
21602160
```go
2161-
client, err := copilot.NewClient(copilot.ClientOptions{
2161+
client := copilot.NewClient(&copilot.ClientOptions{
21622162
Telemetry: &copilot.TelemetryConfig{
21632163
OTLPEndpoint: "http://localhost:4318",
21642164
},

docs/observability/opentelemetry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ client = CopilotClient(
4343

4444
<!-- docs-validate: skip -->
4545
```go
46-
client, err := copilot.NewClient(copilot.ClientOptions{
46+
client := copilot.NewClient(&copilot.ClientOptions{
4747
Telemetry: &copilot.TelemetryConfig{
4848
OTLPEndpoint: "http://localhost:4318",
4949
},

go/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ session, err := client.CreateSession(context.Background(), &copilot.SessionConfi
646646
The SDK supports OpenTelemetry for distributed tracing. Provide a `Telemetry` config to enable trace export and automatic W3C Trace Context propagation.
647647

648648
```go
649-
client, err := copilot.NewClient(copilot.ClientOptions{
649+
client := copilot.NewClient(&copilot.ClientOptions{
650650
Telemetry: &copilot.TelemetryConfig{
651651
OTLPEndpoint: "http://localhost:4318",
652652
},

0 commit comments

Comments
 (0)