mirror of
https://github.com/SigNoz/signoz.git
synced 2026-02-03 08:33:26 +00:00
chore: adding JSON body logs integration suite (#9923)
* feat: adding JSON body logs testing * chore: ran py_test * fix: py lint * fix: change nestedness testcases + explicit log body id match --------- Co-authored-by: Nityananda Gohain <nityanandagohain@gmail.com>
This commit is contained in:
@@ -54,7 +54,7 @@ class MetricsTimeSeries(ABC):
|
||||
self.resource_attrs = resource_attrs
|
||||
self.unix_milli = np.int64(int(timestamp.timestamp() * 1e3))
|
||||
self.__normalized = False
|
||||
|
||||
|
||||
# Calculate fingerprint from metric_name + labels
|
||||
fingerprint_str = metric_name + self.labels
|
||||
self.fingerprint = np.uint64(
|
||||
@@ -128,7 +128,7 @@ class Metrics(ABC):
|
||||
timestamp: datetime.datetime
|
||||
value: float
|
||||
flags: int
|
||||
|
||||
|
||||
_time_series: MetricsTimeSeries
|
||||
_sample: MetricsSample
|
||||
|
||||
@@ -156,7 +156,7 @@ class Metrics(ABC):
|
||||
self.timestamp = timestamp
|
||||
self.value = value
|
||||
self.flags = flags
|
||||
|
||||
|
||||
self._time_series = MetricsTimeSeries(
|
||||
metric_name=metric_name,
|
||||
labels=labels,
|
||||
@@ -170,7 +170,7 @@ class Metrics(ABC):
|
||||
resource_attrs=resource_attributes,
|
||||
scope_attrs=scope_attributes,
|
||||
)
|
||||
|
||||
|
||||
self._sample = MetricsSample(
|
||||
metric_name=metric_name,
|
||||
fingerprint=self._time_series.fingerprint,
|
||||
@@ -195,9 +195,9 @@ def insert_metrics(
|
||||
"""
|
||||
time_series_map: dict[int, MetricsTimeSeries] = {}
|
||||
for metric in metrics:
|
||||
fp = int(metric._time_series.fingerprint)
|
||||
fp = int(metric._time_series.fingerprint) # pylint: disable=protected-access
|
||||
if fp not in time_series_map:
|
||||
time_series_map[fp] = metric._time_series
|
||||
time_series_map[fp] = metric._time_series # pylint: disable=protected-access
|
||||
|
||||
if len(time_series_map) > 0:
|
||||
clickhouse.conn.insert(
|
||||
@@ -222,7 +222,7 @@ def insert_metrics(
|
||||
data=[ts.to_row() for ts in time_series_map.values()],
|
||||
)
|
||||
|
||||
samples = [metric._sample for metric in metrics]
|
||||
samples = [metric._sample for metric in metrics] # pylint: disable=protected-access
|
||||
if len(samples) > 0:
|
||||
clickhouse.conn.insert(
|
||||
database="signoz_metrics",
|
||||
|
||||
@@ -11,7 +11,7 @@ from wiremock.client import (
|
||||
)
|
||||
|
||||
from fixtures import types
|
||||
from fixtures.auth import add_license, USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD
|
||||
from fixtures.auth import USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD, add_license
|
||||
from fixtures.logger import setup_logger
|
||||
|
||||
logger = setup_logger(__name__)
|
||||
|
||||
@@ -213,10 +213,8 @@ def test_public_dashboard_widget_query_range(
|
||||
assert response.status_code == HTTPStatus.OK
|
||||
assert response.json()["status"] == "success"
|
||||
public_path = response.json()["data"]["publicPath"]
|
||||
public_dashboard_id = public_path.split("/public/dashboard/")[-1]
|
||||
public_dashboard_id = public_path.split("/public/dashboard/")[-1]
|
||||
|
||||
|
||||
|
||||
resp = requests.get(
|
||||
signoz.self.host_configs["8080"].get(
|
||||
f"/api/v1/public/dashboards/{public_dashboard_id}/widgets/0/query_range"
|
||||
@@ -227,7 +225,7 @@ def test_public_dashboard_widget_query_range(
|
||||
assert resp.status_code == HTTPStatus.OK
|
||||
assert resp.json().get("status") == "success"
|
||||
|
||||
|
||||
|
||||
resp = requests.get(
|
||||
signoz.self.host_configs["8080"].get(
|
||||
f"/api/v1/public/dashboards/{public_dashboard_id}/widgets/-1/query_range"
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
# Log pipelines integration tests
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ and pipeline processing.
|
||||
from http import HTTPStatus
|
||||
from typing import Callable
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from fixtures import types
|
||||
from fixtures.auth import USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD
|
||||
|
||||
|
||||
def test_create_logs_pipeline_success(
|
||||
signoz: types.SigNoz,
|
||||
create_user_admin: types.Operation, # pylint: disable=unused-argument
|
||||
@@ -670,4 +670,3 @@ def test_delete_all_pipelines_success(
|
||||
# Note: Integration pipelines might still be present, so we check user-created ones
|
||||
user_pipelines = [p for p in list_data["data"]["pipelines"] if p.get("name") == "Pipeline to Delete"]
|
||||
assert len(user_pipelines) == 0
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ from typing import Callable
|
||||
import requests
|
||||
|
||||
from fixtures import types
|
||||
from fixtures.logger import setup_logger
|
||||
from fixtures.auth import USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD
|
||||
from fixtures.logger import setup_logger
|
||||
|
||||
logger = setup_logger(__name__)
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ from typing import Callable
|
||||
import requests
|
||||
|
||||
from fixtures import types
|
||||
from fixtures.logger import setup_logger
|
||||
from fixtures.auth import USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD
|
||||
from fixtures.logger import setup_logger
|
||||
|
||||
logger = setup_logger(__name__)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from http import HTTPStatus
|
||||
from typing import Callable, Dict, List
|
||||
from typing import Callable, List
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
1135
tests/integration/src/querier/d_logs_json_body.py
Normal file
1135
tests/integration/src/querier/d_logs_json_body.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -74,4 +74,4 @@ def find_named_result(
|
||||
or (r.get("spec") or {}).get("name") == name
|
||||
),
|
||||
None,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user