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

Fix: Handle float apiserver buckets #965

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SuperQ
Copy link
Contributor

@SuperQ SuperQ commented Jul 31, 2024

Depending on the version of client_golang and metrics format (Prometheus vs OpenMetrics), bucket names may contain either integer or float formatting.

Use a regexp match to select either format.

@povilasv
Copy link
Contributor

We have some lint failures

Depending on the version of client_golang and metrics format (Prometheus vs OpenMetrics), bucket names may contain either integer or float formatting.

Use a regexp match to select either format.

Signed-off-by: SuperQ <[email protected]>
@povilasv
Copy link
Contributor

povilasv commented Sep 3, 2024

@SuperQ FYI CI is still failing

Comment on lines +11 to +14
kubeApiserverReadResourceLatency: '1(\.0)?',
kubeApiserverReadNamespaceLatency: '5(\.0)?',
kubeApiserverReadClusterLatency: '30(\.0)?',
kubeApiserverWriteLatency: '1(\.0)?',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
kubeApiserverReadResourceLatency: '1(\.0)?',
kubeApiserverReadNamespaceLatency: '5(\.0)?',
kubeApiserverReadClusterLatency: '30(\.0)?',
kubeApiserverWriteLatency: '1(\.0)?',
kubeApiserverReadResourceLatency: '1(.0)?',
kubeApiserverReadNamespaceLatency: '5(.0)?',
kubeApiserverReadClusterLatency: '30(.0)?',
kubeApiserverWriteLatency: '1(.0)?',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That doesn't seem correct. We need to escape the . in order to have a literal . match instead of a regexp any character match.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Of course, you're right @SuperQ. What you need instead then is to double-double-escape! i.e.

-    kubeApiserverReadResourceLatency: '1(\.0)?',
-    kubeApiserverReadNamespaceLatency: '5(\.0)?',
-    kubeApiserverReadClusterLatency: '30(\.0)?',
-    kubeApiserverWriteLatency: '1(\.0)?',
+    kubeApiserverReadResourceLatency: '1(\\\\.0)?',
+    kubeApiserverReadNamespaceLatency: '5(\\\\.0)?',
+    kubeApiserverReadClusterLatency: '30(\\\\.0)?',
+    kubeApiserverWriteLatency: '1(\\\\.0)?',

which would produce queries like:

sum by (cluster) (cluster_verb_scope_le:apiserver_request_sli_duration_seconds_bucket:increase30d{verb=~"POST|PUT|PATCH|DELETE",le=~"1(\\.0)?"})

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.

3 participants