-
Notifications
You must be signed in to change notification settings - Fork 288
Add RPC metrics emitter as Observer/SpanObserver #103
Conversation
024fac3
to
f1f36e8
Compare
3472e44
to
2ab6f8e
Compare
rpcmetrics/endpoints.go
Outdated
norm = n.normalizer.Normalize(name) | ||
n.mux.Lock() | ||
defer n.mux.Unlock() | ||
if len(n.names) >= n.maxSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move this check to before we call n.normalizer.Normalize. Why call "Normalize" if we might be over max cache size and we will just return ""?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it so that the call to Normalize is done outside of the exclusive lock. But you're right that if the service ever reaches the upper limit of the cache it will be paying normalization cost for every call.
rpcmetrics/observer.go
Outdated
metricsByEndpoint *MetricsByEndpoint | ||
} | ||
|
||
// NewObserver creates a new observer that can emit RPC metricso. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type: metrico -> metrics
rpcmetrics/observer.go
Outdated
err bool | ||
} | ||
|
||
// NewSpanObserver creates a new SpanObserver that can emit RPC metricso. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
No description provided.