Skip to content
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

Use K8S metric wrapper #750

Merged
merged 1 commit into from
May 28, 2020
Merged

Use K8S metric wrapper #750

merged 1 commit into from
May 28, 2020

Conversation

ksamoray
Copy link
Contributor

@ksamoray ksamoray commented May 28, 2020

Kubernetes implements a wrapper for Prometheus, providing several
additional features such as metric deprecation and stability
information.
The patch is using this wrapper to expose metrics.
This also works around breakage due to upgrade of apiserver.
Fixes #734
Fixes #662

@antrea-bot
Copy link
Collaborator

Thanks for your PR.
Unit tests and code linters are run automatically every time the PR is updated.
E2e, conformance and network policy tests can only be triggered by a member of the vmware-tanzu organization. Regular contributors to the project should join the org.

The following commands are available:

  • /test-e2e: to trigger e2e tests.
  • /skip-e2e: to skip e2e tests.
  • /test-conformance: to trigger conformance tests.
  • /skip-conformance: to skip conformance tests.
  • /test-networkpolicy: to trigger networkpolicy tests.
  • /skip-networkpolicy: to skip networkpolicy tests.
  • /test-windows-conformance: to trigger windows conformance tests.
  • /skip-windows-conformance: to skip windows conformance tests.
  • /test-all: to trigger all tests.
  • /skip-all: to skip all tests.

These commands can only be run by members of the vmware-tanzu organization.

@ksamoray ksamoray requested a review from tnqn May 28, 2020 11:05
@tnqn
Copy link
Member

tnqn commented May 28, 2020

The code doesn't meet go fmt, otherwise LGTM.

I found "Fixes #xx #xx" cannot close multiple issues. Instead, this might work according to https://help.github.com/en/enterprise/2.16/user/github/managing-your-work-on-github/closing-issues-using-keywords#closing-multiple-issues:
"Fixes #xx"
"Fixes #xx"

Kubernetes implements a wrapper for Prometheus, providing several
additional features such as metric deprecation and stability
information.
The patch is using this wrapper to expose metrics.
@ksamoray
Copy link
Contributor Author

Thanks @tnqn I've addressed the above.

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ksamoray
Copy link
Contributor Author

/test-all

@ksamoray
Copy link
Contributor Author

/test-conformance


ovsStats := newOVSStatManager(ovsBridge, ofClient)
if err := prometheus.Register(ovsStats); err != nil {
if err := legacyregistry.RawRegister(ovsStats); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why RawRegister is used instead of Register in couple of places?
RawRegister looks to be deprecated from v0.18 k8s release.
kubernetes/kubernetes@214228f

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ksamoray I agree with Srikar. Looks like we should be able to use Register instead of RawRegister with some minor changes (it seems that it should already work for antrea_agent_local_pod_count but that some minor changes are required for antrea_agent_ovs_flow_table). If the changes are not minor or cannot be done this week (for 0.7 release), we can punt them to a future PR and merge this as is.

@ksamoray
Copy link
Contributor Author

@antoninbas @srikartati tried to get rid of this, also getting rid of using prometheus.MustNewConstMetric() as the metrics wrapper offers its own implementation.
Both @tnqn and myself tried this...
Seems like wrapper implementation is incomplete with these methods.

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ksamoray ok let's merge it as is. Would you mind opening a new issue with your observations regarding the use of RawRegister, so we can keep track of progress on this and potential issues related to updating the k8s libraries version we use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Antrea metrics disappeared with introduction of PR #727 Use K8S Prometheus stability wrapper
6 participants