Skip to content

Commit

Permalink
Merge pull request #59 from Sovietaced/accessToken
Browse files Browse the repository at this point in the history
Add OTEL to http clients by default
  • Loading branch information
Sovietaced authored Jul 4, 2024
2 parents cdad72f + f792955 commit 47c06c3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion keyfunc/okta/okta.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/benbjohnson/clock"
"github.com/golang-jwt/jwt/v5"
"github.com/sovietaced/okta-jwt-verifier/metadata"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"io"
"log/slog"
"net/http"
Expand Down Expand Up @@ -72,7 +73,12 @@ func WithBackgroundCtx(ctx context.Context) Option {

func defaultOptions() *Options {
opts := &Options{}
WithHttpClient(http.DefaultClient)(opts)

httpClient := http.Client{
Transport: otelhttp.NewTransport(http.DefaultTransport),
}

WithHttpClient(&httpClient)(opts)
withClock(clock.New())(opts)
WithCacheTtl(DefaultCacheTtl)(opts)
WithFetchStrategy(Lazy)(opts)
Expand Down
7 changes: 6 additions & 1 deletion metadata/okta/okta.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"github.com/benbjohnson/clock"
"github.com/sovietaced/okta-jwt-verifier/metadata"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"log/slog"
"net/http"
"sync"
Expand Down Expand Up @@ -70,7 +71,11 @@ func WithBackgroundCtx(ctx context.Context) Option {

func defaultOptions() *Options {
opts := &Options{}
WithHttpClient(http.DefaultClient)(opts)

httpClient := http.Client{
Transport: otelhttp.NewTransport(http.DefaultTransport),
}
WithHttpClient(&httpClient)(opts)
withClock(clock.New())(opts)
WithCacheTtl(DefaultCacheTtl)(opts)
WithFetchStrategy(Lazy)(opts)
Expand Down

0 comments on commit 47c06c3

Please sign in to comment.