Skip to content

Commit

Permalink
Merge pull request #309 from 2beens/honeycomb-baggage-deprecation-update
Browse files Browse the repository at this point in the history
feat: honeycomb baggage deprecation update
  • Loading branch information
2beens authored Jun 30, 2024
2 parents 7bfa758 + f4b7f71 commit 4a83365
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/go-redis/redismock/v8 v8.11.5
github.com/golang/mock v1.6.0
github.com/gorilla/mux v1.8.1
github.com/honeycombio/honeycomb-opentelemetry-go v0.11.0
github.com/honeycombio/otel-config-go v1.15.0
github.com/ipinfo/go/v2 v2.10.0
github.com/jackc/pgx/v5 v5.6.0
Expand All @@ -26,6 +25,7 @@ require (
github.com/stretchr/testify v1.9.0
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.49.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0
go.opentelemetry.io/contrib/processors/baggage/baggagetrace v0.0.0-20240508140322-077e60990642
go.opentelemetry.io/otel v1.26.0
go.uber.org/goleak v1.3.0
go.uber.org/mock v0.4.0
Expand Down Expand Up @@ -63,8 +63,6 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.opentelemetry.io/contrib/processors/baggage/baggagetrace v0.0.0-20240508140322-077e60990642 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.26.0 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM=
github.com/honeycombio/honeycomb-opentelemetry-go v0.11.0 h1:x0DndAGP+m1rk9JrlPLnrnAjJotoq/EbWtg9agwnl7I=
github.com/honeycombio/honeycomb-opentelemetry-go v0.11.0/go.mod h1:2DZt7DdTnnd1o7biwC9Ab0Z3OAGXId56gYVPR7LsLQs=
github.com/honeycombio/otel-config-go v1.15.0 h1:wUiYG2gGaQEmyZeMMLCb14bx1DR/rxOylkZ05YWN1Jg=
github.com/honeycombio/otel-config-go v1.15.0/go.mod h1:9s9M2qozR0OfVCvTMEQBLMglo1SzuRTxulsU0i/NIkA=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down Expand Up @@ -291,8 +289,6 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.25.0 h1:vOL89
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.25.0/go.mod h1:8GlBGcDk8KKi7n+2S4BT/CPZQYH3erLu0/k64r1MYgo=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.25.0 h1:Mbi5PKN7u322woPa85d7ebZ+SOvEoPvoiBu+ryHWgfA=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.25.0/go.mod h1:e7ciERRhZaOZXVjx5MiL8TK5+Xv7G5Gv5PA2ZDEJdL8=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.26.0 h1:0W5o9SzoR15ocYHEQfvfipzcNog1lBxOLfnex91Hk6s=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.26.0/go.mod h1:zVZ8nz+VSggWmnh6tTsJqXQ7rU4xLwRtna1M4x5jq58=
go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30=
go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4=
go.opentelemetry.io/otel/sdk v1.4.1/go.mod h1:NBwHDgDIBYjwK2WNu1OPgsIc2IJzmBXNnvIJxJc8BpE=
Expand Down
8 changes: 8 additions & 0 deletions internal/gymstats/exercises/exercises_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"strconv"
"time"
Expand All @@ -13,6 +14,7 @@ import (

"github.com/gorilla/mux"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/attribute"
)

//go:generate mockgen -source=$GOFILE -destination=exercises_mocks_test.go -package=exercises_test
Expand Down Expand Up @@ -129,8 +131,14 @@ func (handler *Handler) HandleAdd(w http.ResponseWriter, r *http.Request) {
lastEx := listRes[0]
timeSincePreviousSet := addedExercise.CreatedAt.Sub(lastEx.CreatedAt)
minutesSincePreviousSet = timeSincePreviousSet.Minutes()
span.AddEvent(fmt.Sprintf("previous exercise found: %+v", listRes[0]))
span.AddEvent(fmt.Sprintf("time since previous set: %s", timeSincePreviousSet))
} else {
span.AddEvent("no previous exercise found")
}

span.SetAttributes(attribute.Float64("minutesSincePreviousSet", minutesSincePreviousSet))

addExerciseResponse := AddExerciseResponse{
Exercise: *addedExercise,
CountToday: len(exercisesToday),
Expand Down
4 changes: 2 additions & 2 deletions internal/telemetry/tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/go-redis/redis/extra/redisotel/v8"
"github.com/go-redis/redis/v8"
"github.com/honeycombio/honeycomb-opentelemetry-go"
"github.com/honeycombio/otel-config-go/otelconfig"
"go.opentelemetry.io/contrib/processors/baggage/baggagetrace"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
Expand Down Expand Up @@ -38,7 +38,7 @@ func HoneycombSetup(
}

// enable multi-span attributes
bsp := honeycomb.NewBaggageSpanProcessor()
bsp := baggagetrace.New()

// use honeycomb distro to set up OpenTelemetry SDK
shutdownFunc, err := otelconfig.ConfigureOpenTelemetry(
Expand Down

0 comments on commit 4a83365

Please sign in to comment.