mirror of
https://github.com/googleforgames/open-match.git
synced 2025-03-25 13:24:18 +00:00
Fix OpenConcensus backend_matches_fetched metric (#829)
* Fix open concensus backend_matches_fetched metric * Update
This commit is contained in:
@ -99,7 +99,8 @@ func (s *backendService) FetchMatches(req *pb.FetchMatchesRequest, stream pb.Bac
|
||||
case <-stream.Context().Done():
|
||||
return stream.Context().Err()
|
||||
default:
|
||||
err := stream.Send(&pb.FetchMatchesResponse{Match: result})
|
||||
err = stream.Send(&pb.FetchMatchesResponse{Match: result})
|
||||
telemetry.IncrementCounter(stream.Context(), mMatchesFetched)
|
||||
if err != nil {
|
||||
logger.WithError(err).Error("failed to stream back the response")
|
||||
return err
|
||||
@ -107,7 +108,6 @@ func (s *backendService) FetchMatches(req *pb.FetchMatchesRequest, stream pb.Bac
|
||||
}
|
||||
}
|
||||
|
||||
telemetry.IncrementCounterN(stream.Context(), mMatchesFetched, len(results))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ func SetGauge(ctx context.Context, s *stats.Int64Measure, n int, tags ...tag.Mut
|
||||
|
||||
// Counter creates a counter metric.
|
||||
func Counter(name string, description string, tags ...tag.Key) *stats.Int64Measure {
|
||||
s := stats.Int64(name, "Count of "+description+".", "1")
|
||||
s := stats.Int64(name, "Count of "+description+".", stats.UnitDimensionless)
|
||||
counterView(s, tags...)
|
||||
return s
|
||||
}
|
||||
@ -52,11 +52,10 @@ func IncrementCounter(ctx context.Context, s *stats.Int64Measure, tags ...tag.Mu
|
||||
|
||||
// IncrementCounterN increases a metric by n.
|
||||
func IncrementCounterN(ctx context.Context, s *stats.Int64Measure, n int, tags ...tag.Mutator) {
|
||||
mCtx, err := tag.New(ctx, tags...)
|
||||
if err != nil {
|
||||
if err := stats.RecordWithTags(ctx, tags, s.M(int64(n))); err != nil {
|
||||
logger.WithError(err).Infof("cannot record stat with tags %#v", tags)
|
||||
return
|
||||
}
|
||||
stats.Record(mCtx, s.M(int64(n)))
|
||||
}
|
||||
|
||||
// gaugeView converts the measurement into a view for a gauge metric.
|
||||
|
Reference in New Issue
Block a user