@@ -2279,3 +2279,76 @@ def test_scrubs_ip_addresses(
2279
2279
assert child_span == expected
2280
2280
2281
2281
spans_consumer .assert_empty ()
2282
+
2283
+ def test_spans_v2_multiple_containers_not_allowed (
2284
+ mini_sentry ,
2285
+ relay_with_processing ,
2286
+ spans_consumer ,
2287
+ outcomes_consumer ,
2288
+ ):
2289
+ spans_consumer = spans_consumer ()
2290
+ outcomes_consumer = outcomes_consumer ()
2291
+ project_id = 42
2292
+ project_config = mini_sentry .add_full_project_config (project_id )
2293
+ project_config ["config" ]["features" ] = [
2294
+ "organizations:standalone-span-ingestion" ,
2295
+ ]
2296
+
2297
+ relay = relay_with_processing (options = TEST_CONFIG )
2298
+ start = datetime .now (timezone .utc )
2299
+ envelope = Envelope ()
2300
+
2301
+ payload = {
2302
+ "start_timestamp" : start .timestamp (),
2303
+ "end_timestamp" : start .timestamp () + 0.500 ,
2304
+ "trace_id" : "5b8efff798038103d269b633813fc60c" ,
2305
+ "span_id" : "eee19b7ec3c1b175" ,
2306
+ "name" : "some op" ,
2307
+ }
2308
+ envelope .add_item (
2309
+ Item (
2310
+ type = "span" ,
2311
+ payload = PayloadRef (json = {"items" : [payload ]}),
2312
+ content_type = "application/vnd.sentry.items.span.v2+json" ,
2313
+ headers = {"item_count" : 1 },
2314
+ )
2315
+ )
2316
+ envelope .add_item (
2317
+ Item (
2318
+ type = "span" ,
2319
+ payload = PayloadRef (json = {"items" : [payload , payload ]}),
2320
+ content_type = "application/vnd.sentry.items.span.v2+json" ,
2321
+ headers = {"item_count" : 2 },
2322
+ )
2323
+ )
2324
+
2325
+ relay .send_envelope (project_id , envelope )
2326
+
2327
+ spans_consumer .assert_empty ()
2328
+
2329
+ outcomes = outcomes_consumer .get_outcomes ()
2330
+
2331
+ outcomes .sort (key = lambda o : sorted (o .items ()))
2332
+
2333
+ assert outcomes == [
2334
+ {
2335
+ "category" : DataCategory .SPAN .value ,
2336
+ "timestamp" : time_within_delta (),
2337
+ "key_id" : 123 ,
2338
+ "org_id" : 1 ,
2339
+ "outcome" : 3 , # Invalid
2340
+ "project_id" : 42 ,
2341
+ "quantity" : 3 ,
2342
+ "reason" : "duplicate_item" ,
2343
+ },
2344
+ {
2345
+ "category" : DataCategory .SPAN_INDEXED .value ,
2346
+ "timestamp" : time_within_delta (),
2347
+ "key_id" : 123 ,
2348
+ "org_id" : 1 ,
2349
+ "outcome" : 3 , # Invalid
2350
+ "project_id" : 42 ,
2351
+ "quantity" : 3 ,
2352
+ "reason" : "duplicate_item" ,
2353
+ },
2354
+ ]
0 commit comments