-
Notifications
You must be signed in to change notification settings - Fork 164
Version v2.0.0 - draft #63
Version v2.0.0 - draft #63
Conversation
Codecov Report
@@ Coverage Diff @@
## draft-v2.0.0 #63 +/- ##
=================================================
- Coverage 78.59% 55.34% -23.26%
=================================================
Files 8 9 +1
Lines 271 374 +103
=================================================
- Hits 213 207 -6
- Misses 49 157 +108
- Partials 9 10 +1
Continue to review full report at Codecov.
|
Thanks for this, but why are you changing all in same PR? ((: Basically would be nice to discuss each of change separately. Some of them sounds good from first glance, some are not that obvious:
|
@bwplotka Yes PR is intentionally way bigger than we agreed on. I would like to explore what are necessary public API changes.
AFAIK it is recommended to use gauges instead of direct arithmetic on counters: prometheus/client_golang#101 (comment). Having a reliable source for example for predict_linear is necessary. Does anything change regarding counters recently, are they reliable for those usecasese?
You are right, backward compatibility and configurability should be kept. On another hand, current public API seems to be a little bit inconsistent. Prometheus authors got into the same conclusion when it comes to HTTP monitoring. By following a similar approach like in promhttp new public API could be kept backwards compatible and allow an even higher level of configurability. It could be implemented like: func Dialer(*prometheus.CounterVec) func(string, time.Duration) (net.Conn, error) {}
type InFlightStatsHandler struct {
stats.Handler
}
type Subsystem int
var (
Server Subsystem = 1
Client Subsystem = 2
)
// NewInFlightGaugeVecV1 exists for backward compatibility.
func NewInFlightGaugeVecV1(Subsystem) *prometheus.GaugeVec {}
func NewInFlightGaugeVec(Subsystem) *prometheus.GaugeVec {}
// NewInFlightStatsHandler ...
// The GaugeVec must have zero, one, two, three or four non-const non-curried labels.
// For those, the only allowed label names are "fail_fast", "handler", "service" and "user_agent".
func NewInFlightStatsHandler(Subsystem, *prometheus.GaugeVec) *InFlightStatsHandler {}
type StatsHandler struct {
stats.Handler
prometheus.Collector
}
// NewStatsHandler allows to pass various number of handlers.
func NewStatsHandler(...stats.Handler) *StatsHandler {} This draft presents a low-level public API. Plenty of handful function could be implemented on the top of it to make the library easier to use if custom configuration or backward compatibility is not required.
Example: ssh := NewStatsHandler(
NewConnectionsStatsHandler(Server, NewConnectionsGaugeVec(Server)),
NewInFlightStatsHandler(Server, NewInFlightGaugeVec(Server)),
)
csh := NewStatsHandler(
NewConnectionsStatsHandler(Client, NewConnectionsGaugeVec(Client)),
NewInFlightStatsHandler(Client, NewInFlightGaugeVec(Client)),
)
prometheus.DefaultRegisterer.MustRegister(ssh)
prometheus.DefaultRegisterer.MustRegister(csh) |
I think cutting a major release is exactly for the ability to break the API for positive changes. I think the changes to make the structs actually comply with I think splitting the in-flight gauge into two counters for started and finished counters would might more sense. |
d784bec
to
ce2a716
Compare
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
381aceb
to
16eccd4
Compare
16eccd4
to
28015bb
Compare
CLAs look good, thanks! |
We're starting using grpc_prometheus and would be great to have this already. Any blockers? |
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.
Sorry for taking so long until having a look at this again.
I'm not against a cleanup per se, but some things like
msg_sent_total -> sent_messages_total
seem like they're mostly style, and I wouldn't break that if not for a better reason. I think request/response and duration metrics should follow the best practices and we shouldn't have global state at all in my opinion. I don't think I agree with the "shared struct" approach, as the amount of switch/case statements show I think we're better off with treating client and server separately.
|
||
var ( | ||
Server Subsystem = 1 | ||
Client Subsystem = 2 |
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.
this seems unnecessary, why not do distinct functions/structs for server/client here?
+1 for @brancz What exactly would be nice @pacoguzman? Just different metric names? Or anything in particular? For metrics name, I think it would be nice to have, but it feels like a lot of effort for users to switch to new metrics for not really high value (IMO). Even with v2, it is really hard for users to switch all the monitoring I can agree with other improvements like code API etc - we might be able to improve things here & there. That we can definitely focus on the straightaway. But knowing what you are looking for @pacoguzman would be nice (:
Well @piotrkowalczuk , what I meant that you cannot replace really I would say let's split the work and discuss those separately. Given the limited time we have, I would focus on what's heavily needed by users of this library first. (: |
Thanks, @brancz @bwplotka for having a look! This PR is slightly outdated. My current state of work/design choices can be found here: https://godoc.org/github.com/piotrkowalczuk/promgrpc/v4 I'll leave a few notes before this PR is closed:
IMHO the goal should be to introduce consistent naming with the ability to use legacy one. e.g. by having additional constructors. |
This PR is related to #60, it introduces:
monitor
struct.started_total
->requests_total
handled_total
->responses_total
msg_received_total
->received_messages_total
msg_sent_total
->sent_messages_total
in_flight_requests
// partiallyconnections
// partiallyhandling_seconds
->request_duration_histogram_seconds
clientReporter
API become privateCounterOption
andHistogramOption
replaced byCollectorOption
breakingWithConstLabels
WithNamespace
WithSubsystem
WithBuckets
TODO:
[ ] if accepted, apply similar changes to
ServerMetrics