# Technical Documentation: serverless/dashboard

> ℹ️ **Provenance:** Multi-Tier Ingestion · [CodeWiki Reference](https://codewiki.google/github.com/serverless/dashboard)

### Overview (README.md)

# Serverless Framework Dashboard

This repository is the singular location of all open-source components of [Serverless Framework Dashboard](https://app.serverless.com).

Here you will find:

* **AWS Lambda Extensions** – The source code of the AWS Lambda Extensions installed by users to send metrics, traces and logs to Serverless Framework Dashboard.
* **AWS IAM Role** – The AWS CloudFormation template containing an AWS IAM Role that allows Serverless Framework Dashboard permissions to specific services to provide monitoring and observability features.

---

### Proto Docs Schema (`proto/docs/schema.md`)

# Protocol Documentation
<a name="top"></a>

## Table of Contents

- [serverless/instrumentation/tags/v1/aws.proto](#serverless_instrumentation_tags_v1_aws-proto)
    - [AwsApiGatewayTags](#serverless-instrumentation-tags-v1-AwsApiGatewayTags)
    - [AwsApiGatewayTags.AwsApiGatewayRequestTags](#serverless-instrumentation-tags-v1-AwsApiGatewayTags-AwsApiGatewayRequestTags)
    - [AwsLambdaInitializationTags](#serverless-instrumentation-tags-v1-AwsLambdaInitializationTags)
    - [AwsLambdaInvocationTags](#serverless-instrumentation-tags-v1-AwsLambdaInvocationTags)
    - [AwsLambdaRuntimeTags](#serverless-instrumentation-tags-v1-AwsLambdaRuntimeTags)
    - [AwsLambdaTags](#serverless-instrumentation-tags-v1-AwsLambdaTags)
    - [AwsSdkDynamodbTags](#serverless-instrumentation-tags-v1-AwsSdkDynamodbTags)
    - [AwsSdkSnsTags](#serverless-instrumentation-tags-v1-AwsSdkSnsTags)
    - [AwsSdkSqsTags](#serverless-instrumentation-tags-v1-AwsSdkSqsTags)
    - [AwsSdkTags](#serverless-instrumentation-tags-v1-AwsSdkTags)
    - [AwsSnsEventTags](#serverless-instrumentation-tags-v1-AwsSnsEventTags)
    - [AwsSqsEventTags](#serverless-instrumentation-tags-v1-AwsSqsEventTags)
    - [AwsTags](#serverless-instrumentation-tags-v1-AwsTags)
    - [HttpRouterTags](#serverless-instrumentation-tags-v1-HttpRouterTags)
  
    - [AwsLambdaTags.Outcome](#serverless-instrumentation-tags-v1-AwsLambdaTags-Outcome)
    - [AwsLambdaTags.ResponseMode](#serverless-instrumentation-tags-v1-AwsLambdaTags-ResponseMode)
  
- [serverless/instrumentation/tags/v1/common.proto](#serverless_instrumentation_tags_v1_common-proto)
    - [HttpTags](#serverless-instrumentation-tags-v1-HttpTags)
  
- [serverless/instrumentation/tags/v1/error.proto](#serverless_instrumentation_tags_v1_error-proto)
    - [ErrorTags](#serverless-instrumentation-tags-v1-ErrorTags)
  
    - [ErrorTags.ErrorType](#serverless-instrumentation-tags-v1-ErrorTags-ErrorType)
  
- [serverless/instrumentation/tags/v1/notice.proto](#serverless_instrumentation_tags_v1_notice-proto)
    - [NoticeTags](#serverless-instrumentation-tags-v1-NoticeTags)
  
    - [NoticeTags.NoticeType](#serverless-instrumentation-tags-v1-NoticeTags-NoticeType)
  
- [serverless/instrumentation/tags/v1/tags.proto](#serverless_instrumentation_tags_v1_tags-proto)
    - [DashboardTags](#serverless-instrumentation-tags-v1-DashboardTags)
    - [SdkTags](#serverless-instrumentation-tags-v1-SdkTags)
    - [SlsTags](#serverless-instrumentation-tags-v1-SlsTags)
    - [Tags](#serverless-instrumentation-tags-v1-Tags)
  
- [serverless/instrumentation/tags/v1/warning.proto](#serverless_instrumentation_tags_v1_warning-proto)
    - [WarningTags](#serverless-instrumentation-tags-v1-WarningTags)
  
    - [WarningTags.WarningType](#serverless-instrumentation-tags-v1-WarningTags-WarningType)
  
- [serverless/instrumentation/v1/dev_mode.proto](#serverless_instrumentation_v1_dev_mode-proto)
    - [DevModePayload](#serverless-instrumentation-v1-DevModePayload)
    - [DevModeTransportPayload](#serverless-instrumentation-v1-DevModeTransportPayload)
    - [LambdaTelemetry](#serverless-instrumentation-v1-LambdaTelemetry)
  
- [serverless/instrumentation/v1/event.proto](#serverless_instrumentation_v1_event-proto)
    - [Event](#serverless-instrumentation-v1-Event)
    - [EventPayload](#serverless-instrumentation-v1-EventPayload)
  
- [serverless/instrumentation/v1/log.proto](#serverless_instrumentation_v1_log-proto)
    - [LogEvent](#serverless-instrumentation-v1-LogEvent)
    - [LogPayload](#serverless-instrumentation-v1-LogPayload)
  
- [serverless/instrumentation/v1/metric.proto](#serverless_instrumentation_v1_metric-proto)
    - [Metric](#serverless-instrumentation-v1-Metric)
    - [Metric.ValueAtQuantile](#serverless-instrumentation-v1-Metric-ValueAtQuantile)
    - [MetricPayload](#serverless-instrumentation-v1-MetricPayload)
  
- [serverless/instrumentation/v1/request_response.proto](#serverless_instrumentation_v1_request_response-proto)
    - [RequestResponse](#serverless-instrumentation-v1-RequestResponse)
  
    - [RequestResponse.Origin](#serverless-instrumentation-v1-RequestResponse-Origin)
  
- [serverless/instrumentation/v1/trace.proto](#serverless_instrumentation_v1_trace-proto)
    - [Span](#serverless-instrumentation-v1-Span)
    - [TracePayload](#serverless-instrumentation-v1-TracePayload)
  
- [Scalar Value Types](#scalar-value-types)



<a name="serverless_instrumentation_tags_v1_aws-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/tags/v1/aws.proto



<a name="serverless-instrumentation-tags-v1-AwsApiGatewayTags"></a>

### AwsApiGatewayTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| account_id | [string](#string) |  | The AWS Account ID of the API GW. |
| api_id | [string](#string) |  | The unique id used for the API GW. |
| api_stage | [string](#string) |  | The stage of the API GW endpoint that was called. |
| request | [AwsApiGatewayTags.AwsApiGatewayRequestTags](#serverless-instrumentation-tags-v1-AwsApiGatewayTags-AwsApiGatewayRequestTags) |  |  |






<a name="serverless-instrumentation-tags-v1-AwsApiGatewayTags-AwsApiGatewayRequestTags"></a>

### AwsApiGatewayTags.AwsApiGatewayRequestTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [string](#string) |  | The unique API GW Request ID. |
| time_epoch | [uint64](#uint64) |  | The request time in milliseconds from epoch. |
| path_parameter_names | [string](#string) | repeated | JSON string containing Request Path Parameters |






<a name="serverless-instrumentation-tags-v1-AwsLambdaInitializationTags"></a>

### AwsLambdaInitializationTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| initialization_duration | [uint32](#uint32) |  | The Initialization Duration of the Lambda Function. This is one part of the billed duration. Maps to the Cloudwatch Logs Report &#34;Init Duration&#34; |






<a name="serverless-instrumentation-tags-v1-AwsLambdaInvocationTags"></a>

### AwsLambdaInvocationTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| invocation_duration | [uint32](#uint32) |  | The Invocation Duration of the Lambda Function. This is one part of the billed duration. Maps to the Cloudwatch Logs Report &#34;Duration&#34; |






<a name="serverless-instrumentation-tags-v1-AwsLambdaRuntimeTags"></a>

### AwsLambdaRuntimeTags
Describes the AWS Lambda runtime details


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| identifier | [string](#string) |  | Runtime identifier |
| version | [string](#string) |  | Runtime version |
| arn | [string](#string) |  | Runtime ARN |






<a name="serverless-instrumentation-tags-v1-AwsLambdaTags"></a>

### AwsLambdaTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| arch | [string](#string) |  | The architecture of the Lambda function, currently either amd64 or arm64. |
| is_coldstart | [bool](#bool) |  | Was the invocation a cold start? |
| event_type | [string](#string) | optional | The event type for the invocation. |
| event_source | [string](#string) | optional | The event source for the invocation. |
| log_group | [string](#string) | optional | The Log Group for the Lambda Function. |
| log_stream_name | [string](#string) | optional | The Log Stream for the invocation. |
| max_memory | [uint32](#uint32) | optional | The Max Memory that is configured for the Lambda Function. |
| name | [string](#string) |  | The Lambda Function name. |
| request_id | [string](#string) |  | The Request ID for the invocation. |
| version | [string](#string) |  | The Lambda Function version. |
| account_id | [string](#string) | optional | The AWS Account ID of the Lambda Function |
| outcome | [AwsLambdaTags.Outcome](#serverless-instrumentation-tags-v1-AwsLambdaTags-Outcome) |  | The Outcome of the Lambda invocation |
| error_exception_message | [string](#string) | optional | Optional error exception message. |
| error_exception_stacktrace | [string](#string) | optional | Optional error exception stacktrace. |
| duration | [uint32](#uint32) | optional | The billed duration of the invocation in milliseconds. This will not be available when instrumented, this will be upserted into this tag set after the report log from Cloudwatch is available. |
| request_body | [string](#string) | optional | Request body |
| response_body | [string](#string) | optional | Response body |
| logs_start_time_unix | [uint64](#uint64) | optional | The Unix timestamp in milliseconds of the START log event of the invocation. |
| logs_end_time_unix | [uint64](#uint64) | optional | The Unix timestamp in milliseconds of the REPORT log event of the invocation. |
| response_mode | [AwsLambdaTags.ResponseMode](#serverless-instrumentation-tags-v1-AwsLambdaTags-ResponseMode) | optional | The event source for the invocation. |
| sqs | [AwsSqsEventTags](#serverless-instrumentation-tags-v1-AwsSqsEventTags) | optional | Will be set if the function is handling a SQS event |
| sns | [AwsSnsEventTags](#serverless-instrumentation-tags-v1-AwsSnsEventTags) | optional | Will be set if the function is handling a SNS event |
| http | [HttpTags](#serverless-instrumentation-tags-v1-HttpTags) | optional | Will be set if the function is handling HTTP requests via any method, API GW, Function URLs, etc. |
| api_gateway | [AwsApiGatewayTags](#serverless-instrumentation-tags-v1-AwsApiGatewayTags) | optional | Will be set if the function is handling HTTP requests via AWS API GW |
| http_router | [HttpRouterTags](#serverless-instrumentation-tags-v1-HttpRouterTags) | optional | Will be set if function is handling HTTP requests and there&#39;s routing functionality setup |
| initialization | [AwsLambdaInitializationTags](#serverless-instrumentation-tags-v1-AwsLambdaInitializationTags) | optional | The root AWS Lambda Span tags. |
| invocation | [AwsLambdaInvocationTags](#serverless-instrumentation-tags-v1-AwsLambdaInvocationTags) | optional | The AWS Lambda Invocation tags. |
| runtime | [AwsLambdaRuntimeTags](#serverless-instrumentation-tags-v1-AwsLambdaRuntimeTags) | optional | The AWS Lambda Runtime tags. |






<a name="serverless-instrumentation-tags-v1-AwsSdkDynamodbTags"></a>

### AwsSdkDynamodbTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| table_name | [string](#string) | optional | The DynamoDB table name |
| projection | [string](#string) | optional | The value of the ProjectionExpression request parameter. |
| scan_forward | [bool](#bool) | optional | The value of the ScanIndexForward request parameter. |
| attributes_to_get | [string](#string) | repeated | The value of the AttributesToGet request parameter. |
| consistent_read | [bool](#bool) | optional | The value of the ConsistentRead request parameter. |
| index_name | [string](#string) | optional | The value of the IndexName request parameter. |
| limit | [uint32](#uint32) | optional | The value of the Limit request parameter. |
| select | [string](#string) | optional | The value of the Select request parameter. |
| segment | [uint32](#uint32) | optional | The value of the Segment request parameter. |
| total_segments | [uint64](#uint64) | optional | The value of the TotalSegments request parameter. |
| filter | [string](#string) | optional | The value of the FilterExpression request parameter. |
| key_condition | [string](#string) | optional | The value of the KeyConditionExpression request parameter. |
| exclusive_start_key | [string](#string) | optional | JSON string of the ExclusiveStartKey request parameter. |
| attribute_values | [string](#string) | optional | JSON string of the ExpressionAttributeValues request parameter. |
| count | [uint64](#uint64) | optional | The value of the Count response parameter. |
| scanned_count | [uint64](#uint64) | optional | The value of the ScannedCount response parameter. |






<a name="serverless-instrumentation-tags-v1-AwsSdkSnsTags"></a>

### AwsSdkSnsTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| topic_name | [string](#string) | optional | The SNS Topic name taken from the TopicArn request parameter. |
| message_ids | [string](#string) | repeated | The message IDs provided in the SDK operation response. |






<a name="serverless-instrumentation-tags-v1-AwsSdkSqsTags"></a>

### AwsSdkSqsTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| queue_name | [string](#string) | optional | The SQS queue name |
| message_ids | [string](#string) | repeated | The message IDs provided in the SDK operation response. |






<a name="serverless-instrumentation-tags-v1-AwsSdkTags"></a>

### AwsSdkTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| region | [string](#string) | optional | The AWS Region this SDK call is being made against. |
| signature_version | [string](#string) | optional | AWS Authentication signature version of the request. |
| service | [string](#string) |  | The name of the service to which a request is made. |
| operation | [string](#string) |  | The name of the operation corresponding to the request. |
| request_id | [string](#string) | optional | The unique ID of the request. |
| error | [string](#string) | optional | An optional error returned from the AWS APIs. |
| dynamodb | [AwsSdkDynamodbTags](#serverless-instrumentation-tags-v1-AwsSdkDynamodbTags) | optional |  |
| sqs | [AwsSdkSqsTags](#serverless-instrumentation-tags-v1-AwsSdkSqsTags) | optional |  |
| sns | [AwsSdkSnsTags](#serverless-instrumentation-tags-v1-AwsSdkSnsTags) | optional |  |






<a name="serverless-instrumentation-tags-v1-AwsSnsEventTags"></a>

### AwsSnsEventTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| topic_name | [string](#string) |  | Taken from the TopicARN |
| message_ids | [string](#string) | repeated | Introspected from the events records |






<a name="serverless-instrumentation-tags-v1-AwsSqsEventTags"></a>

### AwsSqsEventTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| queue_name | [string](#string) |  | Taken from the eventSourceARN |
| message_ids | [string](#string) | repeated | Introspected from the events records |






<a name="serverless-instrumentation-tags-v1-AwsTags"></a>

### AwsTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| lambda | [AwsLambdaTags](#serverless-instrumentation-tags-v1-AwsLambdaTags) | optional | The root AWS Lambda Span tags |
| sdk | [AwsSdkTags](#serverless-instrumentation-tags-v1-AwsSdkTags) | optional | The AWS SDK Tags. These are only added when instrumented code makes a call to one of the AWS SDK functions |
| account_id | [string](#string) | optional | Account Id is added to all schemas originating from aws during ingest as part of our data enrichment process |
| region | [string](#string) | optional | Region is added to all schemas originating from aws during ingest as part of our data enrichment process |
| request_id | [string](#string) | optional | RequestId is added to all schemas originating from aws lambda during ingest as part of our data enrichment process |
| resource_name | [string](#string) | optional | ResourceName is added to all schemas originating from aws lambda during ingest as part of our data enrichment process |
| sequence_id | [string](#string) | optional | The monotonically increasing sequence id for a LogEvent originating from aws lambda. This is used to determine the ordering of messages in a given stream of logs. If this is a LogEvent coming from Cloudwatch Logs, it will be provided otherwise it is the responsibility of the log producer to generate a sequence id. |
| log_group | [string](#string) | optional | The Cloudwatch Log Group name for logs originating from aws lambda. |
| log_stream | [string](#string) | optional | The Cloudwatch Log Group Stream id for logs originating from aws lambda. |






<a name="serverless-instrumentation-tags-v1-HttpRouterTags"></a>

### HttpRouterTags
Describe routing of incoming HTTP requests.
Reflects configuration of a router used to route the request
It can be Express.js, or API Gateway if Express.js is not detected to be used


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| path | [string](#string) |  | The HTTP Path defined by the route handler (either express or API Gateway) |





 


<a name="serverless-instrumentation-tags-v1-AwsLambdaTags-Outcome"></a>

### AwsLambdaTags.Outcome
A Lambda function invocation can have one of the following
outcomes upon completion.

| Name | Number | Description |
| ---- | ------ | ----------- |
| OUTCOME_UNSPECIFIED | 0 | No outcome was registered. Either information on the outcome was not disclosed (which should never be the case), or the function invocation has not been finalized yet |
| OUTCOME_SUCCESS | 1 | Function handler returned successfully |
| OUTCOME_ERROR_INITIALIZATION | 2 | Function crashed at initialization |
| OUTCOME_ERROR_UNHANDLED | 3 | Function crashed in an unhandled way at invocation (a result of either uncaught exception or unhandled rejection) |
| OUTCOME_ERROR_TIMEOUT | 4 | Function timed out |
| OUTCOME_ERROR_HANDLED | 5 | Function handler resolved with an error (either error was passed to lambda callback, or async handler resolved with error rejection) |



<a name="serverless-instrumentation-tags-v1-AwsLambdaTags-ResponseMode"></a>

### AwsLambdaTags.ResponseMode


| Name | Number | Description |
| ---- | ------ | ----------- |
| RESPONSE_MODE_UNSPECIFIED | 0 | Mode not confirmed |
| RESPONSE_MODE_BUFFERED | 1 | Regular buffered response |
| RESPONSE_MODE_RESPONSE_STREAM | 2 | Stream response |


 

 

 



<a name="serverless_instrumentation_tags_v1_common-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/tags/v1/common.proto



<a name="serverless-instrumentation-tags-v1-HttpTags"></a>

### HttpTags
Generic tagset intended to describe incoming or outgoing HTTP requests


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| method | [string](#string) |  | The method of the HTTP Request |
| protocol | [string](#string) |  | The protocol of the HTTP Request |
| host | [string](#string) |  | The host of the HTTP Request |
| path | [string](#string) |  | The path of the HTTP Request |
| query_parameter_names | [string](#string) | repeated | Names of the query parameters |
| request_header_names | [string](#string) | repeated | Request header names |
| status_code | [uint32](#uint32) | optional | The Response Status Code. @validation_exact_number |
| error_code | [string](#string) | optional | Eventual request error code |





 

 

 

 



<a name="serverless_instrumentation_tags_v1_error-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/tags/v1/error.proto



<a name="serverless-instrumentation-tags-v1-ErrorTags"></a>

### ErrorTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| name | [string](#string) |  | The Error Name |
| message | [string](#string) | optional | The Error Message - Depending on runtime this is defined or not. |
| stacktrace | [string](#string) | optional | The Error stacktrace if applicable |
| type | [ErrorTags.ErrorType](#serverless-instrumentation-tags-v1-ErrorTags-ErrorType) |  |  |





 


<a name="serverless-instrumentation-tags-v1-ErrorTags-ErrorType"></a>

### ErrorTags.ErrorType


| Name | Number | Description |
| ---- | ------ | ----------- |
| ERROR_TYPE_UNSPECIFIED | 0 | No ErrorType was provided. This should never be the case and if it is received ingest will ignore it. |
| ERROR_TYPE_UNCAUGHT | 1 | An unexpected error that caused the application to fail |
| ERROR_TYPE_CAUGHT_USER | 2 | An error that was reported by user explictly via the Serverless SDK or console.error call Error doesn&#39;t explicitly fail the application. Multiple errors of this type can be reported during a single application run |
| ERROR_TYPE_CAUGHT_SDK_USER | 3 | An error that was reported by the Serverless SDK internally that reports user error (misuage of the SDK) Error doesn&#39;t explicitly fail the application. Multiple errors of this type can be reported during a single application run |
| ERROR_TYPE_CAUGHT_SDK_INTERNAL | 4 | An error that was reported by the Serverless SDK internally that reports internal SDK error Error doesn&#39;t explicitly fail the application. Multiple errors of this type can be reported during a single application run |


 

 

 



<a name="serverless_instrumentation_tags_v1_notice-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/tags/v1/notice.proto



<a name="serverless-instrumentation-tags-v1-NoticeTags"></a>

### NoticeTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| message | [string](#string) |  | Notice Message |
| type | [NoticeTags.NoticeType](#serverless-instrumentation-tags-v1-NoticeTags-NoticeType) | optional |  |





 


<a name="serverless-instrumentation-tags-v1-NoticeTags-NoticeType"></a>

### NoticeTags.NoticeType


| Name | Number | Description |
| ---- | ------ | ----------- |
| NOTICE_TYPE_UNSPECIFIED | 0 | Notice type not set |
| NOTICE_TYPE_SDK_INTERNAL | 1 | Signals SDK noteworthy event Event that&#39;s not relevant to the user but can be important instruction for the Console on how to process monitoring data of given case |


 

 

 



<a name="serverless_instrumentation_tags_v1_tags-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/tags/v1/tags.proto



<a name="serverless-instrumentation-tags-v1-DashboardTags"></a>

### DashboardTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| app | [string](#string) |  | The name of the Dashboard application that was instrumented. |
| service | [string](#string) |  | The name of the Dashboard service that was instrumented. |






<a name="serverless-instrumentation-tags-v1-SdkTags"></a>

### SdkTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| name | [string](#string) |  | The Name of the Serverless SDK used to instrument. |
| version | [string](#string) |  | The version of the Serverless SDK used to instrument. |
| runtime | [string](#string) | optional | SDK runtime (e.g. nodejs) |






<a name="serverless-instrumentation-tags-v1-SlsTags"></a>

### SlsTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| org_id | [string](#string) |  | A Serverless Platform OrgId. |
| platform | [string](#string) | optional | The platform that was instrumented. Currently Lambda is the only supported platform. |
| service | [string](#string) |  | The service that was instrumented. For Lambda this will be the function name by default. |
| region | [string](#string) | optional | The region that instrumentation was performed in. This is used to determine which Serverless Ingest API to use. |
| sdk | [SdkTags](#serverless-instrumentation-tags-v1-SdkTags) |  |  |
| environment | [string](#string) | optional | An optional environment that can be attached. If there is an applicable environment tag this will be attached in a data enrichment process during ingestion. |
| namespace | [string](#string) | optional | An optional namespace that can be attached. If there is an applicable namespace tag this will be attached in a data enrichment process during ingestion. |






<a name="serverless-instrumentation-tags-v1-Tags"></a>

### Tags
@validation_root


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| aws | [AwsTags](#serverless-instrumentation-tags-v1-AwsTags) | optional | These tags are used an AWS resource/sdk is the producer of the span |
| http | [HttpTags](#serverless-instrumentation-tags-v1-HttpTags) | optional | These tags are used when an http library is making an http request |
| https | [HttpTags](#serverless-instrumentation-tags-v1-HttpTags) | optional | These tags are used when an http library is making a https request |
| sdk | [SdkTags](#serverless-instrumentation-tags-v1-SdkTags) | optional | These sdk tags are added at ingest time so we know where the data was generated from |
| dashboard | [DashboardTags](#serverless-instrumentation-tags-v1-DashboardTags) | optional | These tags are used when a Dashboard app is instrumented. It is added to all schemas during ingest as part of our data enrichment process. |
| environment | [string](#string) | optional | Environment is added to all schemas during ingest as part of our data enrichment process @validation_top_level |
| namespace | [string](#string) | optional | Namespace is added to all schemas during ingest as part of our data enrichment process @validation_top_level |
| org_id | [string](#string) | optional | OrgId is added to all schemas during ingest as part of our data enrichment process @validation_top_level @validation_single_string |
| error | [ErrorTags](#serverless-instrumentation-tags-v1-ErrorTags) | optional | These tags are used when an error has occured and is reported on the event. |
| warning | [WarningTags](#serverless-instrumentation-tags-v1-WarningTags) | optional | These tags are used when a warning has occured and is reported on the event. |
| notice | [NoticeTags](#serverless-instrumentation-tags-v1-NoticeTags) | optional | These tags are used when noteworthy situation occurs and is reported on the event. |





 

 

 

 



<a name="serverless_instrumentation_tags_v1_warning-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/tags/v1/warning.proto



<a name="serverless-instrumentation-tags-v1-WarningTags"></a>

### WarningTags



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| message | [string](#string) |  | The Warning Message |
| stacktrace | [string](#string) | optional | Stack trace listing where the warning was reported |
| type | [WarningTags.WarningType](#serverless-instrumentation-tags-v1-WarningTags-WarningType) | optional |  |





 


<a name="serverless-instrumentation-tags-v1-WarningTags-WarningType"></a>

### WarningTags.WarningType


| Name | Number | Description |
| ---- | ------ | ----------- |
| WARNING_TYPE_UNSPECIFIED | 0 | Warning type not set |
| WARNING_TYPE_USER | 1 | Warning explicitly reported by user |
| WARNING_TYPE_SDK_USER | 2 | Warning reported internally by the SDK that signal potential misusage on user side |
| WARNING_TYPE_SDK_INTERNAL | 3 | Warning reported internally by the SDK that signal non fatal SDK issue |


 

 

 



<a name="serverless_instrumentation_v1_dev_mode-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/v1/dev_mode.proto



<a name="serverless-instrumentation-v1-DevModePayload"></a>

### DevModePayload
A DevMode Payload is a message that will contain reqRes data or span data
that is forwarded to ingest via the internal extension


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| account_id | [string](#string) |  | The AWS Account ID where this payload originated from |
| region | [string](#string) |  | The AWS Region where this payload originated from |
| request_id | [string](#string) |  | The lambda request id where this payload originated from |
| telemetry | [LambdaTelemetry](#serverless-instrumentation-v1-LambdaTelemetry) | optional | Extracted Lambda Telemetry API data |
| trace | [TracePayload](#serverless-instrumentation-v1-TracePayload) |  | The set of lambda traces that were generated via an internal extension |
| request_response | [RequestResponse](#serverless-instrumentation-v1-RequestResponse) |  | The req or response data from the instrumented lambda function |






<a name="serverless-instrumentation-v1-DevModeTransportPayload"></a>

### DevModeTransportPayload
DevMode Transport Payload that will be used to aggregate reqRes, traces, and logs
into a single payload that will be packaged and sent to our DevMode ingest.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| account_id | [string](#string) |  | The AWS Account ID where this payload originated from |
| region | [string](#string) |  | The AWS Region where this payload originated from |
| request_id | [string](#string) |  | The lambda request id where this payload originated from |
| request_response | [RequestResponse](#serverless-instrumentation-v1-RequestResponse) | repeated | The request/response data from the instrumented lambda function |
| traces | [TracePayload](#serverless-instrumentation-v1-TracePayload) | repeated | The set of lambda traces that were generated via an internal extension |
| logs | [LogPayload](#serverless-instrumentation-v1-LogPayload) | repeated | The logs generated via the telemetry API |






<a name="serverless-instrumentation-v1-LambdaTelemetry"></a>

### LambdaTelemetry
Lambda Telemetry API data. This data is only available for lambda functions that
have access to the telemetry API so it will not be included in all regions.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| init_duration_ms | [uint32](#uint32) | optional | Init duration in milliseconds as reported by the metrics on the platform.initReport event |
| runtime_duration_ms | [uint32](#uint32) | optional | Internal runtime duration in milliseconds as reported by the metrics on the platform.runtimeDone event |
| runtime_response_latency_ms | [uint32](#uint32) | optional | Internal runtime duration in milliseconds as reported by the responseLatency span on the platform.runtimeDone event |





 

 

 

 



<a name="serverless_instrumentation_v1_event-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/v1/event.proto



<a name="serverless-instrumentation-v1-Event"></a>

### Event



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [bytes](#bytes) |  | The Event ID, this will be a random 8-byte ID encoded as a length 16 lowercase hex string. |
| trace_id | [bytes](#bytes) |  | The Trace ID, this will be a random 16-byte ID encoded as a length 32 lowercase hex string. The Trace ID is what is used to group all spans for specific trace together. |
| span_id | [bytes](#bytes) | optional | An optional Span ID to be used to create to show the span context that the event was generated in. In practical terms, every span except the root span will have a parent span ID. |
| timestamp_unix_nano | [fixed64](#fixed64) |  | The timestamp of when the Event happened in nanoseconds from EPOCH. |
| event_name | [string](#string) |  | The name that is used internal in the Serverless platform to identify the event. |
| custom_tags | [string](#string) | optional | The optional customTags that can be attached to an event when published. This is expected to be a JSON object in string format. |
| custom_fingerprint | [string](#string) | optional | The optional custom fingerprint that will override our default fingerprinting approach |
| tags | [serverless.instrumentation.tags.v1.Tags](#serverless-instrumentation-tags-v1-Tags) |  | A message containing any number of Tagsets. |






<a name="serverless-instrumentation-v1-EventPayload"></a>

### EventPayload
An EventPayload is a message that will contain any number
of Events plus the global tags required by our Serverless Ingest Platform.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| sls_tags | [serverless.instrumentation.tags.v1.SlsTags](#serverless-instrumentation-tags-v1-SlsTags) |  |  |
| events | [Event](#serverless-instrumentation-v1-Event) | repeated | A list of Events to be ingested. Ingest does not impose a limit on the number of Events in a single payload. It is the responsibility of the Event producer to limit the size of payloads based on their own requirements. |





 

 

 

 



<a name="serverless_instrumentation_v1_log-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/v1/log.proto



<a name="serverless-instrumentation-v1-LogEvent"></a>

### LogEvent



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| timestamp | [fixed64](#fixed64) |  | The timestamp of when the LogEvent was created. |
| trace_id | [string](#string) | optional | The Trace Id that the log&#39;s are linked to. When ingesting LogEvents, ingest will attempt to infer the request_id from the payload and attach it. If it is not able to, then it will attempt to reconcile later. |
| body | [string](#string) |  | The LogEvent&#39;s body. |
| severity_text | [string](#string) |  | The calculated severity text value for a log |
| severity_number | [uint64](#uint64) |  | The calculated severity text value for a log |
| tags | [serverless.instrumentation.tags.v1.Tags](#serverless-instrumentation-tags-v1-Tags) | optional | A message containing any number of Tagsets |
| is_historical | [bool](#bool) | optional | Is historical is addedd via ingestion so that we can tell the differnce between historical payloads and live streamed payloads |
| type | [string](#string) | optional | Type is used to determine the kind of document that is being send via a livestream |






<a name="serverless-instrumentation-v1-LogPayload"></a>

### LogPayload
A LogPayload is a message that will contain any number of
LogEvents plus the global tags required by our Serverless Ingest Platform.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| sls_tags | [serverless.instrumentation.tags.v1.SlsTags](#serverless-instrumentation-tags-v1-SlsTags) |  |  |
| log_events | [LogEvent](#serverless-instrumentation-v1-LogEvent) | repeated | A list of LogEvents to be ingested. Ingest does not impose a limit on the number of LogEvents in a single payload. It is the responsibility of the LogEvents&#39; producers to limit the size of payloads based on their own requirements. |





 

 

 

 



<a name="serverless_instrumentation_v1_metric-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/v1/metric.proto



<a name="serverless-instrumentation-v1-Metric"></a>

### Metric



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [bytes](#bytes) |  | A unique id for the metric measurement. If this is a Metric from, The metric stream then it will be a randomly generated UUID at ingest time. |
| name | [string](#string) |  | The name of the metric. If this is a Metric from the Metric stream, it will be in the format amazonaws.com/&lt;metric_namespace&gt;/&lt;metric_name&gt;. The name is what will be mapped into influx. |
| start_time_unix_nano | [fixed64](#fixed64) |  | The start time of the measure. If this is a Metric from the Metric stream, it will be the Cloudwatch startTime property. |
| end_time_unix_nano | [fixed64](#fixed64) |  | The end time of the measure. If this is a Metric from the Metric stream, it will be the Cloudwatch endTime property. |
| tags | [string](#string) |  | Tags for the Metric. Any tags can be placed in this field, however, ingest will only write allowlisted, low cardinality tags to Influx. |
| count | [fixed64](#fixed64) |  | The number of datapoints for the Metric. If this is a Metric from the Metric stream, it will be the SampleCount from Cloudwatch |
| sum | [double](#double) |  | The sum of the datapoints for the Metric. |
| quantile_values | [Metric.ValueAtQuantile](#serverless-instrumentation-v1-Metric-ValueAtQuantile) | repeated | List of quantile values. If this is a Metric from the Metric stream, it will by default have quantile 0.0 and 1.0 to represent the min and max values. If defined during Metric&#39;s Stream setup it will have additional quantiles as well. |






<a name="serverless-instrumentation-v1-Metric-ValueAtQuantile"></a>

### Metric.ValueAtQuantile
A value at a given quantile of the distribution.
If a Metric has multiple samples, the Min and Max will be represented by,
1. Quantile = 1.0, is the max value
2. Quantile = 0.0, is the min value


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| quantile | [double](#double) |  |  |
| value | [double](#double) |  |  |






<a name="serverless-instrumentation-v1-MetricPayload"></a>

### MetricPayload
A MetricPayload is a message that will contain any number of
Metrics plus the global tags required by our Serverless Ingest Platform.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| sls_tags | [serverless.instrumentation.tags.v1.SlsTags](#serverless-instrumentation-tags-v1-SlsTags) |  |  |
| metrics | [Metric](#serverless-instrumentation-v1-Metric) | repeated | A list of Metrics to be ingested. Ingest does not impose a limit on the number of Metrics in a single payload. It is the responsibility of the metrics&#39; producers to limit the size of payloads based on their own requirements. |





 

 

 

 



<a name="serverless_instrumentation_v1_request_response-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/v1/request_response.proto



<a name="serverless-instrumentation-v1-RequestResponse"></a>

### RequestResponse
RequestResponse is the AWS Lambda Event and Response Data.
In the Serverless Platform there will be two of these payloads
One for Event payload and then one for the payload returned at the end of
the function invocation.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| sls_tags | [serverless.instrumentation.tags.v1.SlsTags](#serverless-instrumentation-tags-v1-SlsTags) |  | The Global Serverless Platform Tags |
| trace_id | [bytes](#bytes) | optional | The trace Id of the invocation |
| span_id | [bytes](#bytes) | optional | The span id of the root Lambda Span that request data is attached to on ingest. |
| request_id | [string](#string) | optional | The Lambda Request Id. |
| body | [string](#string) | optional | JSON string of the request or the response body In case of response may be omited if lambda resolved with no value |
| origin | [RequestResponse.Origin](#serverless-instrumentation-v1-RequestResponse-Origin) |  | Type of body |
| tags | [serverless.instrumentation.tags.v1.Tags](#serverless-instrumentation-tags-v1-Tags) | optional | A message containing any number of Tagsets |
| is_historical | [bool](#bool) | optional | Is historical is addedd via ingestion so that we can tell the differnce between historical payloads and live streamed payloads |
| type | [string](#string) | optional | Type is used to determine the kind of document that is being send via a livestream |
| timestamp | [fixed64](#fixed64) | optional | The timestamp of when the req/res data was generated. |





 


<a name="serverless-instrumentation-v1-RequestResponse-Origin"></a>

### RequestResponse.Origin


| Name | Number | Description |
| ---- | ------ | ----------- |
| ORIGIN_UNSPECIFIED | 0 | Not disclosed (not applicable as property is required) |
| ORIGIN_REQUEST | 1 | Function request event |
| ORIGIN_RESPONSE | 2 | Function handler response |


 

 

 



<a name="serverless_instrumentation_v1_trace-proto"></a>
<p align="right"><a href="#top">Top</a></p>

## serverless/instrumentation/v1/trace.proto



<a name="serverless-instrumentation-v1-Span"></a>

### Span



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [bytes](#bytes) |  | The Span ID, this will be a random 8-byte ID encoded as a length 16 lowercase hex string. |
| trace_id | [bytes](#bytes) |  | The Trace ID, this will be a random 16-byte ID encoded as a length 32 lowercase hex string. The Trace ID is what is used to group all spans for specific trace together. |
| parent_span_id | [bytes](#bytes) | optional | An optional Parent Span ID to be used to create a trace&#39;s Span Dependency graph. In practical terms, every span except the root span will have a parent span ID. |
| name | [string](#string) |  | The name of the span describes the type of span that is being produced. currently have a limited set of span names

- aws.lambda: Spans the full invocation duration of a lambda function - aws.lambda.invocation: Spans the cold-start duration of a lambda function |
| start_time_unix_nano | [fixed64](#fixed64) |  | The start time of the span in nanoseconds from EPOCH. |
| end_time_unix_nano | [fixed64](#fixed64) |  | The end time of the span in nanoseconds from EPOCH. An important invariant to keep in mind is that the root span will always have the latest end time. |
| tags | [serverless.instrumentation.tags.v1.Tags](#serverless-instrumentation-tags-v1-Tags) |  | A message containing any number of Tagsets |
| input | [string](#string) | optional | Eventual input body (e.g. HTTP request body) |
| output | [string](#string) | optional | Eventual output body (e.g. HTTP response body) |
| timestamp | [fixed64](#fixed64) | optional | The timestamp that is created in ingestion as the search key |
| is_historical | [bool](#bool) | optional | Is historical is addedd via ingestion so that we can tell the differnce between historical payloads and live streamed payloads |
| type | [string](#string) | optional | Type is used to determine the kind of document that is being send via a livestream |
| custom_tags | [string](#string) | optional | The optional custom tags to be set by the user This is expected to be a JSON object in string format. |






<a name="serverless-instrumentation-v1-TracePayload"></a>

### TracePayload
TracePayload is a message that will contain any number
of Spans plus the global tags required by our Serverless Ingest
Platform. A TracePayload DOES NOT necessarily mean that it is a
complete Trace. It may contain only a subset of Spans that
will make up the complete Trace.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| sls_tags | [serverless.instrumentation.tags.v1.SlsTags](#serverless-instrumentation-tags-v1-SlsTags) |  |  |
| spans | [Span](#serverless-instrumentation-v1-Span) | repeated | A list of Spans to be ingest. Ingest does not impose a limit on the number of Spans in a single payload. It is the responsibility of the Span producers to limit the size of payloads based on their own requirements. |
| events | [Event](#serverless-instrumentation-v1-Event) | repeated | A list of Events to be ingested. Ingest does not impose a limit on the number of Events in a single payload. It is the responsibility of the Event producers to limit the size of paylaods based on their own requirements. |
| custom_tags | [string](#string) | optional | The optional custom trace tags to be set by the user This is expected to be a JSON object in string format. |
| is_sampled_out | [bool](#bool) | optional | Whether the trace payload represents sampled out invocation and in result contains just core spans and no events |
| is_truncated | [bool](#bool) | optional | Whether the trace payload represents truncated result (to fit max 256KB size limit) |





 

 

 

 



## Scalar Value Types

| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
| <a name="double" /> double |  | double | double | float | float64 | double | float | Float |
| <a name="float" /> float |  | float | float | float | float32 | float | float | Float |
| <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
| <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
| <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="bool" /> bool |  | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |

---

### Proto Docs Working With Protobufs (`proto/docs/working-with-protobufs.md`)

# Working with Protobufs

At Serverless, we use Protobufs to describe the data schemas that will be used in our instrumentation libraries. 
The Serverless ingest platform only accept Protobufs that are implemented in this repo. To contribute to our Schemas, you must follow the rules below.

## Why Protobufs

We picked Protobufs in order to standardize the data sent from all instrumentation sources. Using Protobufs we can guarantee the data produced from our instrumentation SDKs will be in a format that our ingest services will always be able to parse. 

With Protobufs we get,

1. Strongly typed interfaces for Typescript and Go.
2. A Standard way for the platform to encode & decode ingest payloads.
3. Backward Compatibility for protobuf versions. When we make updates to our Protobufs, older versions of our instrumentation SDK and ingest will still be able to parse payloads.
4. Forward Compatibility. We can add fields to our protobufs for instrumentation without having to coordinate updates to ingest. Ingest will just ignore new fields. When we are ready to use that new field we can update ingest to be aware of it.

## Implementing New Messages

When creating a new message there are some guidelines to keep in mind,

1. Field numbers 1 - 15 take 1 byte to encode, that means when you define your message you should put fields that will always exist or be frequently accessed in fields 1 - 15.
2. We document all fields. If a field can be in our schema it can be documented for users to know what exactly it means.
3. Always use verbose names for messages and fields.
4. Fields should not influence other fields. If I have an optional field `a`, I should not have bool field called `isASet` for example.

Here is an example of what would be considered a message that does not meet our standards,

```protobuf
message Example {
  optional string some_infrequent_field = 1;
  optional string b = 2;
  bool isBSet = 3;
  string org_id = 20;
}
```

Looking at this, we can see that this message breaks all 4 of our core guidelines. First we have optional infrequently accessed fields within field numbers 1-15. Compare that to having `org_id`, a field we require in all our systems, at field number 20. Because of breaking guideline 1 we now have a larger encoded payload. Next we are breaking guideline 2, we have no comments on our fields and by extension no generated documentation for our users. We are breaking guideline 3 but having a field name `b` so not only do we have no comments, we have no way to infer what `b` represents. Finally we are breaking guideline 4 by having a boolean field `isBSet`. When we generated our language specific libraries containing these interfaces we can easily check for if `b` exists using language specific optional methods.

Now let's look at an example that meets all our standards,

```protobuf
// A DeploymentEvent contains information about the last time,
// a service was deployed to the Serverless Platfrom.
message DeploymentEvent {
  // A Serverless Platform OrgId
  string org_id = 1;
  // A Unique identifier for the service that DeploymentEvent is related to.
  string service_id = 2;
  // An optional Git Commit Id attached to this DeploymentEvent.
  optional string commit_id = 16;
  // An optional Git Commit Message attached to this DeploymentEvent.
  optional string commit_message = 17;
}
```
As we can see, with this message it is very clear what this message represents and what each field represents. We place fields that we know will be set and accessed at field number 1 and 2. While optional fields we make their field numbers greater than 15. This makes this message not only clear from the start but also gives us room to grow its definition, we have 13 more fields we can use for required fields, as well as creating an implicit boundary between required and optional fields.


## Updating Messages

The only supported update to messages is adding fields, and where absolutely necessary removing a field. You cannot change any part of an existing field.

### Adding a Field

Adding a new field is simple, find the next available field number and define your field. Ensure the field number is not reserved, the only time a field number would be reserved is if it was removed prior. 

Make sure to check the comments in the proto file itself as there may be specific ranges of field numbers based on optimizations and other considerations.

### Removing a Field

Removing a field should only be done when absolutely necessary. Given we do not want to break backwards compatibility with older versions of our libraries, we should only remove fields if there is a valid performance concern with that field remaining.

If a field is removed, you must reserve its field number and the field name so that it cannot be used again!

This does mean that you cannot reuse field names once removed. So extra care must be made when defining messages, once a field has been built into a package version, it is reserved no matter what.

---

### Node Packages Aws Lambda Sdk Docs Sdk Trace (`node/packages/aws-lambda-sdk/docs/sdk-trace.md`)

# AWS Lambda SDK Trace

For each function invocation single AWS Lambda SDK Trace is generated.

Before returning the result to AWS Lambda trace payload is written to the console with following log line:

```
SERVERLESS_TELEMETRY.T.<base64 encoded payload>
```

## Trace tags

_Tags exposed on top trace_

| Name          | Value                              |
| ------------- | ---------------------------------- |
| `orgId`       | Serverless Console organization id |
| `service`     | AWS Lambda function name           |
| `sdk.name`    | Name of this package               |
| `sdk.version` | Version of this package            |

## Trace spans

SDK automatically creates following spans, all spans expose [TraceSpan](https://github.com/serverless/console/tree/main/node/packages/sdk/trace-span.md) interface

### `aws.lambda`

Root span for each function invocation. In case of first invocation it contains two sub spans `aws.lambda.initializaton` and `aws.lambda.invocation`. For following invocations there's just `aws.lambda.invocation` sub span

**Parent:** _None_

#### Tags

##### Always present

| Name                      | Value                                                                                                                                                                |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `aws.lambda.arch`         | Type of computer processor that Lambda uses to run the function. Check [AWS Lambda Architectures](https://docs.aws.amazon.com/lambda/latest/dg/foundation-arch.html) |
| `aws.lambda.is_coldstart` | Whether it's a cold start invocation                                                                                                                                 |
| `aws.lambda.name`         | AWS Lambda function name                                                                                                                                             |
| `aws.lambda.request_id`   | The identifier of the invocation request                                                                                                                             |
| `aws.lambda.version`      | The version of the function                                                                                                                                          |
| `aws.lambda.outcome`      | The outcome of a function. Possible values are `'success'` and `'error:handled'`                                                                                     |

##### Error case

Tags set in case of `'error:handled'` outcome

| Name                                    | Value             |
| --------------------------------------- | ----------------- |
| `aws.lambda.error_exception_message`    | Error message     |
| `aws.lambda.error_exception_stacktrace` | Error stack trace |

##### HTTP Endpoint

Tags collected if event is sourced by either:

- AWS API Gateway v1 REST API endpoint configured with `AWS_PROXY` integration type.
- AWS API Gateway v2 HTTP API endpoint configured with either v1 or v2 version of a payload
- AWS Function URL

| Name                                    | Value                                                           |
| --------------------------------------- | --------------------------------------------------------------- |
| `aws.lambda.http.method`                | Request method                                                  |
| `aws.lambda.http.protocol`              | Endpoint protocol (e.g. `HTTP/1.1`)                             |
| `aws.lambda.http.host`                  | Endpoint Domain name                                            |
| `aws.lambda.http.path`                  | Request path                                                    |
| `aws.lambda.http.query_parameter_names` | Query parameter names                                           |
| `aws.lambda.http.request_header_names`  | Request header names                                            |
| `aws.lambda.http.status_code`           | Response status code                                            |
| `aws.lambda.http.error_code`            | Filled, if no or invalid status code is provided by the handler |

##### AWS API Gateway

Tags collected if event is sourced by either:

- AWS API Gateway v1 REST API endpoint configured with `AWS_PROXY` integration type.
- AWS API Gateway v2 HTTP API endpoint configured with either v1 or v2 version of a payload

| Name                                                  | Value                                                                                            |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `aws.lambda.event_source`                             | `"aws.apigateway"`                                                                               |
| `aws.lambda.event_type`                               | `"aws.apigateway.rest"`, `"aws.apigatewayv2.http.v1"` or `"aws.apigatewayv2.http.v2"`            |
| `aws.lambda.api_gateway.account_id`                   | Account id of API Gateway                                                                        |
| `aws.lambda.api_gateway.api_id`                       | API id                                                                                           |
| `aws.lambda.api_gateway.api_stage`                    | API stage                                                                                        |
| `aws.lambda.api_gateway.request.id`                   | API Gateway request id                                                                           |
| `aws.lambda.api_gateway.request.time_epoch`           | API Gateway request time                                                                         |
| `aws.lambda.api_gateway.request.path_parameter_names` | Path parameter names                                                                             |
| `aws.lambda.http_router.path`                         | Route path with unresolved param (potentally overriden by router framework as `express` if used) |

##### Function URL

Tags collected if event is sourced by Function URL

| Name                      | Value              |
| ------------------------- | ------------------ |
| `aws.lambda.event_source` | `"aws.lambda"`     |
| `aws.lambda.event_type`   | `"aws.lambda.url"` |

##### SQS queue message

Tags collected if event is sourced by SQS queue

| Name                         | Value                |
| ---------------------------- | -------------------- |
| `aws.lambda.event_source`    | `"aws.sqs"`          |
| `aws.lambda.event_type`      | `"aws.sqs"`          |
| `aws.lambda.sqs.queue_name`  | Queue name           |
| `aws.lambda.sqs.message_ids` | Array of message ids |

##### SNS topic message

Tags collected if event is sourced by SNS topic subscription

| Name                         | Value                |
| ---------------------------- | -------------------- |
| `aws.lambda.event_source`    | `"aws.sns"`          |
| `aws.lambda.event_type`      | `"aws.sns"`          |
| `aws.lambda.sns.topic_name`  | Topic name           |
| `aws.lambda.sns.message_ids` | Array of message ids |

---

### `aws.lambda.initialization`

Covers function initialization phase.

_Can be always accessed at `serverlessSdk.traceSpans.awsLambdaInitialization`_

**Parent**: `aws.lambda`

#### Tags

_None_

---

### `aws.lambda.invocation`

Covers function invocation phase.

_Current invocation span can always be accessed at `serverlessSdk.traceSpans.awsLambdaInvocation`_

**Parent**: `aws.lambda`

#### Tags

_None_

---

### Node Packages Aws Lambda Sdk Docs Sdk (`node/packages/aws-lambda-sdk/docs/sdk.md`)

# Serverless SDK

## Properties and methods of the `serverlessSdk`

Common properties for SDK are documented at [SDK API](https://github.com/serverless/console/tree/main/node/packages/sdk/docs/sdk.md)

This document describes properties specific to AWS Lambda SDK

### `.traceSpans`

_For detailed info on spans check [sdk-trace.md](./sdk-trace.md#trace-spans)_

- `root` (also aliased as `awsLambda`) - Root AWS lambda span
- `awsLambdaInitialization` - Initialization span
- `awsLambdaInvocation` - Invocation span (not available at _initialization_ phase)

### `serverlessSdk.instrumentation`

Most of the instrumentation is setup automatically, still there are scenarios when it's difficult to ensure that (e.g. when target modules are imported as ESM, or come from bundles). In such case instrumentation need to be set manually, and then following utilities should be used:

- `awsSdkV2.install(AWS)` - Instrument AWS SDK v2 (takes instance of SDK as the argument). See [instrumentation/aws-sdk](instrumentation/aws-sdk.md)
- `awsSdkV3Client.install(client)` - Instrument AWS SDK v3 client. See [instrumentation/aws-sdk](instrumentation/aws-sdk.md)
- `expressApp.install(express)` - Instrument Express. See [instrumentatiom/express-app](https://github.com/serverless/console/tree/main/node/packages/sdk/docs/instrumentation/express-app.md)

---

### Node Packages Sdk Docs Sdk (`node/packages/sdk/docs/sdk.md`)

# Serverless SDK

## Properties and methods of the `serverlessSdk`

### `.name`

Name of the used SDK package. By default `@serverless/sdk`, but if environment extension is used, it's overriden (to e.g. `@serverless/aws-lambda-sdk`)

### `.version`

Package version

### `.orgId`

Authenticated Serverless Console organization id

### `.traceSpans`

Dictionary of common spans created in context of given environment

### `.instrumentation`

Most of the instrumentation is setup automatically, still there are scenarios when it's difficult to ensure that (e.g. when target modules are bundled). In such case instrumentation need to be set manually. In context of `@serverless/sdk` following instrumentation extensions are provided:

- `.instrumentation.expressApp.install(express)` - Instrument Express. See [instrumentatiom/express-app](instrumentation/express-app.md)

### `.captureError(error[, options])`

Record captured error. Captured error is sent to Serverless Console backend and printed to the stdout in structured format (writing to stdout can be disabled with `SLS_DISABLE_CAPTURED_EVENTS_STDOUT` env var)

- `error` - Captured error
- `options`:
  - `tags` _(object)_ - User tags object. Tag names can contain alphanumeric (both lower and upper case), `-`, `_` and `.` characters. Values can be _string_, _boolean_, _number_, Date or Array containing any values of prior listed types
  - `fingerprint` _(string)_ - Console UI groups common errors by the _fingerprint_, which by default is derived from the error stack trace. This can be overriden by passing custom `fingerprint` value

### `.captureWarning(message[, options])`

Record warning. Captured warning is sent to Serverless Console backend and printed to the stdout in structured format (writing to stdout can be disabled with `SLS_DISABLE_CAPTURED_EVENTS_STDOUT` env var)

- `message` - Warning message
- `options`:
  - `tags` _(object)_ - User tags object. Tag names can contain alphanumeric (both lower and upper case), `-`, `_` and `.` characters. Values can be _string_, _boolean_, _number_, Date or Array containing any values of prior listed types
  - `fingerprint` _(string)_ - Console UI groups common warnings by the _fingerprint_, which by default is derived from its message. This can be overriden by passing custom `fingerprint` value

### `.setTag(name, value)`

Set custom (user defined) trace tag

- `name` _(string)_ - Tag name, can contain alphanumeric (both lower and upper case), `-`, `_` and `.` characters
- `value` (any) - Tag value. Can be _string_, _boolean_, _number_, _Date_ or _Array_ containing any values of prior listed types

---

### Node Packages Sdk Docs Trace Span (`node/packages/sdk/docs/trace-span.md`)

# TraceSpan

## Properties

### `name` _(string)_

Span name

### `traceId` _(string)_

Id of a trace (same for all spans in a trace)

### `spanId` _(string)_

Id of a span, unique for each span

### `startTime` _(bigInt)_

High-resolution nanoseconds timestamp, result of [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint) (not an epoch timestamp)

### `endTime` _(bigInt)_

High-resolution Nanoseconds timestamp, result of [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint) (not an epoch timestamp)

### `parentSpan` _(TraceSpan)_

Parent `TraceSpan` (`null` in case of a root span)

### `subSpans` _(Set(...TraceSpan))_

Set of all direct sub spans

### `spans` _(Set(...TraceSpan))_

Set of all descendant spans (dynamically resolved)

### `tags` _(Map)_

Map of internal tags set on a span.

### `input` _(string)_

Eventual span input body

### `output` _(string)_

Eventual span output body

## Methods

#### `toJSON()`

Returns JSON representation of the span

---

### Python Packages Aws Lambda Sdk Docs Sdk Trace (`python/packages/aws-lambda-sdk/docs/sdk-trace.md`)

# AWS Lambda SDK Trace

For each function invocation single AWS Lambda SDK Trace is generated.

Before returning the result to AWS Lambda trace payload is written to the console with following log line:

```
SERVERLESS_TELEMETRY.T.<base64 encoded payload>
```

## Trace tags

_Tags exposed on top trace_

| Name          | Value                              |
| ------------- | ---------------------------------- |
| `orgId`       | Serverless Console organization id |
| `service`     | AWS Lambda function name           |
| `sdk.name`    | Name of this package               |
| `sdk.version` | Version of this package            |

## Trace spans

SDK automatically creates following spans, all spans expose [TraceSpan](/python/packages/sdk/trace-span.md) interface

### `aws.lambda`

Root span for each function invocation. In case of first invocation it contains two sub spans `aws.lambda.initializaton` and `aws.lambda.invocation`. For following invocations there's just `aws.lambda.invocation` sub span

**Parent:** _None_

#### Tags

##### Always present

| Name                      | Value                                                                                                                                                                |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `aws.lambda.arch`         | Type of computer processor that Lambda uses to run the function. Check [AWS Lambda Architectures](https://docs.aws.amazon.com/lambda/latest/dg/foundation-arch.html) |
| `aws.lambda.is_coldstart` | Whether it's a cold start invocation                                                                                                                                 |
| `aws.lambda.name`         | AWS Lambda function name                                                                                                                                             |
| `aws.lambda.request_id`   | The identifier of the invocation request                                                                                                                             |
| `aws.lambda.version`      | The version of the function                                                                                                                                          |
| `aws.lambda.outcome`      | The outcome of a function. Possible values are `'success'` and `'error:handled'`                                                                                     |

##### HTTP Endpoint

Tags collected if event is sourced by either:

- AWS API Gateway v1 REST API endpoint configured with `AWS_PROXY` integration type.
- AWS API Gateway v2 HTTP API endpoint configured with either v1 or v2 version of a payload
- AWS Function URL

| Name                                    | Value                                                           |
| --------------------------------------- | --------------------------------------------------------------- |
| `aws.lambda.http.method`                | Request method                                                  |
| `aws.lambda.http.protocol`              | Endpoint protocol (e.g. `HTTP/1.1`)                             |
| `aws.lambda.http.host`                  | Endpoint Domain name                                            |
| `aws.lambda.http.path`                  | Request path                                                    |
| `aws.lambda.http.query_parameter_names` | Query parameter names                                           |
| `aws.lambda.http.request_header_names`  | Request header names                                            |
| `aws.lambda.http.status_code`           | Response status code                                            |
| `aws.lambda.http.error_code`            | Filled, if no or invalid status code is provided by the handler |

##### AWS API Gateway

Tags collected if event is sourced by either:

- AWS API Gateway v1 REST API endpoint configured with `AWS_PROXY` integration type.
- AWS API Gateway v2 HTTP API endpoint configured with either v1 or v2 version of a payload

| Name                                                  | Value                                                                                            |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `aws.lambda.event_source`                             | `"aws.apigateway"`                                                                               |
| `aws.lambda.event_type`                               | `"aws.apigateway.rest"`, `"aws.apigatewayv2.http.v1"` or `"aws.apigatewayv2.http.v2"`            |
| `aws.lambda.api_gateway.account_id`                   | Account id of API Gateway                                                                        |
| `aws.lambda.api_gateway.api_id`                       | API id                                                                                           |
| `aws.lambda.api_gateway.api_stage`                    | API stage                                                                                        |
| `aws.lambda.api_gateway.request.id`                   | API Gateway request id                                                                           |
| `aws.lambda.api_gateway.request.time_epoch`           | API Gateway request time                                                                         |
| `aws.lambda.api_gateway.request.path_parameter_names` | Path parameter names                                                                             |
| `aws.lambda.http_router.path`                         | Route path with unresolved param (potentally overriden by router framework as `flask` if used) |

##### Function URL

Tags collected if event is sourced by Function URL

| Name                      | Value              |
| ------------------------- | ------------------ |
| `aws.lambda.event_source` | `"aws.lambda"`     |
| `aws.lambda.event_type`   | `"aws.lambda.url"` |

##### SQS queue message

Tags collected if event is sourced by SQS queue

| Name                         | Value                |
| ---------------------------- | -------------------- |
| `aws.lambda.event_source`    | `"aws.sqs"`          |
| `aws.lambda.event_type`      | `"aws.sqs"`          |
| `aws.lambda.sqs.queue_name`  | Queue name           |
| `aws.lambda.sqs.message_ids` | Array of message ids |

##### SNS topic message

Tags collected if event is sourced by SNS topic subscription

| Name                         | Value                |
| ---------------------------- | -------------------- |
| `aws.lambda.event_source`    | `"aws.sns"`          |
| `aws.lambda.event_type`      | `"aws.sns"`          |
| `aws.lambda.sns.topic_name`  | Topic name           |
| `aws.lambda.sns.message_ids` | Array of message ids |

---

### `aws.lambda.initialization`

Covers function initialization phase.

_Can be always accessed at `serverlessSdk.trace_spans.aws_lambda_initialization`_

**Parent**: `aws.lambda`

#### Tags

_None_

---

### `aws.lambda.invocation`

Covers function invocation phase.

_Current invocation span can always be accessed at `serverlessSdk.trace_spans.aws_lambda_invocation`_

**Parent**: `aws.lambda`

#### Tags

_None_

---

### Python Packages Aws Lambda Sdk Docs Sdk (`python/packages/aws-lambda-sdk/docs/sdk.md`)

# Serverless SDK

## Properties and methods of the `serverlessSdk`

Common properties for SDK are documented at [SDK API](https://github.com/serverless/console/tree/main/python/packages/sdk/docs/sdk.md)

This document describes properties specific to AWS Lambda SDK

### `.trace_spans`

_For detailed info on spans check [sdk-trace.md](./sdk-trace.md#trace-spans)_

- `root` (also aliased as `aws_lambda`) - Root AWS lambda span
- `aws_lambda_initialization` - Initialization span
- `aws_lambda_invocation` - Invocation span (not available at _initialization_ phase)

### `.instrumentation`

N/A

---

### Python Packages Sdk Docs Sdk (`python/packages/sdk/docs/sdk.md`)

# Serverless SDK

## Properties and methods of the `serverlessSdk`

### `.name`

Name of the used SDK package. By default `serverless-sdk`, but if environment extension is used, it's overriden (to e.g. `serverless-aws-lambda-sdk`)

### `.version`

Package version

### `.org_id`

Authenticated Serverless Console organization id

### `.trace_spans`

Dictionary of common spans created in context of given environment

### `.capture_error(error[, tags, fingerprint])`

Record captured error. Captured error is sent to Serverless Console backend and printed to the stdout in structured format (writing to stdout can be disabled with `SLS_DISABLE_CAPTURED_EVENTS_STDOUT` env var)

- `error` - Captured error
- `tags` _(object)_ - User tags object. Tag names can contain alphanumeric (both lower and upper case), `-`, `_` and `.` characters. Values can be _str_, _bool_, _int_, _float_, _datetime_ or _List_ containing any values of prior listed types
- `fingerprint` _(str)_ - Console UI groups common warnings by the _fingerprint_, which by default is derived from its message. This can be overriden by passing custom `fingerprint` value

### `.capture_warning(message[, tags, fingerprint])`

Record warning. Captured warning is sent to Serverless Console backend and printed to the stdout in structured format (writing to stdout can be disabled with `SLS_DISABLE_CAPTURED_EVENTS_STDOUT` env var)

- `message` - Warning message
- `tags` _(object)_ - User tags object. Tag names can contain alphanumeric (both lower and upper case), `-`, `_` and `.` characters. Values can be _str_, _bool_, _int_, _float_, _datetime_ or _List_ containing any values of prior listed types
- `fingerprint` _(str)_ - Console UI groups common warnings by the _fingerprint_, which by default is derived from its message. This can be overriden by passing custom `fingerprint` value

### `.set_tag(name, value)`

Set custom (user defined) trace tag

- `name` _(str)_ - Tag name, can contain alphanumeric (both lower and upper case), `-`, `_` and `.` characters
- `value` (any) - Tag value. Can be _str_, _bool_, _int_, _float_, _datetime_ or _List_ containing any values of prior listed types

### `.set_endpoint(endpoint)`

Sets a custom value for `aws.lambda.http_router.path` tag

- `endpoint` _(str)_ - Custom endpoint value to set as the tag's value

### `.create_span(name)`

Create custom trace span

- `name` _(str)_ - Span name, should contain dot separated tokens that follow the pattern `[a-z][a-z0-9]*`

## Thread safety

Public properties and methods of the `serverlessSdk` object is intended to be thread-safe without need for any special measurements to be taken by consumers.

---

### Python Packages Sdk Docs Trace Span (`python/packages/sdk/docs/trace-span.md`)

# TraceSpan

## Properties

### `name` _(string)_

Span name

### `trace_id` _(string)_

Id of a trace (same for all spans in a trace)

### `span_id` _(string)_

Id of a span, unique for each span

### `start_time` _(int)_

High-resolution nanoseconds timestamp, result of [`time.perf_counter_ns()`](https://docs.python.org/3/library/time.html#time.perf_counter_ns) (not an epoch timestamp)

### `end_time` _(int)_

High-resolution Nanoseconds timestamp, result of [`time.perf_counter_ns()`](https://docs.python.org/3/library/time.html#time.perf_counter_ns) (not an epoch timestamp)

### `parent_span` _(TraceSpan)_

Parent `TraceSpan` (`None` in case of a root span)

### `sub_spans` _(list(...TraceSpan))_

List of all direct sub spans

### `spans` _(Set(...TraceSpan))_

List of all descendant spans (dynamically resolved)

### `tags` _(dict)_

Dictionary of internal tags set on a span.

### `input` _(string)_

Eventual span input body

### `output` _(string)_

Eventual span output body

---

### Node Packages Aws Lambda Sdk Docs Instrumentation Aws Sdk (`node/packages/aws-lambda-sdk/docs/instrumentation/aws-sdk.md`)

# AWS SDK instrumentation

_Disable with `SLS_DISABLE_AWS_SDK_MONITORING` environment variable_

All AWS SDK requests are traced.

Tracing is turned on automatically for AWS SDK clients that are normally loaded via Node.js `require`.

However if AWS SDK is bundled then instrumentation needs to be turned on manually with following steps:

```javascript
import AWS from 'aws-sdk';

// Instrument AWS SDK v2:
serverlessSdk.instrumentation.awsSdkV2.install(AWS);

import { Lambda } from '@aws/client-lambda';
const lambda = new Lambda({ region: process.env.AWS_REGION });

// Instrument AWS SDK v3 Client
serverlessSdk.instrumentation.awsSdkV3Client.install(lambda);
```

Covered AWS SDK requests are reflected in `aws.sdk.<service-name>` spans

## Base span tags

Tags that apply to all AWS SDK requests:

| Name                        | Value                                                                                  |
| --------------------------- | -------------------------------------------------------------------------------------- |
| `aws.sdk.region`            | Region to which request is made                                                        |
| `aws.sdk.signature_version` | Signature version of request authentication (for latest versions of SDK it'll be "v4") |
| `aws.sdk.service`           | Service to which request is made                                                       |
| `aws.sdk.operation`         | Operation name (e.g. `listtopics`)                                                     |
| `aws.sdk.request_id`        | AWS reqeust id                                                                         |
| `aws.sdk.error`             | If request ends with error, the error message                                          |

## `aws.sdk.sns` span tags

Tags that apply to requests that go to SNS service

| Name                      | Value                    |
| ------------------------- | ------------------------ |
| `aws.sdk.sns.topic_name`  | Topic name               |
| `aws.sdk.sns.message_ids` | Ids of affected messages |

## `aws.sdk.sqs` span tags

Tags that apply to requests that go to SQS service

| Name                      | Value                    |
| ------------------------- | ------------------------ |
| `aws.sdk.sqs.queue_name`  | Queue name               |
| `aws.sdk.sqs.message_ids` | Ids of affected messages |

## `aws.sdk.dynamodb` span tags

Tags that apply to requests that go to DynamoDb service

| Name                                 | Value                                                       |
| ------------------------------------ | ----------------------------------------------------------- |
| `aws.sdk.dynamodb.table_name`        | Affected table name                                         |
| `aws.sdk.dynamodb.consistent_read`   | The value of the `ConsistentRead` request parameter         |
| `aws.sdk.dynamodb.limit`             | The value of the `Limit` request parameter                  |
| `aws.sdk.dynamodb.attributes_to_get` | The value of the `AttributesToGet` request parameter        |
| `aws.sdk.dynamodb.projection`        | The value of the `ProjectionExpression` request parameter   |
| `aws.sdk.dynamodb.index_name`        | The value of the `IndexName` request parameter              |
| `aws.sdk.dynamodb.scan_forward`      | The value of the `ScanIndexForward` request parameter       |
| `aws.sdk.dynamodb.select`            | The value of the `Select` request parameter                 |
| `aws.sdk.dynamodb.filter`            | The value of the `FilterExpression` request parameter       |
| `aws.sdk.dynamodb.key_condition`     | The value of the `KeyConditionExpression` request parameter |
| `aws.sdk.dynamodb.segment`           | The value of the `Segment` request parameter                |
| `aws.sdk.dynamodb.total_segments`    | The value of the `TotalSegments` request parameter          |
| `aws.sdk.dynamodb.count`             | The value of the `Count` response parameter                 |
| `aws.sdk.dynamodb.scanned_count`     | The value of the `ScannedCount` response parameter          |

## Request and response data

In developer mode, additionally request and response bodies are monitored. That can be disabled with `SLS_DISABLE_REQUEST_RESPONSE_MONITORING` environment variable

---

### Node Packages Sdk Docs Instrumentation Express App (`node/packages/sdk/docs/instrumentation/express-app.md`)

# [`express`](https://expressjs.com/) app instrumentation

_Disable with `SLS_DISABLE_EXPRESS_MONITORING` environment variable_

If [`express`](https://expressjs.com/) framework (together with tools like [`serverless-http`](https://github.com/dougmoscrop/serverless-http)) is used to route incoming requests. Trace spans for it's middlewares are created

Tracing is turned on automatically, assuming that `express` is loaded normally via Node.js `require`. If it comes bundled then instrumentation needs to be turned on manually with following steps:

```javascript
import express from 'express';

const app = express();

serverlessSdk.instrumentation.expressApp.install(app);
```

Handling of express route is covered in context of main `express` span. Additionally middleware jobs are recorded as following spans:

- `express.middleware.<name>`, generic middleware (setup via `app.use`)
- `express.middlewa.route.<method>.<name>` - route specific middleware (setup via `app.get`, `app.post` etc.)
- `express.middleware.error.<name>` - error handling middleware

#### Tags introduced on _root_ span

| Name                          | Value                 |
| ----------------------------- | --------------------- |
| `aws.lambda.http_router.path` | Middleware route path |

---

### Node Packages Sdk Docs Instrumentation Http (`node/packages/sdk/docs/instrumentation/http.md`)

# HTTP(S) requests

_Disable with `SLS_DISABLE_HTTP_MONITORING` environment variable_

All HTTP and HTTPS requests are monitored and stored as `node.http.request` & `node.https.request` trace spans.

## Trace span tags:

| Name                         | Value                                           |
| ---------------------------- | ----------------------------------------------- |
| `http.method`                | Request method (e.g. `GET`)                     |
| `http.protocol`              | Currently `HTTP/1.1` in all cases               |
| `http.host`                  | Domain name and port name if custom             |
| `http.path`                  | Request pathname (query string is not included) |
| `http.query_parameter_names` | Query string parameter names (if provided)      |
| `http.request_header_names`  | Request header names                            |
| `http.status_code`           | Response status code                            |
| `http.error_code`            | If request errored, its error code              |

# Request and response data

In developer mode, additionally request and response bodies are monitored. That can be disabled with `SLS_DISABLE_REQUEST_RESPONSE_MONITORING` environment variable

---

### Node Packages Sdk Docs Instrumentation Node Console (`node/packages/sdk/docs/instrumentation/node-console.md`)

# Node.js [`console`](https://nodejs.org/api/console.html) instrumentation

_Disable with `SLS_DISABLE_NODE_CONSOLE_MONITORING` environment variable_

All `console.error` invocations are monitored and propagated as [captured errors](../sdk.md#captureerrorerror-options) to the Serverless Console

---

### Python Packages Aws Lambda Sdk Docs Instrumentation Aws Sdk (`python/packages/aws-lambda-sdk/docs/instrumentation/aws-sdk.md`)

# AWS SDK instrumentation

_Disable with `SLS_DISABLE_AWS_SDK_MONITORING` environment variable_

All AWS SDK requests are traced.

Tracing is turned on automatically.

Covered AWS SDK requests are reflected in `aws.sdk.<service-name>` spans

## Base span tags

Tags that apply to all AWS SDK requests:

| Name                        | Value                                                                                  |
| --------------------------- | -------------------------------------------------------------------------------------- |
| `aws.sdk.region`            | Region to which request is made                                                        |
| `aws.sdk.signature_version` | Signature version of request authentication (for latest versions of SDK it'll be "v4") |
| `aws.sdk.service`           | Service to which request is made                                                       |
| `aws.sdk.operation`         | Operation name (e.g. `listtopics`)                                                     |
| `aws.sdk.request_id`        | AWS reqeust id                                                                         |
| `aws.sdk.error`             | If request ends with error, the error message                                          |

## `aws.sdk.sns` span tags

Tags that apply to requests that go to SNS service

| Name                      | Value                    |
| ------------------------- | ------------------------ |
| `aws.sdk.sns.topic_name`  | Topic name               |
| `aws.sdk.sns.message_ids` | Ids of affected messages |

## `aws.sdk.sqs` span tags

Tags that apply to requests that go to SQS service

| Name                      | Value                    |
| ------------------------- | ------------------------ |
| `aws.sdk.sqs.queue_name`  | Queue name               |
| `aws.sdk.sqs.message_ids` | Ids of affected messages |

## `aws.sdk.dynamodb` span tags

Tags that apply to requests that go to DynamoDb service

| Name                                 | Value                                                       |
| ------------------------------------ | ----------------------------------------------------------- |
| `aws.sdk.dynamodb.table_name`        | Affected table name                                         |
| `aws.sdk.dynamodb.consistent_read`   | The value of the `ConsistentRead` request parameter         |
| `aws.sdk.dynamodb.limit`             | The value of the `Limit` request parameter                  |
| `aws.sdk.dynamodb.attributes_to_get` | The value of the `AttributesToGet` request parameter        |
| `aws.sdk.dynamodb.projection`        | The value of the `ProjectionExpression` request parameter   |
| `aws.sdk.dynamodb.index_name`        | The value of the `IndexName` request parameter              |
| `aws.sdk.dynamodb.scan_forward`      | The value of the `ScanIndexForward` request parameter       |
| `aws.sdk.dynamodb.select`            | The value of the `Select` request parameter                 |
| `aws.sdk.dynamodb.filter`            | The value of the `FilterExpression` request parameter       |
| `aws.sdk.dynamodb.key_condition`     | The value of the `KeyConditionExpression` request parameter |
| `aws.sdk.dynamodb.segment`           | The value of the `Segment` request parameter                |
| `aws.sdk.dynamodb.total_segments`    | The value of the `TotalSegments` request parameter          |
| `aws.sdk.dynamodb.count`             | The value of the `Count` response parameter                 |
| `aws.sdk.dynamodb.scanned_count`     | The value of the `ScannedCount` response parameter          |

## Request and response data

In developer mode, additionally request and response bodies are monitored. That can be disabled with `SLS_DISABLE_REQUEST_RESPONSE_MONITORING` environment variable

---

### Python Packages Sdk Docs Instrumentation Flask App (`python/packages/sdk/docs/instrumentation/flask-app.md`)

# [`flask`](https://pypi.org/project/Flask/) app instrumentation

_Disable with `SLS_DISABLE_FLASK_MONITORING` environment variable_.

If [`flask`](https://pypi.org/project/Flask/) framework is used to route incoming requests, related trace spans are created.

Tracing is turned on automatically.

Handling of flask is covered in context of main `flask` span. Additionally following spans are available
- `flask.route.<method>.<name>` - route specific span (setup via `@app.route`)
- `flask.error.<name>` - handler for errors

---

### Python Packages Sdk Docs Instrumentation Http (`python/packages/sdk/docs/instrumentation/http.md`)

# HTTP(S) requests

_Disable with `SLS_DISABLE_HTTP_MONITORING` environment variable_

HTTP and HTTPS requests made with http clients listed below are monitored and stored as `python.http.request` & `python.https.request` trace spans.

## Supported clients
* `http.client`
* `urllib`
* `urllib3`
* `requests`
* `aiohttp`


## Trace span tags:

| Name                         | Value                                           |
| ---------------------------- | ----------------------------------------------- |
| `http.method`                | Request method (e.g. `GET`)                     |
| `http.protocol`              | Currently `HTTP/1.1` in all cases               |
| `http.host`                  | Domain name and port name if custom             |
| `http.path`                  | Request pathname (query string is not included) |
| `http.query_parameter_names` | Query string parameter names (if provided)      |
| `http.request_header_names`  | Request header names                            |
| `http.status_code`           | Response status code                            |
| `http.error_code`            | If request errored, its error code              |

# Request and response data

In developer mode, additionally request and response bodies are monitored. That can be disabled with `SLS_DISABLE_REQUEST_RESPONSE_MONITORING` environment variable

---

### Python Packages Sdk Docs Instrumentation Python Logging (`python/packages/sdk/docs/instrumentation/python-logging.md`)

# Python [`logging module`](https://docs.python.org/3/library/logging.html) instrumentation

_Disable with `SLS_DISABLE_PYTHON_LOG_MONITORING` environment variable_

All `logging.error`, `logging.warning` & `logging.warn` invocations are monitored and propagated as [captured errors](../sdk.md#capture_errorerror-tags) to the Serverless Console

---

--- METRICS ---
- Files Extracted: 19
- Estimated Token Budget: ~22813 tokens
- Canonical Reference: https://codewiki.google/github.com/serverless/dashboard
