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
6 changes: 3 additions & 3 deletions scripts/build_aws_lambda_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def build_packaged_zip(base_dir=None, out_zip_filename=None):
# Just for debugging
dist_path = os.path.abspath(DIST_PATH)
print("Created Lambda Layer package with this information:")
print(" - Base directory for generating package: {}".format(layer_builder.base_dir))
print(" - Package zip filename: {}".format(layer_builder.out_zip_filename))
print(" - Copied package zip to: {}".format(dist_path))
print(f" - Base directory for generating package: {layer_builder.base_dir}")
print(f" - Package zip filename: {layer_builder.out_zip_filename}")
print(f" - Copied package zip to: {dist_path}")


if __name__ == "__main__":
Expand Down
79 changes: 79 additions & 0 deletions sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,24 @@ class SPANDATA:
Example: "wzHcyEWfmOGDIE5QOhTAqFDoDWP3y8IUvpNINCwL9N4TEHbUw0/gZJ+VZTmCNCWR7fezEN3eCiQ="
"""

AWS_LAMBDA_INVOKED_ARN = "aws.lambda.invoked_arn"
"""
The full ARN of the Lambda function that was invoked.
Example: "arn:aws:lambda:us-east-1:123456789012:function:my-function"
"""

AWS_LOG_GROUP_NAMES = "aws.log.group.names"
"""
The name(s) of the AWS log group(s) an application is writing to.
Example: ["/aws/lambda/my-function", "opentelemetry-service"]
"""

AWS_LOG_STREAM_NAMES = "aws.log.stream.names"
"""
The name(s) of the AWS log stream(s) an application is writing to.
Example: ["logs/main/10838bed-421f-43ef-870a-f43feacbbb5b"]
"""

AWS_REQUEST_ID = "aws.request_id"
"""
The AWS request ID as returned in the response headers.
Expand Down Expand Up @@ -426,12 +444,43 @@ class SPANDATA:
Example: "10.1.2.80"
"""

CLOUD_ACCOUNT_ID = "cloud.account.id"
"""
The cloud account ID the resource is assigned to.
Example: "123456789012"
"""

CLOUD_AVAILABILITY_ZONE = "cloud.availability_zone"
"""
Cloud regions often have multiple, isolated locations known as zones to increase availability
Example: "us-east-1c"
"""

CLOUD_PLATFORM = "cloud.platform"
"""
The cloud platform in use.
Example: "aws_lambda"
"""

CLOUD_PROVIDER = "cloud.provider"
"""
Name of the cloud provider.

Example: "aws"
"""

CLOUD_REGION = "cloud.region"
"""
The geographical region the resource is running.
Example: "us-east-1"
"""

CLOUD_RESOURCE_ID = "cloud.resource_id"
"""
Cloud provider-specific native identifier of the monitored cloud resource
Example: "arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function"
"""

CODE_FILEPATH = "code.filepath"
"""
.. deprecated::
Expand Down Expand Up @@ -565,6 +614,24 @@ class SPANDATA:
Example: "timeout"
"""

FAAS_INVOCATION_ID = "faas.invocation_id"
"""
The invocation ID of the current function invocation.
Example: "af9d5aa4-a685-4c5f-a22b-444f80b3cc28"
"""

FAAS_NAME = "faas.name"
"""
The name of the serverless function.
Example: "my_function"
"""

FAAS_VERSION = "faas.version"
"""
The version of the function that was invoked.
Example: "$LATEST"
"""

GEN_AI_AGENT_NAME = "gen_ai.agent.name"
"""
The name of the agent being used.
Expand Down Expand Up @@ -928,6 +995,12 @@ class SPANDATA:
Example: 418
"""

MESSAGING_BATCH_MESSAGE_COUNT = "messaging.batch.message_count"
"""
The number of messages sent, received, or processed in the scope of the batching operation.
Example: 10
"""

MESSAGING_DESTINATION_NAME = "messaging.destination.name"
"""
The destination name where the message is being consumed from,
Expand Down Expand Up @@ -1262,6 +1335,12 @@ class SPANDATA:
Example: ["AtexitIntegration", "StdlibIntegration"]
"""

SENTRY_SEGMENT_NAME_SOURCE = "sentry.segment.name.source"
"""
The source of the segment span name. Should only be set on segment spans.
Example: "route", "component", "view", "task", "custom", "url"
"""

USER_AGENT_ORIGINAL = "user_agent.original"
"""
Value of the HTTP User-Agent header sent by the client.
Expand Down
5 changes: 3 additions & 2 deletions sentry_sdk/integrations/aws_lambda/_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
from sentry_sdk.integrations.aws_lambda.consts import (
MILLIS_TO_SECONDS,
ORIGIN,
TIMEOUT_WARNING_BUFFER,
)
from sentry_sdk.integrations.cloud_resource_context import (
Expand Down Expand Up @@ -171,7 +172,7 @@ def sentry_handler(
parent_span=None,
attributes={
"sentry.op": OP.FUNCTION_AWS,
"sentry.origin": AwsLambdaIntegration.origin,
"sentry.origin": ORIGIN,
"sentry.segment.name.source": SegmentNameSource.COMPONENT,
"cloud.region": aws_region,
"cloud.resource_id": aws_context.invoked_function_arn,
Expand All @@ -194,7 +195,7 @@ def sentry_handler(
op=OP.FUNCTION_AWS,
name=function_name,
source=TransactionSource.COMPONENT,
origin=AwsLambdaIntegration.origin,
origin=ORIGIN,
)

span_ctx = sentry_sdk.start_transaction(
Expand Down
4 changes: 4 additions & 0 deletions sentry_sdk/integrations/aws_lambda/consts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
IDENTIFIER = "aws_lambda"
ORIGIN = f"auto.function.{IDENTIFIER}"

CLOUD_PROVIDER = "aws"
CLOUD_PLATFORM = "aws_lambda"
LATEST_FUNCTION_VERSION = "$LATEST"

# buffer time time required to send timeout warning.
TIMEOUT_WARNING_BUFFER = 1500
MILLIS_TO_SECONDS = 1000.0
Loading
Loading