@@ -532,3 +532,73 @@ def test_spanv2_inbound_filters(
532532 ]
533533
534534 assert mini_sentry .captured_events .empty ()
535+
536+
537+ def test_spans_v2_multiple_containers_not_allowed (
538+ mini_sentry ,
539+ relay ,
540+ ):
541+ project_id = 42
542+ project_config = mini_sentry .add_full_project_config (project_id )
543+ project_config ["config" ]["features" ] = [
544+ "organizations:standalone-span-ingestion" ,
545+ "projects:span-v2-experimental-processing" ,
546+ ]
547+
548+ relay = relay (mini_sentry , options = TEST_CONFIG )
549+ start = datetime .now (timezone .utc )
550+ envelope = Envelope ()
551+
552+ payload = {
553+ "start_timestamp" : start .timestamp (),
554+ "end_timestamp" : start .timestamp () + 0.500 ,
555+ "trace_id" : "5b8efff798038103d269b633813fc60c" ,
556+ "span_id" : "eee19b7ec3c1b175" ,
557+ "name" : "some op" ,
558+ "is_remote" : False ,
559+ "status" : "ok" ,
560+ }
561+ envelope .add_item (
562+ Item (
563+ type = "span" ,
564+ payload = PayloadRef (json = {"items" : [payload ]}),
565+ content_type = "application/vnd.sentry.items.span.v2+json" ,
566+ headers = {"item_count" : 1 },
567+ )
568+ )
569+ envelope .add_item (
570+ Item (
571+ type = "span" ,
572+ payload = PayloadRef (json = {"items" : [payload , payload ]}),
573+ content_type = "application/vnd.sentry.items.span.v2+json" ,
574+ headers = {"item_count" : 2 },
575+ )
576+ )
577+
578+ relay .send_envelope (project_id , envelope )
579+
580+ assert mini_sentry .get_outcomes (2 ) == [
581+ {
582+ "category" : DataCategory .SPAN .value ,
583+ "timestamp" : time_within_delta (),
584+ "key_id" : 123 ,
585+ "org_id" : 1 ,
586+ "outcome" : 3 , # Invalid
587+ "project_id" : 42 ,
588+ "quantity" : 3 ,
589+ "reason" : "duplicate_item" ,
590+ },
591+ {
592+ "category" : DataCategory .SPAN_INDEXED .value ,
593+ "timestamp" : time_within_delta (),
594+ "key_id" : 123 ,
595+ "org_id" : 1 ,
596+ "outcome" : 3 , # Invalid
597+ "project_id" : 42 ,
598+ "quantity" : 3 ,
599+ "reason" : "duplicate_item" ,
600+ },
601+ ]
602+
603+ assert mini_sentry .captured_events .empty ()
604+ assert mini_sentry .captured_outcomes .empty ()
0 commit comments