def METHOD_NAME(dd_agent_check, init_config, instance_ao_docker_primary):
    aggregator = dd_agent_check({'init_config': init_config, 'instances': [instance_ao_docker_primary]})
    # Metrics that are expected to be collected from the primary replica, this includes
    # metrics for secondary replicas.
    for mname in (
        EXPECTED_AO_METRICS_PRIMARY
        + EXPECTED_QUERY_EXECUTOR_AO_METRICS_PRIMARY
        + EXPECTED_AO_METRICS_COMMON
        + EXPECTED_QUERY_EXECUTOR_AO_METRICS_COMMON
        + EXPECTED_QUERY_EXECUTOR_AO_METRICS_SECONDARY
    ):
        aggregator.assert_metric(mname)
    # Metrics that can only be collected from the secondary replica, regardless
    # of being connected to the primary replica.
    for mname in EXPECTED_AO_METRICS_SECONDARY:
        aggregator.assert_metric(mname, count=0)
    aggregator.assert_metrics_using_metadata(get_metadata_metrics(), exclude=CUSTOM_METRICS)