Skip to content

contrib/hashicorp/vault: add godoc links #3609

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contrib/hashicorp/vault/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Option interface {
apply(*config)
}

// OptionFn represents options applicable to NewHTTPClient and WrapHTTPClient.
// OptionFn represents options applicable to [NewHTTPClient] and [WrapHTTPClient].
type OptionFn func(*config)

func (fn OptionFn) apply(cfg *config) {
Expand Down Expand Up @@ -52,7 +52,7 @@ func WithAnalyticsRate(rate float64) OptionFn {
}
}

// WithService sets the given service name for the http.Client.
// WithService sets the given service name for the [*http.Client].
func WithService(name string) OptionFn {
return func(c *config) {
c.serviceName = name
Expand Down
21 changes: 11 additions & 10 deletions contrib/hashicorp/vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016 Datadog, Inc.

// Package vault contains functions to construct or augment an http.Client that
// will integrate with the github.com/hashicorp/vault/api and collect traces to
// Package vault contains functions to construct or augment an [*http.Client] that
// will integrate with the [github.com/hashicorp/vault/api] and collect traces to
// send to Datadog.
//
// The easiest way to use this package is to create an http.Client with
// NewHTTPClient, and put it in the Vault API config that is passed to the
// The easiest way to use this package is to create an [*http.Client] with
// [NewHTTPClient], and put it in the Vault [api.Config] that is passed to
// [api.NewClient].
//
// If you are already using your own http.Client with the Vault API, you can
// use the WrapHTTPClient function to wrap the client with the tracer code.
// Your http.Client will continue to work as before, but will also capture
// If you are already using your own [*http.Client] with the Vault API, you can
// use the [WrapHTTPClient] function to wrap the client with the tracer code.
// Your [*http.Client] will continue to work as before, but will also capture
// traces.
package vault

Expand All @@ -36,16 +37,16 @@ func init() {
instr = instrumentation.Load(instrumentation.PackageHashicorpVaultAPI)
}

// NewHTTPClient returns an http.Client for use in the Vault API config
// Client. A set of options can be passed in for further configuration.
// NewHTTPClient returns an [*http.Client] for use in the Vault API config
// [*api.Client]. A set of options can be passed in for further configuration.
func NewHTTPClient(opts ...Option) *http.Client {
dc := api.DefaultConfig()
c := dc.HttpClient
WrapHTTPClient(c, opts...)
return c
}

// WrapHTTPClient takes an existing http.Client and wraps the underlying
// WrapHTTPClient takes an existing [*http.Client] and wraps the underlying
// transport with tracing.
func WrapHTTPClient(c *http.Client, opts ...Option) *http.Client {
if c.Transport == nil {
Expand Down
Loading