Skip to content

Commit

Permalink
Merge pull request #2 from skit-ai/custom-labels
Browse files Browse the repository at this point in the history
Fix for requests started metric not reporting custom labels
  • Loading branch information
pskrunner14 authored Jul 5, 2023
2 parents 6ecd634 + a879144 commit e2976f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,27 @@ type serverReporter struct {
startTime time.Time
clientUuid string
flowUuid string
first bool
}

func newServerReporter(m *ServerMetrics, rpcType grpcType, fullMethod string) *serverReporter {
r := &serverReporter{
metrics: m,
rpcType: rpcType,
first: true,
}
if r.metrics.serverHandledHistogramEnabled {
r.startTime = time.Now()
}
r.serviceName, r.methodName = splitMethodName(fullMethod)
r.metrics.serverStartedCounter.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName, r.clientUuid, r.flowUuid).Inc()
return r
}

func (r *serverReporter) ReceivedMessage() {
if r.first {
r.metrics.serverStartedCounter.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName, r.clientUuid, r.flowUuid).Inc()
r.first = false
}
r.metrics.serverStreamMsgReceived.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName, r.clientUuid, r.flowUuid).Inc()
if r.metrics.serverHandledHistogramEnabled {
r.startTime = time.Now()
Expand Down

0 comments on commit e2976f6

Please sign in to comment.