aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorОлег <150132506+iddqdex@users.noreply.github.com>2024-10-03 17:58:02 +0300
committerGitHub <noreply@github.com>2024-10-03 14:58:02 +0000
commit0e414edd1799095b87a3700199b2c8b53cb95088 (patch)
tree16d7444f68bb4e5be32639d9a33818bb745b6173
parent67e9445d528ab28a45db779f118687f229b11051 (diff)
downloadydb-0e414edd1799095b87a3700199b2c8b53cb95088.tar.gz
fix monitoring url (#10044)
-rw-r--r--ydb/tests/olap/lib/allure_utils.py40
-rw-r--r--ydb/tests/olap/lib/ydb_cluster.py27
2 files changed, 54 insertions, 13 deletions
diff --git a/ydb/tests/olap/lib/allure_utils.py b/ydb/tests/olap/lib/allure_utils.py
index 6ea712c6eb..3ee791d500 100644
--- a/ydb/tests/olap/lib/allure_utils.py
+++ b/ydb/tests/olap/lib/allure_utils.py
@@ -4,6 +4,7 @@ from ydb.tests.olap.lib.ydb_cluster import YdbCluster
from ydb.tests.olap.lib.results_processor import ResultsProcessor
from urllib.parse import urlencode
from datetime import datetime
+from copy import deepcopy
def allure_test_description(
@@ -21,29 +22,46 @@ def allure_test_description(
allure.dynamic.title(f'{suite}.{test}')
for body, name, type in attachments:
allure.attach(body, name, type)
- test_info = YdbCluster.get_cluster_info()
+ test_info = deepcopy(YdbCluster.get_cluster_info())
if test_info['name'].startswith('ydb-k8s'):
core_link = f"https://coredumps.n.yandex-team.ru/index?itype=kikimr&host_list={test_info['nodes_wilcard']}&show_fixed=True"
else:
core_link = f"https://kikimr-cores.n.yandex-team.ru/show?server={test_info['nodes_wilcard']}%2A"
- monitoring_cluster = (
- YdbCluster.monitoring_cluster if YdbCluster.monitoring_cluster is not None else test_info['name']
- )
+ del test_info['nodes_wilcard']
test_info.update(addition_table_strings)
+ monitoring_start = int((start_time) * 1000)
+ monitoring_end = int((end_time) * 1000)
+ # monitoring does not show intervals less 1 minute.
+ monitoring_addition = 60000 - (monitoring_end - monitoring_start)
+ if monitoring_addition > 0:
+ monitoring_start -= monitoring_addition
+ monitoring_end += monitoring_addition
+
+ service_url = YdbCluster._get_service_url()
+
+ def _get_monitoring_link(monitoring: YdbCluster.MonitoringUrl):
+ return f"<a target='_blank' href='{monitoring.url.format(
+ database='/' + test_info['database'],
+ start_time=monitoring_start,
+ end_time=monitoring_end
+ )}'>{monitoring.caption}</a>"
+
+ monitoring = ', '.join([
+ _get_monitoring_link(monitoring)
+ for monitoring in YdbCluster.get_monitoring_urls()
+ ])
+
test_info.update(
{
'table_path': YdbCluster.tables_path,
- 'monitoring': (
- f"<a target='_blank' href='https://monitoring.yandex-team.ru/projects/kikimr/dashboards/mone0310v4dbc6kui89v?"
- f"p.cluster={monitoring_cluster}&p.database=/{test_info['database']}&from={int(start_time * 1000)}&to={int(end_time * 1000)}'>link</a>"
- ),
+ 'monitoring': monitoring,
'coredumps': f"<a target='_blank' href='{core_link}'>link</a>",
'db_admin': (
- f"<a target='_blank' href='{test_info['service_url']}/monitoring/tenant?"
+ f"<a target='_blank' href='{service_url}/monitoring/tenant?"
f"schema=/{test_info['database']}/{YdbCluster.tables_path}&tenantPage=query"
- f"&diagnosticsTab=nodes&name=/{test_info['database']}'>link</a>"
+ f"&diagnosticsTab=nodes&name=/{test_info['database']}'>{service_url}</a>"
),
- 'timestamp': datetime.now().strftime('%c'),
+ 'time': f"{datetime.fromtimestamp(start_time).strftime('%a %d %b %y %H:%M:%S')} - {datetime.fromtimestamp(end_time).strftime('%H:%M:%S')}",
}
)
if ResultsProcessor.send_results:
diff --git a/ydb/tests/olap/lib/ydb_cluster.py b/ydb/tests/olap/lib/ydb_cluster.py
index 87d59f8ebd..d9b459734d 100644
--- a/ydb/tests/olap/lib/ydb_cluster.py
+++ b/ydb/tests/olap/lib/ydb_cluster.py
@@ -13,13 +13,37 @@ LOGGER = logging.getLogger()
class YdbCluster:
+ class MonitoringUrl:
+ def __init__(self, url: str, caption: str = 'link') -> None:
+ self.url = url
+ if self.url.find('://') < 0:
+ self.url = f'https://{self.url}'
+ self.caption = caption
+
_ydb_driver = None
_results_driver = None
_cluster_info = None
ydb_endpoint = get_external_param('ydb-endpoint', 'grpc://ydb-olap-testing-vla-0002.search.yandex.net:2135')
ydb_database = get_external_param('ydb-db', 'olap-testing/kikimr/testing/acceptance-2').lstrip('/')
tables_path = get_external_param('tables-path', 'olap_yatests')
- monitoring_cluster = get_external_param('monitoring_cluster', 'olap_testing_vla')
+ _monitoring_urls: list[YdbCluster.MonitoringUrl] = None
+
+ @classmethod
+ def get_monitoring_urls(cls) -> list[YdbCluster.MonitoringUrl]:
+ def _process_url(url: str) -> YdbCluster.MonitoringUrl:
+ spl = url.split('::', 2)
+ if len(spl) == 1:
+ return YdbCluster.MonitoringUrl(spl[0])
+ return YdbCluster.MonitoringUrl(spl[1], spl[0])
+ if cls._monitoring_urls is None:
+ cls._monitoring_urls = [
+ _process_url(url)
+ for url in get_external_param('monitoring_urls', (
+ 'monitoring.yandex-team.ru/projects/kikimr/dashboards/mone0310v4dbc6kui89v?'
+ 'p.cluster=olap_testing_vla&p.database=/{database}&from={start_time}&to={end_time}')
+ ).split(',')
+ ]
+ return cls._monitoring_urls
@classmethod
def _get_service_url(cls):
@@ -66,7 +90,6 @@ class YdbCluster:
'version': version,
'name': cluster_name,
'nodes_wilcard': nodes_wilcard,
- 'service_url': cls._get_service_url(),
}
return deepcopy(cls._cluster_info)