Skip to content

Commit

Permalink
Use internal.Config
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Dec 8, 2021
1 parent e449ba3 commit 8617049
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
12 changes: 10 additions & 2 deletions instrumentation/github.com/go-chi/chi/splunkchi/chi.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ import (

"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"github.com/signalfx/splunk-otel-go/instrumentation/internal"
"go.opentelemetry.io/otel/propagation"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
"go.opentelemetry.io/otel/trace"

"github.com/signalfx/splunk-otel-go/instrumentation/internal"
)

// instrumentationName is the instrumentation library identifier for a Tracer.
Expand All @@ -32,7 +34,13 @@ const instrumentationName = "github.com/signalfx/splunk-otel-go/instrumentation/
// Middleware returns github.com/go-chi/chi middleware that traces served
// requests.
func Middleware(options ...Option) func(http.Handler) http.Handler {
cfg := internal.NewConfig(instrumentationName, localToInternal(options)...)
o := append([]internal.Option{
internal.OptionFunc(func(c *internal.Config) {
c.DefaultStartOpts = append(c.DefaultStartOpts, trace.WithSpanKind(trace.SpanKindServer))
}),
}, localToInternal(options)...)
cfg := internal.NewConfig(instrumentationName, o...)

return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Allows us to track the ultimate status.
Expand Down
1 change: 0 additions & 1 deletion instrumentation/github.com/go-chi/chi/splunkchi/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.16
require (
github.com/go-chi/chi v1.5.4
github.com/signalfx/splunk-otel-go v0.0.0-00010101000000-000000000000
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/otel v1.2.0
go.opentelemetry.io/otel/trace v1.2.0
)
Expand Down
1 change: 0 additions & 1 deletion instrumentation/github.com/go-chi/chi/splunkchi/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ go.opentelemetry.io/otel/trace v1.2.0 h1:Ys3iqbqZhcf28hHzrm5WAquMkDHNZTUkw7KHbuN
go.opentelemetry.io/otel/trace v1.2.0/go.mod h1:N5FLswTubnxKxOJHM7XZC074qpeEdLy3CgAVsdMucK0=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
3 changes: 2 additions & 1 deletion instrumentation/github.com/go-chi/chi/splunkchi/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
package splunkchi

import (
"github.com/signalfx/splunk-otel-go/instrumentation/internal"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/trace"

"github.com/signalfx/splunk-otel-go/instrumentation/internal"
)

func localToInternal(opts []Option) []internal.Option {
Expand Down

0 comments on commit 8617049

Please sign in to comment.