Skip to content

Commit d013479

Browse files
PSMDB-1549. Ensure PSMDB related metrics are exported correctly
1 parent 4cd29ac commit d013479

File tree

3 files changed

+51
-3
lines changed

3 files changed

+51
-3
lines changed

pmm_psmdb_diffauth_setup/test-auth.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ docker compose -f docker-compose-pmm-psmdb.yml exec -T psmdb-server mgodatagen -
7575
tests=${TESTS:-yes}
7676
if [ $tests = "yes" ]; then
7777
echo "running tests"
78-
output=$(docker compose -f docker-compose-pmm-psmdb.yml run test pytest -s -x --verbose test.py)
78+
output=$(docker compose -f docker-compose-pmm-psmdb.yml run test pytest -s --verbose test.py)
7979
else
8080
echo "skipping tests"
8181
fi
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
mongodb_up
2+
mongodb_mongod_global_lock_client
3+
mongodb_mongod_global_lock_current_queue
4+
mongodb_mongod_instance_uptime_seconds
5+
mongodb_mongod_locks_time_acquiring_global_microseconds_total
6+
mongodb_mongod_metrics_cursor_open
7+
mongodb_mongod_metrics_cursor_timed_out_total
8+
mongodb_mongod_metrics_document_total
9+
mongodb_mongod_metrics_get_last_error_wtime_num_total
10+
mongodb_mongod_metrics_get_last_error_wtime_total_milliseconds
11+
mongodb_mongod_metrics_get_last_error_wtimeouts_total
12+
mongodb_mongod_metrics_operation_total
13+
mongodb_mongod_metrics_query_executor_total
14+
mongodb_mongod_metrics_ttl_deleted_documents_total
15+
mongodb_mongod_metrics_ttl_passes_total
16+
mongodb_mongod_op_counters_repl_total
17+
mongodb_mongod_op_latencies_latency_total
18+
mongodb_mongod_op_latencies_ops_total
19+
mongodb_mongod_storage_engine
20+
mongodb_mongod_wiredtiger_blockmanager_bytes_total
21+
mongodb_mongod_wiredtiger_cache_bytes
22+
mongodb_mongod_wiredtiger_cache_bytes_total
23+
mongodb_mongod_wiredtiger_cache_evicted_total
24+
mongodb_mongod_wiredtiger_cache_max_bytes
25+
mongodb_mongod_wiredtiger_cache_overhead_percent
26+
mongodb_mongod_wiredtiger_cache_pages
27+
mongodb_mongod_wiredtiger_cache_pages_total
28+
mongodb_mongod_wiredtiger_concurrent_transactions_available_tickets
29+
mongodb_mongod_wiredtiger_concurrent_transactions_out_tickets
30+
mongodb_mongod_wiredtiger_concurrent_transactions_total_tickets
31+
mongodb_mongod_wiredtiger_log_bytes_total
32+
mongodb_mongod_wiredtiger_log_operations_total
33+
mongodb_mongod_wiredtiger_log_records_scanned_total
34+
mongodb_mongod_wiredtiger_log_records_total
35+
mongodb_mongod_wiredtiger_session_open_sessions_total
36+
mongodb_mongod_wiredtiger_transactions_checkpoint_milliseconds
37+
mongodb_mongod_wiredtiger_transactions_checkpoint_milliseconds_total
38+
mongodb_mongod_wiredtiger_transactions_running_checkpoints
39+
mongodb_mongod_wiredtiger_transactions_total

pmm_psmdb_diffauth_setup/test/test.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@ def run_test(add_db_command):
3434
metrics = docker_pmm_client.run(command, timeout=30)
3535
except Exception as e:
3636
pytest.fail(f"Fail to get metrics from exporter")
37-
if "mongodb_up" not in metrics.stdout:
38-
pytest.fail("MongoDB related data isn't exported")
37+
38+
try:
39+
with open("expected_metrics.txt", "r") as f:
40+
expected_metrics = {line.strip() for line in f if line.strip()}
41+
except FileNotFoundError:
42+
pytest.fail("Expected metrics file not found")
43+
44+
for metric in expected_metrics:
45+
if metric not in metrics.stdout:
46+
pytest.fail(f"Metric '{metric}' is missing from the exporter output")
47+
3948

4049
def test_simple_auth_wo_tls():
4150
run_test('pmm-admin add mongodb psmdb-server --username=pmm_mongodb --password="5M](Q%q/U+YQ<^m" ''--host '

0 commit comments

Comments
 (0)