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

metrics: Set first retrieved metrics to 0 if absent #1864

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

doniacld
Copy link
Contributor

@doniacld doniacld commented Jul 25, 2023

When a cluster is freshly deployed and no traffic was observed, certain metrics does not appear yet. This commit intents to set to 0 the counters of the MetricFamily if the metric was not present.

Testing on a fresh cluster:

No metrics at the beginning, set to 0:

2023/07/25 10:45:42 [WARNING] metric xxx was not found before the action was run
2023/07/25 10:45:42 [WARNING] metric xxx counters was set to 0

Finally checked the metrics properly:

πŸ› Forwarding from [::1]:60476 -> 9967

πŸ› Handling connection for 60476

  πŸ› checked metrics properly on node kind-worker

  πŸ› Finalizing Test external-cilium-dns-proxy
  πŸ› Pod kube-system/cilium-dzmnb's current policy revision: 2
  πŸ› Pod kube-system/cilium-wmvfn's current policy revision: 2
  ℹ️  πŸ“œ Deleting CiliumNetworkPolicy 'dns-via-proxy-for-client' from namespace 'cilium-test'..
  πŸ› Pod kind-kind/kube-system/cilium-dzmnb revision > 2
  πŸ› Pod kind-kind/kube-system/cilium-wmvfn revision > 2
  πŸ› πŸ“œ Successfully deleted 1 CiliumNetworkPolicies

βœ… All 1 tests (4 actions) successful, 54 tests skipped, 0 scenarios skipped.

@doniacld doniacld requested a review from a team as a code owner July 25, 2023 08:09
@doniacld doniacld requested a review from derailed July 25, 2023 08:09
@doniacld doniacld temporarily deployed to ci July 25, 2023 08:09 — with GitHub Actions Inactive
@doniacld doniacld force-pushed the pr/doniacld/metric-0-if-absent branch from 924c162 to a15d5c1 Compare July 25, 2023 12:42
@doniacld doniacld temporarily deployed to ci July 25, 2023 12:42 — with GitHub Actions Inactive
@doniacld doniacld requested a review from a team July 26, 2023 12:49
connectivity/check/metrics.go Outdated Show resolved Hide resolved
connectivity/check/result.go Show resolved Hide resolved
@doniacld doniacld force-pushed the pr/doniacld/metric-0-if-absent branch from a15d5c1 to 12809ee Compare July 27, 2023 11:32
@doniacld doniacld temporarily deployed to ci July 27, 2023 11:32 — with GitHub Actions Inactive
@doniacld doniacld requested a review from gandro July 27, 2023 11:33
Copy link
Member

@gandro gandro left a comment

Choose a reason for hiding this comment

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

Looks good to me overall.

One minor nit (https://github.com/cilium/cilium-cli/pull/1864/files#r1276205954) and one issue with the log package

connectivity/check/result.go Outdated Show resolved Hide resolved
@doniacld doniacld force-pushed the pr/doniacld/metric-0-if-absent branch from c45b2b5 to d36b8dd Compare July 27, 2023 13:24
@doniacld doniacld temporarily deployed to ci July 27, 2023 13:24 — with GitHub Actions Inactive
When a cluster is freshly deployed and no traffic was observed, certain metrics
does not appear yet. This commit intents to assume the default value of the
counters is 0 the counters if the metric is absent.

Signed-off-by: Donia Chaiehloudj <donia.cld@isovalent.com>
@doniacld doniacld force-pushed the pr/doniacld/metric-0-if-absent branch from d36b8dd to 975bc08 Compare July 27, 2023 13:30
@doniacld doniacld temporarily deployed to ci July 27, 2023 13:31 — with GitHub Actions Inactive
Copy link
Contributor

@michi-covalent michi-covalent left a comment

Choose a reason for hiding this comment

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

thank you! πŸ₯°

@michi-covalent michi-covalent merged commit 3006aa5 into cilium:main Jul 27, 2023
19 checks passed
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.

None yet

3 participants