Skip to content

Commit 4a664ef

Browse files
authored
fix metric (#51)
* fix metric * fix: barry 2024-11-14 21:28:52
1 parent 2030127 commit 4a664ef

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ require (
5757
github.com/keybase/go-ps v0.0.0-20190827175125-91aafc93ba19
5858
github.com/maragudk/gomponents v0.20.0
5959
github.com/prometheus/common v0.48.0
60-
github.com/pubgo/dix v0.3.18
61-
github.com/pubgo/funk v0.5.52
60+
github.com/pubgo/dix v0.3.19
61+
github.com/pubgo/funk v0.5.56
6262
github.com/pubgo/protobuild v0.0.21
6363
github.com/rs/xid v1.5.0
6464
github.com/rs/zerolog v1.33.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,10 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
546546
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
547547
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
548548
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
549-
github.com/pubgo/dix v0.3.18 h1:s7qkJUEuajBF3GhqucE6lv4pDXvfgfZ8CQaFUHnjXWY=
550-
github.com/pubgo/dix v0.3.18/go.mod h1:J0PyuMm7mW6ZrN13l9xz0rtKbzliREFyvb7fuaGYyVw=
551-
github.com/pubgo/funk v0.5.52 h1:u/W7z3i+P6p/QV7mV5vL+OV9SxXPKo1OhQWCPOegAcc=
552-
github.com/pubgo/funk v0.5.52/go.mod h1:kNSD071m7wU4ZXqsE15hqRobC0Pig7HI9Yil+3BESMc=
549+
github.com/pubgo/dix v0.3.19 h1:a4RRmljw7ePUvc9uJKqXXs6JpYL8s3VqPP2NV2vxI9U=
550+
github.com/pubgo/dix v0.3.19/go.mod h1:J0PyuMm7mW6ZrN13l9xz0rtKbzliREFyvb7fuaGYyVw=
551+
github.com/pubgo/funk v0.5.56 h1:LYpjOBDSSeTorRWda0lmf23sJNDm6ZtbbNS0xQjb1CE=
552+
github.com/pubgo/funk v0.5.56/go.mod h1:uAs5IQDz6ovr5zy4LC0Uq7No/eTIbeloSCjF0EQJesw=
553553
github.com/pubgo/opendoc v0.0.5 h1:aM6xkBQ0XMSq8OWytl5JhTMBUv8L+aYQFXd2z9eNkZE=
554554
github.com/pubgo/opendoc v0.0.5/go.mod h1:uO//pJZTJNFEKGuGWrv51/of0EoyxO1il4MuoC3Enp0=
555555
github.com/pubgo/protobuild v0.0.21 h1:QSwh92QxsD6Mv7kQlowzE7fxtcOm1eMWmgADsD803Js=

internal/middlewares/middleware_metric/middleware.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"time"
66

77
"github.com/pubgo/funk/generic"
8-
"github.com/pubgo/funk/running"
9-
"github.com/pubgo/lava/core/lavacontexts"
108
"github.com/uber-go/tally/v4"
119

1210
"github.com/pubgo/lava/core/metrics"
@@ -54,16 +52,6 @@ func (m MetricMiddleware) Middleware(next lava.HandlerFunc) lava.HandlerFunc {
5452

5553
grpcServerRpcCallTotal(m.m, req.Operation())
5654

57-
clientInfo := lavacontexts.GetClientInfo(ctx)
58-
if !req.Client() && clientInfo != nil {
59-
m.m.Tagged(metrics.Tags{
60-
"server_name": running.Project,
61-
"server_method": req.Operation(),
62-
"client_name": clientInfo.GetName(),
63-
"client_method": clientInfo.GetPath(),
64-
}).Counter("grpc_server_info").Inc(1)
65-
}
66-
6755
defer func() {
6856
if !generic.IsNil(gErr) {
6957
grpcServerRpcErrTotal(m.m, req.Operation())

servers/grpcs/request.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type httpRequest struct {
4343

4444
func (r *httpRequest) Kind() string { return "http" }
4545
func (r *httpRequest) Operation() string {
46-
return fmt.Sprintf("%s %s", strings.TrimSpace(r.ctx.Method()), strings.TrimSpace(r.ctx.Path()))
46+
return fmt.Sprintf("%s %s", strings.TrimSpace(r.ctx.Method()), strings.TrimSpace(r.ctx.Route().Path))
4747
}
4848
func (r *httpRequest) Client() bool { return false }
4949
func (r *httpRequest) Header() *lava.RequestHeader { return &r.ctx.Request().Header }

0 commit comments

Comments
 (0)