Skip to content

Commit

Permalink
🔧 #220 Instrument API server (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest authored May 12, 2024
1 parent 321b002 commit 3b37d0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.5.6
github.com/go-playground/validator/v10 v10.17.0
github.com/gofiber/contrib/fiberzap/v2 v2.1.2
github.com/gofiber/contrib/otelfiber v1.0.10
github.com/gofiber/contrib/websocket v1.3.0
github.com/gofiber/fiber/v2 v2.52.2
github.com/gofiber/swagger v1.0.0
Expand Down Expand Up @@ -78,6 +79,7 @@ require (
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.52.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
go.opentelemetry.io/contrib v1.17.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.26.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.26.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.26.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/api/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/EinStack/glide/docs"

"github.com/gofiber/contrib/fiberzap/v2"
"github.com/gofiber/contrib/otelfiber"

_ "github.com/EinStack/glide/docs" // importing docs package to include them into the binary

Expand All @@ -30,6 +31,7 @@ type Server struct {

func NewServer(config *ServerConfig, tel *telemetry.Telemetry, routerManager *routers.RouterManager) (*Server, error) {
srv := config.ToServer()
srv.Use(otelfiber.Middleware())

return &Server{
config: config,
Expand Down

0 comments on commit 3b37d0b

Please sign in to comment.