docs.aws.amazon.com
Open in
urlscan Pro
54.239.23.208
Public Scan
Submitted URL: https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-daemon
Effective URL: https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html
Submission: On September 01 via api from US
Effective URL: https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html
Submission: On September 01 via api from US
Form analysis
0 forms found in the DOMText Content
SELECT YOUR COOKIE PREFERENCES We use cookies and similar tools to enhance your experience, provide our services, deliver relevant advertising, and make improvements. Approved third parties also use these tools to help us deliver advertising and provide certain site features. CustomizeAccept all CUSTOMIZE COOKIE PREFERENCES We use cookies and similar tools (collectively, "cookies") for the following purposes. ESSENTIAL Essential cookies are necessary to provide our site and services and cannot be deactivated. They are usually set in response to your actions on the site, such as setting your privacy preferences, signing in, or filling in forms. PERFORMANCE Performance cookies provide anonymous statistics about how customers navigate our site so we can improve site experience and performance. Approved third parties may perform analytics on our behalf, but they cannot use the data for their own purposes. Allow performance category Allowed FUNCTIONAL Functional cookies help us provide useful site features, remember your preferences, and display relevant content. Approved third parties may set these cookies to provide certain site features. If you do not allow these cookies, then some or all of these services may not function properly. Allow functional category Allowed ADVERTISING Advertising cookies may be set through our site by us or our advertising partners and help us deliver relevant marketing content. If you do not allow these cookies, you will experience less relevant advertising. Allow advertising category Allowed Blocking some types of cookies may impact your experience of our sites. You may review and change your choices at any time by clicking Cookie preferences in the footer of this site. We and selected third-parties use cookies or similar technologies as specified in the AWS Cookie Notice . CancelSave preferences English Sign In to the Console 1. AWS 2. ... 3. Documentation 4. AWS Lambda 5. Developer Guide Feedback Preferences AWS Lambda Developer Guide * What is AWS Lambda? * Setting up * Getting started * Create a function * Create a function defined as a container image * Lambda foundations * Concepts * Features * Programming model * Function scaling * Deployment packages * Lambda console * Lambda CLI * Lambda Quotas * Permissions * Execution role * Resource-based policies * User policies * Resources and conditions * Permissions boundaries * Configuring functions * Creating functions (.zip packages) * Creating layers * Creating functions (container images) * Configuring function options * Environment variables * Versions * Aliases * Managing functions * Concurrency * Network * Interface VPC endpoints * Database * File system * Code signing * Tags * Using layers * Invoking functions * Synchronous invocation * Asynchronous invocation * Event source mapping * Function states * Error handling * Using extensions * Invoking functions defined as container images * Mobile SDK for Android * Tutorial * Sample code * Lambda applications * Manage applications * Tutorial – Create an application * Rolling deployments * Use cases * Best practices * Lambda runtimes * Runtime support policy * Execution environment * Container images * Runtime API * Extensions API * Logs API * Runtime modifications * Custom runtimes * Tutorial – Custom runtime * AVX2 vectorization * Container images * Creating images * Testing images * Working with other services * Alexa * API Gateway * Tutorial * Sample code * Microservice blueprint * Sample template * CloudTrail * CloudTrail logs * Tutorial * Sample code * CloudWatch Events * Tutorial * Sample template * Schedule expressions * CloudWatch Logs * CloudFormation * CloudFront (Lambda@Edge) * CodeCommit * CodePipeline * Cognito * Config * Connect * DynamoDB * Tutorial * Sample code * Sample template * EC2 * Tutorial – Spot Instances * ElastiCache * Elastic Load Balancing * EFS * IoT * IoT Events * Apache Kafka * Kinesis Firehose * Kinesis Streams * Tutorial * Sample code * Sample template * Lex * MQ * MSK * RDS * Tutorial * S3 * Tutorial: Use an S3 trigger * Tutorial: Use an S3 trigger to create thumbnails * Sample SAM template * S3 Batch * Secrets Manager * SES * SNS * Tutorial * Sample code * SQS * Tutorial * Sample code * Sample template * X-Ray * Orchestrating functions * Application patterns * Manage state machines * Orchestration examples * Samples * Blank function * Error processor * List manager * Working with Node.js * Handler * Deploy .zip file archives * Deploy container images * Context * Logging * Errors * Tracing * Working with Python * Handler * Deploy .zip file archives * Deploy container images * Context * Logging * Errors * Tracing * Working with Ruby * Handler * Deploy .zip file archives * Deploy container images * Context * Logging * Errors * Tracing * Working with Java * Handler * Deploy .zip file archives * Deploy container images * Context * Logging * Errors * Tracing * Tutorial - Eclipse IDE * Sample apps * Working with Go * Handler * Context * Deploy .zip file archives * Deploy container images * Logging * Errors * Tracing * Environment variables * Working with C# * Handler * Deployment package * .NET Core CLI * AWS Toolkit for Visual Studio * Deploy container images * Context * Logging * Errors * Tracing * Working with PowerShell * Development Environment * Deployment package * Handler * Context * Logging * Errors * Monitoring * Monitoring console * Function insights * Function metrics * Function logs * Code profiler * Example workflows * Security * Data protection * Identity and access management * How AWS Lambda works with IAM * Identity-based policy examples * Troubleshooting * Compliance validation * Resilience * Infrastructure security * Configuration and vulnerability analysis * Troubleshooting * Deployment * Invocation * Execution * Networking * Container images * Releases * API reference * Actions * AddLayerVersionPermission * AddPermission * CreateAlias * CreateCodeSigningConfig * CreateEventSourceMapping * CreateFunction * DeleteAlias * DeleteCodeSigningConfig * DeleteEventSourceMapping * DeleteFunction * DeleteFunctionCodeSigningConfig * DeleteFunctionConcurrency * DeleteFunctionEventInvokeConfig * DeleteLayerVersion * DeleteProvisionedConcurrencyConfig * GetAccountSettings * GetAlias * GetCodeSigningConfig * GetEventSourceMapping * GetFunction * GetFunctionCodeSigningConfig * GetFunctionConcurrency * GetFunctionConfiguration * GetFunctionEventInvokeConfig * GetLayerVersion * GetLayerVersionByArn * GetLayerVersionPolicy * GetPolicy * GetProvisionedConcurrencyConfig * Invoke * InvokeAsync * ListAliases * ListCodeSigningConfigs * ListEventSourceMappings * ListFunctionEventInvokeConfigs * ListFunctions * ListFunctionsByCodeSigningConfig * ListLayers * ListLayerVersions * ListProvisionedConcurrencyConfigs * ListTags * ListVersionsByFunction * PublishLayerVersion * PublishVersion * PutFunctionCodeSigningConfig * PutFunctionConcurrency * PutFunctionEventInvokeConfig * PutProvisionedConcurrencyConfig * RemoveLayerVersionPermission * RemovePermission * TagResource * UntagResource * UpdateAlias * UpdateCodeSigningConfig * UpdateEventSourceMapping * UpdateFunctionCode * UpdateFunctionConfiguration * UpdateFunctionEventInvokeConfig * Data Types * AccountLimit * AccountUsage * AliasConfiguration * AliasRoutingConfiguration * AllowedPublishers * CodeSigningConfig * CodeSigningPolicies * Concurrency * DeadLetterConfig * DestinationConfig * Environment * EnvironmentError * EnvironmentResponse * EventSourceMappingConfiguration * FileSystemConfig * FunctionCode * FunctionCodeLocation * FunctionConfiguration * FunctionEventInvokeConfig * ImageConfig * ImageConfigError * ImageConfigResponse * Layer * LayersListItem * LayerVersionContentInput * LayerVersionContentOutput * LayerVersionsListItem * OnFailure * OnSuccess * ProvisionedConcurrencyConfigListItem * SelfManagedEventSource * SourceAccessConfiguration * TracingConfig * TracingConfigResponse * VpcConfig * VpcConfigResponse * AWS glossary Using AWS Lambda with AWS X-Ray - AWS Lambda AWSDocumentationAWS LambdaDeveloper Guide Execution role permissionsThe AWS X-Ray daemonEnabling active tracing with the Lambda APIEnabling active tracing with AWS CloudFormation USING AWS LAMBDA WITH AWS X-RAY PDF Kindle RSS You can use AWS X-Ray to visualize the components of your application, identify performance bottlenecks, and troubleshoot requests that resulted in an error. Your Lambda functions send trace data to X-Ray, and X-Ray processes the data to generate a service map and searchable trace summaries. If you've enabled X-Ray tracing in a service that invokes your function, Lambda sends traces to X-Ray automatically. The upstream service, such as Amazon API Gateway, or an application hosted on Amazon EC2 that is instrumented with the X-Ray SDK, samples incoming requests and adds a tracing header that tells Lambda to send traces or not. To trace requests that don't have a tracing header, enable active tracing in your function's configuration. To enable active tracing 1. Open the Functions page on the Lambda console. 2. Choose a function. 3. Choose Configuration and then choose Monitoring tools. 4. Choose Edit. 5. Under X-Ray, enable Active tracing. 6. Choose Save. Pricing X-Ray has a perpetual free tier. Beyond the free tier threshold, X-Ray charges for trace storage and retrieval. For details, see AWS X-Ray pricing. Your function needs permission to upload trace data to X-Ray. When you enable active tracing in the Lambda console, Lambda adds the required permissions to your function's execution role. Otherwise, add the AWSXRayDaemonWriteAccess policy to the execution role. X-Ray applies a sampling algorithm to ensure that tracing is efficient, while still providing a representative sample of the requests that your application serves. The default sampling rule is 1 request per second and 5 percent of additional requests. This sampling rate cannot be configured for Lambda functions. In X-Ray, a trace records information about a request that is processed by one or more services. Services record segments that contain layers of subsegments. Lambda records a segment for the Lambda service that handles the invocation request, and one for the work done by the function. The function segment comes with subsegments for Initialization, Invocation and Overhead. For more information see Lambda execution environment lifecycle. The Initialization subsegment represents the init phase of the Lambda execution environment lifecycle. During this phase, Lambda creates or unfreezes an execution environment with the resources you have configured, downloads the function code and all layers, initializes extensions, initializes the runtime, and runs the function's initialization code. The Invocation subsegment represents the invoke phase where Lambda invokes the function handler. This begins with runtime and extension registration and it ends when the runtime is ready to send the response. The Overhead subsegment represents the phase that occurs between the time when the runtime sends the response and the signal for the next invoke. During this time, the runtime finishes all tasks related to an invoke and prepares to freeze the sandbox. Note If your Lambda function uses provisioned concurrency, your X-Ray trace might display a function initialization with a very long duration. Provisioned concurrency initializes function instances in advance, to reduce lag at the time of invocation. Over time, provisioned concurrency refreshes these instances by creating new instances to replace the old ones. For workloads with steady traffic, the new instances are initialized well in advance of their first invocation. The time gap gets recorded in the X-Ray trace as the initialization duration. The following example shows a trace with 2 segments. Both are named my-function, but one is type AWS::Lambda and the other is AWS::Lambda::Function. The function segment is expanded to show its subsegments. Important In Lambda, you can use the X-Ray SDK to extend the Invocation subsegment with additional subsegments for downstream calls, annotations, and metadata. You can't access the function segment directly or record work done outside of the handler invocation scope. See the following topics for a language-specific introduction to tracing in Lambda: * Instrumenting Node.js code in AWS Lambda * Instrumenting Python code in AWS Lambda * Instrumenting Ruby code in AWS Lambda * Instrumenting Java code in AWS Lambda * Instrumenting Go code in AWS Lambda * Instrumenting C# code in AWS Lambda For a full list of services that support active instrumentation, see Supported AWS services in the AWS X-Ray Developer Guide. Sections * Execution role permissions * The AWS X-Ray daemon * Enabling active tracing with the Lambda API * Enabling active tracing with AWS CloudFormation EXECUTION ROLE PERMISSIONS Lambda needs the following permissions to send trace data to X-Ray. Add them to your function's execution role. * xray:PutTraceSegments * xray:PutTelemetryRecords These permissions are included in the AWSXRayDaemonWriteAccess managed policy. THE AWS X-RAY DAEMON Instead of sending trace data directly to the X-Ray API, the X-Ray SDK uses a daemon process. The AWS X-Ray daemon is an application that runs in the Lambda environment and listens for UDP traffic that contains segments and subsegments. It buffers incoming data and writes it to X-Ray in batches, reducing the processing and memory overhead required to trace invocations. The Lambda runtime allows the daemon to up to 3 percent of your function's configured memory or 16 MB, whichever is greater. If your function runs out of memory during invocation, the runtime terminates the daemon process first to free up memory. The daemon process is fully managed by Lambda and cannot be configured by the user. All segments generated by function invocations are recorded in the same account as the Lambda function. The daemon cannot be configured to redirect them to any other account. For more information, see The X-Ray daemon in the X-Ray Developer Guide. ENABLING ACTIVE TRACING WITH THE LAMBDA API To manage tracing configuration with the AWS CLI or AWS SDK, use the following API operations: * UpdateFunctionConfiguration * GetFunctionConfiguration * CreateFunction The following example AWS CLI command enables active tracing on a function named my-function. aws lambda update-function-configuration --function-name my-function \ --tracing-config Mode=Active Tracing mode is part of the version-specific configuration that is locked when you publish a version of your function. You can't change the tracing mode on a published version. ENABLING ACTIVE TRACING WITH AWS CLOUDFORMATION To enable active tracing on an AWS::Lambda::Function resource in an AWS CloudFormation template, use the TracingConfig property. Example function-inline.yml – Tracing configuration Resources: function: Type: AWS::Lambda::Function Properties: TracingConfig: Mode: Active ... For an AWS Serverless Application Model (AWS SAM) AWS::Serverless::Function resource, use the Tracing property. Example template.yml – Tracing configuration Resources: function: Type: AWS::Serverless::Function Properties: Tracing: Active ... © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. Thanks for your vote. To provide details, send feedback. This page is helpful. Thanks for your vote. To provide details, send feedback. This page is not helpful. Javascript is disabled or is unavailable in your browser. To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions. Document Conventions Sample template Orchestrating functions Did this page help you? Yes No Did this page help you? - Yes Thanks for letting us know we're doing a good job! If you've got a moment, please tell us what we did right so we can do more of it. Feedback Did this page help you? - No Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better. Feedback Provide feedback Edit this page on GitHub Previous topic: Sample template Next topic: Orchestrating functions Need help? * Try the forums * Connect with an AWS IQ expert Privacy Site terms Cookie preferences © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. Did this page help you? - Yes Thanks for letting us know we're doing a good job! If you've got a moment, please tell us what we did right so we can do more of it. Feedback Did this page help you? - No Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better. Feedback On this page * Execution role permissions * The AWS X-Ray daemon * Enabling active tracing with the Lambda API * Enabling active tracing with AWS CloudFormation