Skip to content
Open
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
1 change: 1 addition & 0 deletions sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,7 @@ class OP:
QUEUE_TASK_RAY = "queue.task.ray"
QUEUE_TASK_DRAMATIQ = "queue.task.dramatiq"
QUEUE_SUBMIT_DJANGO = "queue.submit.django"
RPC = "rpc"
SUBPROCESS = "subprocess"
SUBPROCESS_WAIT = "subprocess.wait"
SUBPROCESS_COMMUNICATE = "subprocess.communicate"
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/boto3/_instrumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _start_client_span(

# `sentry.op` and `sentry.origin` are set to generic defaults;
# a service extension can override them with `get_span_op()` and `get_span_origin()`.
span_op = OP.HTTP_CLIENT
span_op = OP.RPC
span_origin = ORIGIN

if service_ext is not None:
Expand Down
32 changes: 16 additions & 16 deletions tests/integrations/boto3/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def record_client_span(request, **kwargs):
if span["name"] == "S3.GetObject"
and (
span.get("attributes", {}).get(SPANDATA.SENTRY_ORIGIN) == ORIGIN
and span.get("attributes", {}).get(SPANDATA.SENTRY_OP) == OP.HTTP_CLIENT
and span.get("attributes", {}).get(SPANDATA.SENTRY_OP) == OP.RPC
)
]
http_spans = [
Expand Down Expand Up @@ -231,7 +231,7 @@ def invoke():
assert sentry_sdk.get_current_span() is parent

spans_by_op = _capture_boto3_spans_by_op(invoke, capture_items)
(client_span,) = spans_by_op[OP.HTTP_CLIENT]
(client_span,) = spans_by_op[OP.RPC]
(stream_span,) = spans_by_op[OP.HTTP_CLIENT_STREAM]
assert stream_span.get("parent_span_id") == client_span["span_id"]

Expand All @@ -251,7 +251,7 @@ def test_omit_url_data_if_parsing_fails(capture_items, client_factory):
)

parse_url.assert_called()
(span,) = spans_by_op[OP.HTTP_CLIENT]
(span,) = spans_by_op[OP.RPC]
attributes = span.get("attributes", {})
assert SPANDATA.URL_FULL not in attributes
assert SPANDATA.URL_FRAGMENT not in attributes
Expand Down Expand Up @@ -326,7 +326,7 @@ def test_url_query_data_collection(
(span,) = [
item.payload
for item in items
if item.payload.get("attributes", {}).get(SPANDATA.SENTRY_OP) == OP.HTTP_CLIENT
if item.payload.get("attributes", {}).get(SPANDATA.SENTRY_OP) == OP.RPC
]
attributes = span.get("attributes", {})

Expand Down Expand Up @@ -428,7 +428,7 @@ def _capture_stubbed_client_span(
)
stubber.assert_no_pending_responses()

client_spans = spans_by_op.get(OP.HTTP_CLIENT, [])
client_spans = spans_by_op.get(OP.RPC, [])
assert len(client_spans) == 1
return client_spans[0]

Expand Down Expand Up @@ -580,7 +580,7 @@ def test_client_call_has_common_attributes(

assert span["name"] == span_name
assert span.get("end_timestamp") is not None
assert attributes[SPANDATA.SENTRY_OP] == OP.HTTP_CLIENT
assert attributes[SPANDATA.SENTRY_OP] == OP.RPC
assert attributes[SPANDATA.SENTRY_ORIGIN] == ORIGIN
assert attributes[SPANDATA.SENTRY_KIND] == "client"
assert attributes[SPANDATA.CLOUD_PROVIDER] == CLOUD_PROVIDER
Expand Down Expand Up @@ -651,7 +651,7 @@ def test_client_call_has_response_header_attributes(
capture_items,
)

spans = spans_by_op[OP.HTTP_CLIENT]
spans = spans_by_op[OP.RPC]
assert len(spans) == 1
attributes = spans[0].get("attributes", {})
assert attributes[SPANDATA.HTTP_STATUS_CODE] == 200
Expand All @@ -670,7 +670,7 @@ def test_retry_attempts_share_one_client_span(
spans_by_op = _capture_boto3_spans_by_op(
lambda: client.head_object(Bucket="bucket", Key="foo"), capture_items
)
client_spans = spans_by_op.get(OP.HTTP_CLIENT, [])
client_spans = spans_by_op.get(OP.RPC, [])

assert len(request_span_ids) == attempt_count
# all `AWSRequest` instances created during retries reference the same client span.
Expand All @@ -693,7 +693,7 @@ def attempt_failed_head_object_call():
spans_by_op = _capture_boto3_spans_by_op(
attempt_failed_head_object_call, capture_items
)
client_spans = spans_by_op.get(OP.HTTP_CLIENT, [])
client_spans = spans_by_op.get(OP.RPC, [])

assert len(request_span_ids) == 2
assert len(set(request_span_ids)) == 1
Expand Down Expand Up @@ -749,14 +749,14 @@ def invoke_failing_client_method():
spans_by_op = _capture_boto3_spans_by_op(
invoke_failing_client_method, capture_items
)
client_spans = spans_by_op.get(OP.HTTP_CLIENT, [])
client_spans = spans_by_op.get(OP.RPC, [])
_assert_one_failed_span(client_spans)
attributes = client_spans[0].get("attributes", {})

span = client_spans[0]
assert span["name"] == "S3.HeadObject"
assert span.get("end_timestamp") is not None
assert attributes[SPANDATA.SENTRY_OP] == OP.HTTP_CLIENT
assert attributes[SPANDATA.SENTRY_OP] == OP.RPC
assert attributes[SPANDATA.SENTRY_ORIGIN] == ORIGIN
assert attributes[SPANDATA.SENTRY_KIND] == "client"
assert attributes[SPANDATA.CLOUD_PROVIDER] == CLOUD_PROVIDER
Expand Down Expand Up @@ -810,7 +810,7 @@ def invoke_failing_client_method():
spans_by_op = _capture_boto3_spans_by_op(
invoke_failing_client_method, capture_items
)
client_spans = spans_by_op.get(OP.HTTP_CLIENT, [])
client_spans = spans_by_op.get(OP.RPC, [])
_assert_one_failed_span(client_spans)

expected_error_type = (
Expand Down Expand Up @@ -856,7 +856,7 @@ def invoke_client_method():
stubber.add_response("head_object", original_response, api_params)
spans_by_op = _capture_boto3_spans_by_op(invoke_client_method, capture_items)

client_spans = spans_by_op.get(OP.HTTP_CLIENT, [])
client_spans = spans_by_op.get(OP.RPC, [])
assert returned_responses == [original_response]
assert returned_responses[0] is original_response
if failing_instrumentation == "_get_response_attributes":
Expand Down Expand Up @@ -893,7 +893,7 @@ def invoke_failing_client_method():
spans_by_op = _capture_boto3_spans_by_op(
invoke_failing_client_method, capture_items
)
client_spans = spans_by_op.get(OP.HTTP_CLIENT, [])
client_spans = spans_by_op.get(OP.RPC, [])

assert len(client_spans) == 1
assert client_spans[0]["status"] == "error"
Expand Down Expand Up @@ -926,7 +926,7 @@ def invoke_client_method_and_read_body():
spans_by_op = _capture_boto3_spans_by_op(
invoke_client_method_and_read_body, capture_items
)
client_spans = spans_by_op.get(OP.HTTP_CLIENT, [])
client_spans = spans_by_op.get(OP.RPC, [])
stream_spans = spans_by_op.get(OP.HTTP_CLIENT_STREAM, [])

assert len(client_spans) == 1
Expand Down Expand Up @@ -975,7 +975,7 @@ def invoke_client_method_and_read_body():
spans_by_op = _capture_boto3_spans_by_op(
invoke_client_method_and_read_body, capture_items
)
client_spans = spans_by_op.get(OP.HTTP_CLIENT, [])
client_spans = spans_by_op.get(OP.RPC, [])
stream_spans = spans_by_op.get(OP.HTTP_CLIENT_STREAM, [])

assert len(client_spans) == 1
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/boto3/test_dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_request_attributes(
lambda: getattr(client, method)(**params), capture_items
)

(span,) = spans[OP.HTTP_CLIENT]
(span,) = spans[OP.RPC]
attributes = span["attributes"]
if expected_resource_id is None:
assert SPANDATA.CLOUD_ACCOUNT_ID not in attributes
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/boto3/test_kinesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_request_attributes(client_factory, capture_items):
capture_items,
)

(span,) = spans[OP.HTTP_CLIENT]
(span,) = spans[OP.RPC]
attributes = span["attributes"]
assert attributes[SPANDATA.CLOUD_ACCOUNT_ID] == "123456789012"
assert attributes[SPANDATA.CLOUD_RESOURCE_ID] == stream_arn
2 changes: 1 addition & 1 deletion tests/integrations/boto3/test_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_request_attributes(client_factory, capture_items):
capture_items,
)

(span,) = spans[OP.HTTP_CLIENT]
(span,) = spans[OP.RPC]
attributes = span["attributes"]
assert attributes[SPANDATA.CLOUD_ACCOUNT_ID] == "123456789012"
assert attributes[SPANDATA.CLOUD_RESOURCE_ID] == function_arn
4 changes: 2 additions & 2 deletions tests/integrations/boto3/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ def _stubbed_span(client, capture_items, method, params, response):
lambda: getattr(client, method)(**params), capture_items
)
stubber.assert_no_pending_responses()
(span,) = spans[OP.HTTP_CLIENT]
(span,) = spans[OP.RPC]
operation = client.meta.method_to_api_mapping[method]
assert span["name"] == "S3.%s" % operation
assert span.get("end_timestamp") is not None
attributes = span.get("attributes", {})
assert attributes[SPANDATA.SENTRY_OP] == OP.HTTP_CLIENT
assert attributes[SPANDATA.SENTRY_OP] == OP.RPC
assert attributes[SPANDATA.SENTRY_ORIGIN] == ORIGIN
assert attributes[SPANDATA.SENTRY_KIND] == "client"
assert attributes[SPANDATA.CLOUD_PROVIDER] == "aws"
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/boto3/test_secretsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_request_attributes(client_factory, capture_items):
capture_items,
)

(span,) = spans[OP.HTTP_CLIENT]
(span,) = spans[OP.RPC]
attributes = span["attributes"]
assert attributes[SPANDATA.CLOUD_ACCOUNT_ID] == "123456789012"
assert attributes[SPANDATA.CLOUD_RESOURCE_ID] == secret_arn
2 changes: 1 addition & 1 deletion tests/integrations/boto3/test_sns.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_request_attributes(client_factory, capture_items):
lambda: client.delete_topic(**{"TopicArn": topic_arn}), capture_items
)

(span,) = spans[OP.HTTP_CLIENT]
(span,) = spans[OP.RPC]
attributes = span["attributes"]
assert attributes[SPANDATA.CLOUD_ACCOUNT_ID] == "123456789012"
assert attributes[SPANDATA.CLOUD_RESOURCE_ID] == topic_arn
2 changes: 1 addition & 1 deletion tests/integrations/boto3/test_sqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_request_attributes(client_factory, capture_items, source):
lambda: getattr(client, method)(**params), capture_items
)

(span,) = spans[OP.HTTP_CLIENT]
(span,) = spans[OP.RPC]
attributes = span["attributes"]
assert attributes[SPANDATA.CLOUD_ACCOUNT_ID] == "123456789012"
if resource_id is None:
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/boto3/test_stepfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_request_attributes(client_factory, capture_items):
capture_items,
)

(span,) = spans[OP.HTTP_CLIENT]
(span,) = spans[OP.RPC]
attributes = span["attributes"]
assert attributes[SPANDATA.CLOUD_ACCOUNT_ID] == "123456789012"
assert attributes[SPANDATA.CLOUD_RESOURCE_ID] == state_machine_arn
Loading