Socket
Socket
Sign inDemoInstall

github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter

Package Overview
Dependencies
58
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter

Package awsxrayexporter implements an OpenTelemetry Collector exporter that sends trace data to AWS X-Ray in the region the collector is running in using the PutTraceSegments API.


Version published

Readme

Source

AWS X-Ray Tracing Exporter for OpenTelemetry Collector

Status
Stabilitybeta: traces
Distributionscontrib, aws, liatrio, observiq
IssuesOpen issues Closed issues
Code Owners@wangzlei, @srprash

This exporter converts OpenTelemetry spans to AWS X-Ray Segment Documents and then sends them directly to X-Ray using the PutTraceSegments API.

Data Conversion

Trace IDs and Span IDs are expected to be originally generated by either AWS API Gateway or AWS ALB and propagated by them using the X-Amzn-Trace-Id HTTP header. However, other generation sources are supported by replacing fully-random Trace IDs with X-Ray formatted Trace IDs where necessary:

AWS X-Ray IDs are the same size as W3C Trace Context IDs but differ in that the first 32 bits of a Trace ID is the Unix epoch time when the trace was started. Note that X-Ray only allows submission of Trace IDs from the past 30 days, otherwise the trace is dropped by X-Ray. The Exporter will not validate this timestamp.

This means that until X-Ray supports Trace Ids consisting of fully random bits, in order for spans to appear in X-Ray, the client SDK MUST use an X-Ray ID generator. For more information, see configuring the X-Ray exporter.

The http object is populated when the component attribute value is grpc as well as http. Other synchronous call types should also result in the http object being populated.

AWS Specific Attributes

The following AWS-specific Span attributes are supported in addition to the standard names and values defined in the OpenTelemetry Semantic Conventions.

Attribute nameNotes and examplesRequired?
aws.operationThe name of the API action invoked against an AWS service or resource.No
aws.account_idThe AWS account number if accessing resource in different account.No
aws.regionThe AWS region if accessing resource in different region from app.No
aws.request_idAWS-generated unique identifier for the request.No
aws.queue_urlFor operations on an Amazon SQS queue, the queue's URL.No
aws.table_nameFor operations on a DynamoDB table, the name of the table.No

Any of these values supplied are used to populate the aws object in addition to any relevant data supplied by the Span Resource object. X-Ray uses this data to generate inferred segments for the remote APIs.

Exporter Configuration

The following exporter configuration parameters are supported. They mirror and have the same effect as the comparable AWS X-Ray Daemon configuration values.

NameDescriptionDefault
num_workersMaximum number of concurrent calls to AWS X-Ray to upload documents.8
endpointOptionally override the default X-Ray service endpoint.
request_timeout_secondsNumber of seconds before timing out a request.30
max_retriesMaximun number of attempts to post a batch before failing.2
no_verify_sslEnable or disable TLS certificate verification.false
proxy_addressUpload segments to AWS X-Ray through a proxy.
regionSend segments to AWS X-Ray service in a specific region.
local_modeLocal mode to skip EC2 instance metadata check.false
resource_arnAmazon Resource Name (ARN) of the AWS resource running the collector.
role_arnIAM role to upload segments to a different account.
indexed_attributesList of attribute names to be converted to X-Ray annotations.
index_all_attributesEnable or disable conversion of all OpenTelemetry attributes to X-Ray annotations.false
aws_log_groupsList of log group names for CloudWatch.[]
telemetry.enabledWhether telemetry collection is enabled at all.false
telemetry.include_metadataWhether to include metadata in the telemetry (InstanceID, Hostname, ResourceARN)false
telemetry.contributorsList of X-Ray component IDs contributing to the telemetry (ex. for multiple X-Ray receivers: awsxray/1, awsxray/2)
telemetry.hostnameSets the Hostname included in the telemetry.
telemetry.instance_idSets the InstanceID included in the telemetry.
telemetry.resource_arnSets the Amazon Resource Name (ARN) included in the telemetry.

Traces and logs correlation

AWS X-Ray can be integrated with CloudWatch Logs to correlate traces with logs. For this integration to work, the X-Ray segments must have the AWS Property cloudwatch_logs set. This property is set using the AWS X-Ray exporter with the following values that are evaluated in this order:

  1. aws.log.group.arns resource attribute.
  2. aws.log.group.names resource attribute.
  3. aws_log_groups configuration property.

In the case of multiple values are defined, the value with higher precedence will be used to set the cloudwatch_logs AWS Property.

aws.log.group.arns and aws.log.group.names are slice resource attributes that can be set programmatically. Alternatively those resource attributes can be set using the OTEL_RESOURCE_ATTRIBUTES environment variable. In this case only a single log group/log group arn can be provided as a string rather than a slice.

AWS Credential Configuration

This exporter follows default credential resolution for the aws-sdk-go.

Follow the guidelines for the credential configuration.

FAQs

Last updated on 26 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc