-
Notifications
You must be signed in to change notification settings - Fork 616
HDDS-15552. Ratis events should not be published as metrics #10523
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
Changes from all commits
4b67db7
8fba2b6
d109239
6ea9137
fc5d81b
3eab08d
e200d93
9fd803d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| *** Settings *** | ||
| Documentation Test Prometheus monitoring integration | ||
| Library OperatingSystem | ||
| Library BuiltIn | ||
| Resource ../commonlib.robot | ||
|
|
||
| *** Test Cases *** | ||
| Verify Prometheus targets are healthy | ||
| Wait Until Keyword Succeeds 90sec 10sec Check Prometheus Targets Health | ||
|
|
||
| *** Keywords *** | ||
| Check Prometheus Targets Health | ||
| ${result} = Execute python3 ${OZONE_DIR}/smoketest/prometheus/prometheus_check.py | ||
| Should Contain ${result} Successfully verified |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| #!/usr/bin/env python3 | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import urllib.request | ||
| import json | ||
| import sys | ||
| import socket | ||
|
|
||
| def is_running(host, port): | ||
| try: | ||
| with socket.create_connection((host, int(port)), timeout=2): | ||
| return True | ||
| except Exception: | ||
| return False | ||
|
|
||
| def main(): | ||
| try: | ||
| res = urllib.request.urlopen("http://prometheus:9090/api/v1/targets") | ||
| data = json.loads(res.read().decode()) | ||
| targets = data.get("data", {}).get("activeTargets", []) | ||
| if not targets: | ||
| print("No active targets found in Prometheus") | ||
| sys.exit(1) | ||
|
|
||
| failed = False | ||
| checked = 0 | ||
| for t in targets: | ||
| url = t.get("scrapeUrl", "") | ||
| # scrapeUrl is like "http://scm:9876/prom" | ||
| try: | ||
| host_port = url.split("//")[1].split("/")[0] | ||
| if ":" in host_port: | ||
| host, port = host_port.split(":") | ||
| else: | ||
| host = host_port | ||
| port = 80 | ||
| except Exception: | ||
| continue | ||
|
|
||
| if is_running(host, port): | ||
| checked += 1 | ||
| health = t.get("health", "") | ||
| print(f"Target {host}:{port} is running. Prometheus health: {health}") | ||
| if health != "up": | ||
| print(f"Error: Target {host}:{port} is running but Prometheus health is '{health}'. Last error: {t.get('lastError')}") | ||
| failed = True | ||
| else: | ||
| print(f"Target {host}:{port} is not running. Skipping check.") | ||
|
|
||
| if checked == 0: | ||
| print("Error: No running targets were checked!") | ||
| sys.exit(1) | ||
|
|
||
| if failed: | ||
| sys.exit(1) | ||
|
|
||
| print(f"Successfully verified {checked} running targets.") | ||
| except Exception as e: | ||
| print(f"Exception during health check: {e}") | ||
| sys.exit(1) | ||
|
|
||
| if __name__ == "__main__": | ||
| main() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3309,6 +3309,11 @@ public String getHostname() { | |
| return omHostName; | ||
| } | ||
|
|
||
| @Override | ||
| public String getRatisEvents() { | ||
| return metrics != null ? metrics.getRatisEvents() : ""; | ||
| } | ||
|
Comment on lines
+3312
to
+3315
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a legit suggestion
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For SCM it is simple, because TestSCMMXBean already exists, but there is no test for OMMXBean currently. So this could be a follow-up.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created HDDS-15761. |
||
|
|
||
| @VisibleForTesting | ||
| public OzoneManagerHttpServer getHttpServer() { | ||
| return httpServer; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.