New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metrics: Add MetricBuilder to standardize metrics #3743
Metrics: Add MetricBuilder to standardize metrics #3743
Conversation
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.
you need to vendor in prometheus. try to add that in a separate commit.
15d1fac
to
1ac4cbc
Compare
7ea4e15
to
8e36a95
Compare
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.
Regarding the initializer, perhaps we should consider something similar to this pattern: https://play.golang.org/p/VGl9olSFnNm
This would require setters for label key values and value. Curious if @abhinavdahiya has thoughts.
I think the semantics of this pattern has some nice benefits.
Did see it thanks. Every time I try to solve it, it causes more problems. I will manually fix the entries now. |
210452b
to
0bb52ad
Compare
3353975
to
2aa53f6
Compare
/retest |
1 similar comment
/retest |
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 think this is in really good shape.
}) | ||
} | ||
} | ||
func TestNewMetricBuilder(t *testing.T) { |
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.
Can we add a comment:
TestNewMetricBuilder tests the Metric Builder initializer.
Although I see now that this tests more than the iniitializer. I'm not sure if these are the most useful test cases. They are fine, but they don't test realistic errors/failure modes so I'm not sure if these add much value.
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.
Hmm.. do you have any kind of tests in mind? I thought that since this is just a struct with the metric type, there can only be some kind of validation tests and the significant tests can be done only when the API system is in place.
2aa53f6
to
033e2f1
Compare
/test e2e-aws-upgrade |
2 similar comments
/test e2e-aws-upgrade |
/test e2e-aws-upgrade |
In order to make all the metrics uniform, the MetricBuilder struct type is created with the option for storage, value setting, and a type field. A build function is added which will create the respective Prometheus Collector object based on the type of the MetricBuilder and will automatically set the values and labels to the collector object which can be used for pushing. It also has a field for the description and the full name of the metric for providing information about the metric generated. The field bucket is used only for histogram.
Added the dependencies for prometheus in the vendor folder along with some indirect dependencies.
c2fc9c5
to
7ccc7cb
Compare
@rna-afk: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
/retest Please review the full test history for this PR and help us cut down flakes. |
In order to make all the metrics uniform, the MetricBuilder
struct type is created with the option for storage, value setting,
and a type field. A build function is added which will create the
respective Prometheus Collector object based on the type of the
MetricBuilder and will automatically set the values and labels to
the collector object which can be used for pushing.
It also has a field for the description and the full name of the
metric for providing information about the metric generated. The field
bucket is used only for histogram.