Skip to content

Commit

Permalink
update go version and change to a client kind
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentfree committed Oct 15, 2022
1 parent 4802e72 commit 035f3c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

| Version | Supported |
| ------- | ------------------ |
| 0.0.7 | :white_check_mark: |
| 0.0.6 | :white_check_mark: |
| 0.0.5 | :white_check_mark: |
| < 0.0.5 | :x: |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/vincentfree/opentelemetry-http

go 1.18
go 1.19

require (
go.opentelemetry.io/otel v1.11.0
Expand Down
9 changes: 6 additions & 3 deletions otelmiddleware/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/propagation"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
semconv "go.opentelemetry.io/otel/semconv/v1.11.0"
"go.opentelemetry.io/otel/trace"
)

// version is used as the instrumentation version.
const version = "0.0.6"
const version = "0.0.7"

// TraceOption takes a traceConfig struct and applies changes.
// It can be passed to the TraceWithOptions function to configure a traceConfig struct.
Expand Down Expand Up @@ -57,10 +57,13 @@ func TraceWithOptions(opt ...TraceOption) func(next http.Handler) http.Handler {
ctx := config.propagator.Extract(requestCtx, propagation.HeaderCarrier(r.Header))
// the standard trace.SpanStartOption options whom are applied to every server handler.
opts := []trace.SpanStartOption{

trace.WithAttributes(semconv.NetAttributesFromHTTPRequest("tcp", r)...),
trace.WithAttributes(semconv.EndUserAttributesFromHTTPRequest(r)...),
trace.WithAttributes(semconv.HTTPServerAttributesFromHTTPRequest(r.Host, extractRoute(r.RequestURI), r)...),
trace.WithSpanKind(trace.SpanKindServer),
trace.WithAttributes(semconv.HTTPClientAttributesFromHTTPRequest(r)...),
trace.WithAttributes(semconv.TelemetrySDKLanguageGo),
trace.WithSpanKind(trace.SpanKindClient),
}
// check for the traceConfig.attributes if present apply them to the trace.Span.
if len(config.attributes) > 0 {
Expand Down

0 comments on commit 035f3c4

Please sign in to comment.