def METHOD_NAME(elasticapm_client):
    elasticapm_client.begin_transaction("test_type")
    with elasticapm.capture_span("not_dropped"):
        pass
    for i in range(10):
        resource = str(i % 2)
        with elasticapm.capture_span(
            span_type="x",
            span_subtype="y",
            extra={
                "destination": {"service": {"resource": resource}},
                "service": {"target": {"name": "foo", "type": "bar"}},
            },
            duration=100,
        ):
            pass
    elasticapm_client.end_transaction()
    transaction = elasticapm_client.events[constants.TRANSACTION][0]
    spans = elasticapm_client.events[constants.SPAN]
    assert len(spans) == 1
    for entry in transaction["dropped_spans_stats"]:
        assert entry["duration"]["count"] == 5
        assert entry["duration"]["sum"]["us"] == 500000000
        assert entry["service_target_type"] == "bar"
        assert entry["service_target_name"] == "foo"