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

Revert "Revert "remove generic_metrics/*/distributions_meta_tag_value… #6883

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion tests/datasets/test_entity_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
EntityKey.GENERIC_METRICS_SETS_META,
EntityKey.GENERIC_METRICS_SETS_META_TAG_VALUES,
EntityKey.GENERIC_METRICS_DISTRIBUTIONS_META,
EntityKey.GENERIC_METRICS_DISTRIBUTIONS_META_TAG_VALUES,
EntityKey.GENERIC_METRICS_COUNTERS_META,
EntityKey.GENERIC_METRICS_COUNTERS_META_TAG_VALUES,
EntityKey.UPTIME_CHECKS,
Expand Down
67 changes: 0 additions & 67 deletions tests/test_metrics_meta_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,73 +163,6 @@ def test_retrieve_tag_keys(self, test_entity: str) -> None:
assert data["data"][0]["tag_key"] == 112358
assert data["data"][1]["tag_key"] == 132134

def test_retrieve_tag_values(self, test_entity: str) -> None:
entity_name = f"{test_entity}_meta_tag_values"
query_str = f"""MATCH ({entity_name})
SELECT tag_value
BY tag_value
WHERE project_id = {self.project_id}
AND metric_id = {self.metric_ids[0]}
AND tag_key = 112358
AND timestamp >= toDateTime('{self.start_time.isoformat()}')
AND timestamp < toDateTime('{self.end_time.isoformat()}')
ORDER BY tag_value ASC
"""
response = self.app.post(
SNQL_ROUTE,
data=json.dumps(
{
"query": query_str,
"dataset": "generic_metrics",
"tenant_ids": {"referrer": "tests", "organization_id": 1},
}
),
)
data = json.loads(response.data)
assert response.status_code == 200
assert len(data["data"]) == 4, data
assert data["data"][0]["tag_value"] == "dev"
assert data["data"][1]["tag_value"] == "prod"
assert data["data"][2]["tag_value"] == "staging"
assert data["data"][3]["tag_value"] == "test"

def test_retrieve_tag_values_with_count(self, test_entity: str) -> None:
entity_name = f"{test_entity}_meta_tag_values"
query_str = f"""MATCH ({entity_name})
SELECT tag_value, sum(count) AS rank
BY tag_value
WHERE project_id = {self.project_id}
AND metric_id = {self.metric_ids[0]}
AND tag_key = 112358
AND timestamp >= toDateTime('{self.start_time.isoformat()}')
AND timestamp < toDateTime('{self.end_time.isoformat()}')
ORDER BY tag_value ASC
"""
response = self.app.post(
SNQL_ROUTE,
data=json.dumps(
{
"query": query_str,
"dataset": "generic_metrics",
"tenant_ids": {"referrer": "tests", "organization_id": 1},
}
),
)
data = json.loads(response.data)
assert response.status_code == 200
assert len(data["data"]) == 4, data

# in tests, only the counters table populates the count field
if test_entity == "generic_metrics_counters":
values = [12.0, 12.0, 8.0, 8.0]
else:
values = [0.0] * 4

assert data["data"][0] == {"tag_value": "dev", "rank": values[0]}
assert data["data"][1] == {"tag_value": "prod", "rank": values[1]}
assert data["data"][2] == {"tag_value": "staging", "rank": values[2]}
assert data["data"][3] == {"tag_value": "test", "rank": values[3]}


@pytest.mark.clickhouse_db
@pytest.mark.redis_db
Expand Down
Loading