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

PSMDB-1549. Ensure PSMDB related metrics are exported correctly #82

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion pmm_psmdb_diffauth_setup/test-auth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ done
tests=${TESTS:-yes}
if [ $tests = "yes" ]; then
echo "running tests"
output=$(docker compose -f docker-compose-pmm-psmdb.yml run test pytest -s -x --verbose test.py)
output=$(docker compose -f docker-compose-pmm-psmdb.yml run test pytest -s --verbose test.py)
else
echo "skipping tests"
fi
Expand Down
39 changes: 39 additions & 0 deletions pmm_psmdb_diffauth_setup/test/expected_metrics.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
mongodb_up
mongodb_mongod_global_lock_client
mongodb_mongod_global_lock_current_queue
mongodb_mongod_instance_uptime_seconds
mongodb_mongod_locks_time_acquiring_global_microseconds_total
mongodb_mongod_metrics_cursor_open
mongodb_mongod_metrics_cursor_timed_out_total
mongodb_mongod_metrics_document_total
mongodb_mongod_metrics_get_last_error_wtime_num_total
mongodb_mongod_metrics_get_last_error_wtime_total_milliseconds
mongodb_mongod_metrics_get_last_error_wtimeouts_total
mongodb_mongod_metrics_operation_total
mongodb_mongod_metrics_query_executor_total
mongodb_mongod_metrics_ttl_deleted_documents_total
mongodb_mongod_metrics_ttl_passes_total
mongodb_mongod_op_counters_repl_total
mongodb_mongod_op_latencies_latency_total
mongodb_mongod_op_latencies_ops_total
mongodb_mongod_storage_engine
mongodb_mongod_wiredtiger_blockmanager_bytes_total
mongodb_mongod_wiredtiger_cache_bytes
mongodb_mongod_wiredtiger_cache_bytes_total
mongodb_mongod_wiredtiger_cache_evicted_total
mongodb_mongod_wiredtiger_cache_max_bytes
mongodb_mongod_wiredtiger_cache_overhead_percent
mongodb_mongod_wiredtiger_cache_pages
mongodb_mongod_wiredtiger_cache_pages_total
mongodb_mongod_wiredtiger_concurrent_transactions_available_tickets
mongodb_mongod_wiredtiger_concurrent_transactions_out_tickets
mongodb_mongod_wiredtiger_concurrent_transactions_total_tickets
mongodb_mongod_wiredtiger_log_bytes_total
mongodb_mongod_wiredtiger_log_operations_total
mongodb_mongod_wiredtiger_log_records_scanned_total
mongodb_mongod_wiredtiger_log_records_total
mongodb_mongod_wiredtiger_session_open_sessions_total
mongodb_mongod_wiredtiger_transactions_checkpoint_milliseconds
mongodb_mongod_wiredtiger_transactions_checkpoint_milliseconds_total
mongodb_mongod_wiredtiger_transactions_running_checkpoints
mongodb_mongod_wiredtiger_transactions_total
13 changes: 11 additions & 2 deletions pmm_psmdb_diffauth_setup/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,17 @@ def run_test(add_db_command):
metrics = docker_pmm_client.run(command, timeout=30)
except Exception as e:
pytest.fail(f"Fail to get metrics from exporter")
if "mongodb_up" not in metrics.stdout:
pytest.fail("MongoDB related data isn't exported")

try:
with open("expected_metrics.txt", "r") as f:
expected_metrics = {line.strip() for line in f if line.strip()}
except FileNotFoundError:
pytest.fail("Expected metrics file not found")

for metric in expected_metrics:
if metric not in metrics.stdout:
pytest.fail(f"Metric '{metric}' is missing from the exporter output")


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