Skip to content

Commit

Permalink
feat: trace request duration (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
crlssn authored Nov 27, 2024
1 parent 17b2d7e commit 68d3d28
Show file tree
Hide file tree
Showing 8 changed files with 1,074 additions and 3 deletions.
8 changes: 8 additions & 0 deletions database/migrations/014_request_traces.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CREATE TABLE getstronger.traces
(
id UUID PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
request TEXT NOT NULL,
status_code INT NOT NULL,
duration_ms INT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT (NOW() AT TIME ZONE 'UTC')
);
2 changes: 2 additions & 0 deletions server/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/crlssn/getstronger/server/pkg/db"
"github.com/crlssn/getstronger/server/pkg/jwt"
"github.com/crlssn/getstronger/server/pkg/repo"
"github.com/crlssn/getstronger/server/pkg/trace"
"github.com/crlssn/getstronger/server/rpc"
)

Expand All @@ -33,6 +34,7 @@ func options() []fx.Option {
zap.NewDevelopment,
repo.New,
grpc.NewServer,
trace.NewTracer,
config.New,
protovalidate.New,
),
Expand Down
2 changes: 2 additions & 0 deletions server/pkg/orm/boil_table_names.go

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

Loading

0 comments on commit 68d3d28

Please sign in to comment.