-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split endpoints into charm-tracing and workload-tracing (#358)
* Split endpoints into charm-tracing and workload-tracing; integration tests * formatting * Adjust method import to better naming in lib * Add juju topology to workload traces * Don't use shared helpers yet * Review remarks: duplicate method, upper-case constants
- Loading branch information
Showing
6 changed files
with
216 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ cryptography | |
# lib/charms/tempo_k8s/v1/charm_tracing.py | ||
opentelemetry-exporter-otlp-proto-http | ||
pydantic | ||
cosl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2021 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
import logging | ||
from pathlib import Path | ||
|
||
import pytest | ||
import yaml | ||
from helpers import ( | ||
oci_image, | ||
check_grafana_is_ready, | ||
deploy_tempo_cluster, | ||
get_traces_patiently, | ||
get_application_ip, | ||
) | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
METADATA = yaml.safe_load(Path("./charmcraft.yaml").read_text()) | ||
APP_NAME = "grafana" | ||
TEMPO_APP_NAME = "tempo" | ||
RESOURCES = { | ||
"grafana-image": oci_image("./charmcraft.yaml", "grafana-image"), | ||
"litestream-image": oci_image("./charmcraft.yaml", "litestream-image"), | ||
} | ||
|
||
|
||
async def test_setup_env(ops_test): | ||
await ops_test.model.set_config({"logging-config": "<root>=WARNING; unit=DEBUG"}) | ||
|
||
|
||
@pytest.mark.abort_on_fail | ||
async def test_workload_tracing_is_present(ops_test, grafana_charm): | ||
logger.info("deploying tempo cluster") | ||
await deploy_tempo_cluster(ops_test) | ||
|
||
logger.info("deploying local charm") | ||
await ops_test.model.deploy( | ||
grafana_charm, resources=RESOURCES, application_name=APP_NAME, trust=True | ||
) | ||
await ops_test.model.wait_for_idle( | ||
apps=[APP_NAME], status="active", timeout=300, wait_for_exact_units=1 | ||
) | ||
|
||
await check_grafana_is_ready(ops_test, APP_NAME, 0) | ||
# we relate _only_ workload tracing not to confuse with charm traces | ||
await ops_test.model.add_relation( | ||
"{}:workload-tracing".format(APP_NAME), "{}:tracing".format(TEMPO_APP_NAME) | ||
) | ||
await ops_test.model.wait_for_idle(apps=[APP_NAME], status="active") | ||
|
||
# Verify workload traces from grafana are ingested into Tempo | ||
assert await get_traces_patiently( | ||
await get_application_ip(ops_test, TEMPO_APP_NAME), | ||
service_name=f"{APP_NAME}", | ||
tls=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters