Skip to content

Commit

Permalink
Update HTTP span names to include method and route (#143)
Browse files Browse the repository at this point in the history
* http spans should be "method route"

* update test traces to match convention

* update changelog

* Update CHANGELOG.md

Co-authored-by: Mike Goldsmith <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Tyler Yahn <[email protected]>

---------

Co-authored-by: Mike Goldsmith <[email protected]>
Co-authored-by: Tyler Yahn <[email protected]>
  • Loading branch information
3 people authored May 9, 2023
1 parent eadc6bc commit d7606e8
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http
### Changed

- Only pull docker image if not present for the emojivoto example. ([#149](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/149))
- Update HTTP span names to include method and route to match semantic conventions. ([#143](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/143))

## [v0.2.0-alpha] - 2023-05-03

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"bytes"
"encoding/binary"
"errors"
"fmt"

"os"

Expand Down Expand Up @@ -193,6 +194,7 @@ func (h *Instrumentor) Run(eventsChan chan<- *events.Event) {
func (h *Instrumentor) convertEvent(e *Event) *events.Event {
method := unix.ByteSliceToString(e.Method[:])
path := unix.ByteSliceToString(e.Path[:])
name := fmt.Sprintf("%s %s", method, path)

sc := trace.NewSpanContext(trace.SpanContextConfig{
TraceID: e.SpanContext.TraceID,
Expand All @@ -202,7 +204,7 @@ func (h *Instrumentor) convertEvent(e *Event) *events.Event {

return &events.Event{
Library: h.LibraryName(),
Name: path,
Name: name,
Kind: trace.SpanKindServer,
StartTime: int64(e.StartTime),
EndTime: int64(e.EndTime),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"os"

"go.opentelemetry.io/auto/pkg/instrumentors/bpffs"
Expand Down Expand Up @@ -180,6 +181,7 @@ func (g *Instrumentor) Run(eventsChan chan<- *events.Event) {
func (g *Instrumentor) convertEvent(e *Event) *events.Event {
method := unix.ByteSliceToString(e.Method[:])
path := unix.ByteSliceToString(e.Path[:])
name := fmt.Sprintf("%s %s", method, path)

sc := trace.NewSpanContext(trace.SpanContextConfig{
TraceID: e.SpanContext.TraceID,
Expand All @@ -189,7 +191,7 @@ func (g *Instrumentor) convertEvent(e *Event) *events.Event {

return &events.Event{
Library: g.LibraryName(),
Name: path,
Name: name,
Kind: trace.SpanKindServer,
StartTime: int64(e.StartTime),
EndTime: int64(e.EndTime),
Expand Down
4 changes: 3 additions & 1 deletion pkg/instrumentors/bpf/net/http/server/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"os"

"go.opentelemetry.io/auto/pkg/instrumentors/bpffs"
Expand Down Expand Up @@ -191,6 +192,7 @@ func (h *Instrumentor) Run(eventsChan chan<- *events.Event) {
func (h *Instrumentor) convertEvent(e *Event) *events.Event {
method := unix.ByteSliceToString(e.Method[:])
path := unix.ByteSliceToString(e.Path[:])
name := fmt.Sprintf("%s %s", method, path)

sc := trace.NewSpanContext(trace.SpanContextConfig{
TraceID: e.SpanContext.TraceID,
Expand All @@ -200,7 +202,7 @@ func (h *Instrumentor) convertEvent(e *Event) *events.Event {

return &events.Event{
Library: h.LibraryName(),
Name: path,
Name: name,
Kind: trace.SpanKindServer,
StartTime: int64(e.StartTime),
EndTime: int64(e.EndTime),
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gin/traces.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
],
"kind": 2,
"name": "/hello-gin",
"name": "GET /hello-gin",
"parentSpanId": "",
"spanId": "xxxxx",
"status": {},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gorillamux/traces.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
],
"kind": 2,
"name": "/users/foo",
"name": "GET /users/foo",
"parentSpanId": "",
"spanId": "xxxxx",
"status": {},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/nethttp/traces.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
],
"kind": 2,
"name": "/hello",
"name": "GET /hello",
"parentSpanId": "",
"spanId": "xxxxx",
"status": {},
Expand Down

0 comments on commit d7606e8

Please sign in to comment.