ensure otel tracing is passed through all event handlers and clients
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"go.equinixmetal.net/infra9-metal-bridge/internal/metal/providers"
|
||||
@@ -16,7 +17,8 @@ const (
|
||||
|
||||
// DefaultHTTPClient is the default http client used if no client is provided.
|
||||
var DefaultHTTPClient = &http.Client{
|
||||
Timeout: defaultHTTPTimeout,
|
||||
Timeout: defaultHTTPTimeout,
|
||||
Transport: otelhttp.NewTransport(http.DefaultTransport),
|
||||
}
|
||||
|
||||
var _ providers.Provider = &Client{}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package emgql
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"go.uber.org/zap"
|
||||
@@ -32,6 +33,15 @@ func WithBaseURL(baseURL string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithHTTPClient sets the http client to be used by the client.
|
||||
func WithHTTPClient(httpClient *http.Client) Option {
|
||||
return func(c *Client) error {
|
||||
c.httpClient = httpClient
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithConfig applies all configurations defined in the config.
|
||||
func WithConfig(config Config) Option {
|
||||
return func(c *Client) error {
|
||||
|
||||
Reference in New Issue
Block a user