-
Notifications
You must be signed in to change notification settings - Fork 368
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
Support enabling the query_log_file
config for Prometheus
#1373
Conversation
Skipping CI for Draft Pull Request. |
aa7c7f5
to
4a3d124
Compare
query_log_file
config for Prometheus
test/e2e/config_test.go
Outdated
@@ -794,6 +800,10 @@ func TestUserWorkloadMonitorPrometheusK8Config(t *testing.T) { | |||
name: "assert remote write url value in set in CR", | |||
f: assertRemoteWriteWasSet(f.UserWorkloadMonitoringNs, crName, "https://test.remotewrite.com/api/write"), | |||
}, | |||
{ | |||
name: "assert query log file value is set and correct", |
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.
Should we also have a test that validates that after query_log_file is set, and then reset, the queryLogFile becomes ""
?
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.
personally I don' think so, because we don't do it for any other config option and not entirely sure we should treat this any differently.
e2e tests are expensive time wise, and I feel we already rely on them more heavily than we should. Testing the happy path in e2e tests is sufficient in my mind unless its critical we cover other cases.
Having said that, lets leave it open and see what others think.
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.
Do we require a e2e test for this ? Can't this be done in the manifest_test.go
itself or is it already a path that is tested?
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.
It's already a path that is tested. The pattern as of now in regards to config is that we test the happy path as is the case with this test.
I did already add a unit test in manifest_test.go
for same.
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.
/lgtm
some minor comments that you may want to address
/retest |
4a3d124
to
df5d25a
Compare
/retest |
/skip |
/retest |
1 similar comment
/retest |
/lgtm |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest-required Please review the full test history for this PR and help us cut down flakes. |
9640f56
to
e20c50e
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.
/lgtm
/retest-required Please review the full test history for this PR and help us cut down flakes. |
@sferich888 another nudge on this one for px-approval if we could? |
Prometheus and via prometheus-operator, provide the ability to log all PromQL queries to a file. This change enables CMO to support passing through that feature to Prometheus CR and the Prometheus pod for both platform monitoring and UWM. https://prometheus.io/docs/guides/query-log/
We want to allow cluster admins to enable the query log, however it should be noted that this is a temporary solution for debugging situations ad-hoc and should not be enabled permanently. https://prometheus.io/docs/guides/query-log/
e20c50e
to
0da2132
Compare
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: PhilipGough, prashbnair, simonpasquier, sthaha 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 |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest |
1 similar comment
/retest |
/label px-approved |
@philipgough
|
tested with the PR, enabled UWM and set queryLogFile for openshift-monitoring prometheus and UWM prometheus, we can see the query logs for openeshift-monitoring prometheus, but can not find from UWM prometheus
and
create prometheusrules under user namespace
|
@juzhao no, we have no limit for it. We will explicitly call this out in the docs and this should be enabled only as a temporary troubleshooting solution -> https://github.com/openshift/openshift-docs/pull/36495/files#diff-c934df74a3d8f522bb7fae910d0e0b4cb8f5a92facbe61d093a16297e8c9803dR12 |
@juzhao - following your exact config I am not seeing the same behaviour when this PR is deployed: oc -n openshift-user-workload-monitoring exec -c prometheus prometheus-user-workload-0 -- cat /etc/prometheus/config_out/prometheus.env.yaml produces (shortened) output showing the configmap has set the correct config as per https://prometheus.io/docs/guides/query-log/#logging-all-the-queries-to-a-file global:
evaluation_interval: 30s
scrape_interval: 30s
external_labels:
prometheus: openshift-user-workload-monitoring/user-workload
prometheus_replica: prometheus-user-workload-0
query_log_file: /tmp/test-uwm.log
rule_files:
- /etc/prometheus/rules/prometheus-user-workload-rulefiles-0/*.yaml
scrape_configs: [] Run the following query: oc -n openshift-user-workload-monitoring exec -c prometheus prometheus-user-workload-0 -- curl 'http://localhost:9090/api/v1/query?query=up'
Followed by: oc -n openshift-user-workload-monitoring exec -c prometheus prometheus-user-workload-0 -- cat /tmp/test-uwm.log | jq Results in: {
"httpRequest": {
"clientIP": "127.0.0.1",
"method": "GET",
"path": "/api/v1/query"
},
"params": {
"end": "2021-11-24T11:32:15.595Z",
"query": "up",
"start": "2021-11-24T11:32:15.595Z",
"step": 0
},
"stats": {
"timings": {
"evalTotalTime": 3.5229e-05,
"resultSortTime": 0,
"queryPreparationTime": 2.2002e-05,
"innerEvalTime": 7.712e-06,
"execQueueTime": 7.8172e-05,
"execTotalTime": 0.000137558
}
},
"ts": "2021-11-24T11:32:15.595Z"
|
/label qe-approved |
Enables setting https://prometheus.io/docs/guides/query-log/#enable-the-query-log on/off via the ConfigMap for both platform and user workload monitoring.