Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo in docs #149

Closed
LiamMaguireANZ opened this issue Nov 15, 2023 · 2 comments · Fixed by connectrpc/connectrpc.com#98
Closed

Typo in docs #149

LiamMaguireANZ opened this issue Nov 15, 2023 · 2 comments · Fixed by connectrpc/connectrpc.com#98

Comments

@LiamMaguireANZ
Copy link

LiamMaguireANZ commented Nov 15, 2023

for docs linked.
https://connectrpc.com/docs/go/observability/#enabling-opentelemetry-for-connect

missing an s on WithInterceptor func should be WithInterceptors

having the pkgs to import also makes it a little easier to integrate with.

import (
"connectrpc.com/connect"
"connectrpc.com/otelconnect"
)

func main() {
    mux := http.NewServeMux()
    mux.Handle(pingv1connect.NewPingServiceHandler(
        &pingv1connect.UnimplementedPingServiceHandler{},
        connect.WithInterceptors(
            otelconnect.NewInterceptor(),
        ),
    ))

    http.ListenAndServe("localhost:8080", mux)
}

func makeRequest() {
    client := pingv1connect.NewPingServiceClient(
        http.DefaultClient,
        "http://localhost:8080",
        connect.WithInterceptors(
            otelconnect.NewInterceptor(),
        ),
    )
    resp, err := client.Ping(
        context.Background(),
        connect.NewRequest(&pingv1.PingRequest{}),
    )
    if err != nil {
        log.Fatal(err)
    }
    log.Print(resp)
}
@emcfarlane
Copy link
Collaborator

Thanks for reporting! I've made a change in the example code to highlight the changes needed. Is that helpful? Or would a full example be more useful?

@LiamMaguireANZ
Copy link
Author

i think both are fine. full code snippet could be too verbose for some people. But it is fine for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants