Class: AWS.XRay

Inherits:
AWS.Service show all
Identifier:
xray
API Version:
2016-04-12
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Sending a Request Using XRay

var xray = new AWS.XRay();
xray.batchGetTraces(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the XRay object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var xray = new AWS.XRay({apiVersion: '2016-04-12'});

You can also set the API version globally in AWS.config.apiVersions using the xray service identifier:

AWS.config.apiVersions = {
  xray: '2016-04-12',
  // other service API versions
};

var xray = new AWS.XRay();

Version:

  • 2016-04-12

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.XRay(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a XRay object

var xray = new AWS.XRay({apiVersion: '2016-04-12'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com'.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.XRay.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.XRay.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.XRay.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and returns the amount of time to delay in milliseconds. The base option will be ignored if this option is supplied.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

batchGetTraces(params = {}, callback) ⇒ AWS.Request

Retrieves a list of traces specified by ID. Each trace is a collection of segment documents that originates from a single request. Use GetTraceSummaries to get a list of trace IDs.

Service Reference:

Examples:

Calling the batchGetTraces operation

var params = {
  TraceIds: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  NextToken: 'STRING_VALUE'
};
xray.batchGetTraces(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TraceIds — (Array<String>)

      Specify the trace IDs of requests for which to retrieve segments.

    • NextToken — (String)

      Pagination token. Not used.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Traces — (Array<map>)

        Full traces for the specified requests.

        • Id — (String)

          The unique identifier for the request that generated the trace's segments and subsegments.

        • Duration — (Float)

          The length of time in seconds between the start time of the root segment and the end time of the last segment that completed.

        • Segments — (Array<map>)

          Segment documents for the segments and subsegments that comprise the trace.

          • Id — (String)

            The segment's ID.

          • Document — (String)

            The segment document

      • UnprocessedTraceIds — (Array<String>)

        Trace IDs of requests that haven't been processed.

      • NextToken — (String)

        Pagination token. Not used.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getServiceGraph(params = {}, callback) ⇒ AWS.Request

Retrieves a document that describes services that process incoming requests, and downstream services that they call as a result. Root services process incoming requests and make calls to downstream services. Root services are applications that use the AWS X-Ray SDK. Downstream services can be other applications, AWS resources, HTTP web APIs, or SQL databases.

Service Reference:

Examples:

Calling the getServiceGraph operation

var params = {
  EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  NextToken: 'STRING_VALUE'
};
xray.getServiceGraph(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • StartTime — (Date)

      The start of the time frame for which to generate a graph.

    • EndTime — (Date)

      The end of the time frame for which to generate a graph.

    • NextToken — (String)

      Pagination token. Not used.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • StartTime — (Date)

        The start of the time frame for which the graph was generated.

      • EndTime — (Date)

        The end of the time frame for which the graph was generated.

      • Services — (Array<map>)

        The services that have processed a traced request during the specified time frame.

        • ReferenceId — (Integer)

          Identifier for the service. Unique within the service map.

        • Name — (String)

          The canonical name of the service.

        • Names — (Array<String>)

          A list of names for the service, including the canonical name.

        • Root — (Boolean)

          Indicates that the service was the first service to process a request.

        • AccountId — (String)

          Identifier of the AWS account in which the service runs.

        • Type — (String)

          The type of service.

          • AWS Resource - The type of an AWS resource. For example, AWS::EC2::Instance for a application running on Amazon EC2 or AWS::DynamoDB::Table for an Amazon DynamoDB table that the application used.

          • AWS Service - The type of an AWS service. For example, AWS::DynamoDB for downstream calls to Amazon DynamoDB that didn't target a specific table.

          • client - Represents the clients that sent requests to a root service.

          • remote - A downstream service of indeterminate type.

        • State — (String)

          The service's state.

        • StartTime — (Date)

          The start time of the first segment that the service generated.

        • EndTime — (Date)

          The end time of the last segment that the service generated.

        • Edges — (Array<map>)

          Connections to downstream services.

          • ReferenceId — (Integer)

            Identifier of the edge. Unique within a service map.

          • StartTime — (Date)

            The start time of the first segment on the edge.

          • EndTime — (Date)

            The end time of the last segment on the edge.

          • SummaryStatistics — (map)

            Response statistics for segments on the edge.

            • OkCount — (Integer)

              The number of requests that completed with a 2xx Success status code.

            • ErrorStatistics — (map)

              Information about requests that failed with a 4xx Client Error status code.

              • ThrottleCount — (Integer)

                The number of requests that failed with a 419 throttling status code.

              • OtherCount — (Integer)

                The number of requests that failed with untracked 4xx Client Error status codes.

              • TotalCount — (Integer)

                The total number of requests that failed with a 4xx Client Error status code.

            • FaultStatistics — (map)

              Information about requests that failed with a 5xx Server Error status code.

              • OtherCount — (Integer)

                The number of requests that failed with untracked 5xx Server Error status codes.

              • TotalCount — (Integer)

                The total number of requests that failed with a 5xx Server Error status code.

            • TotalCount — (Integer)

              The total number of completed requests.

            • TotalResponseTime — (Float)

              The aggregate response time of completed requests.

          • ResponseTimeHistogram — (Array<map>)

            A histogram that maps the spread of client response times on an edge.

            • Value — (Float)

              The value of the entry.

            • Count — (Integer)

              The prevalence of the entry.

          • Aliases — (Array<map>)

            Aliases for the edge.

            • Name — (String)

              The canonical name of the alias.

            • Names — (Array<String>)

              A list of names for the alias, including the canonical name.

            • Type — (String)

              The type of the alias.

        • SummaryStatistics — (map)

          Aggregated statistics for the service.

          • OkCount — (Integer)

            The number of requests that completed with a 2xx Success status code.

          • ErrorStatistics — (map)

            Information about requests that failed with a 4xx Client Error status code.

            • ThrottleCount — (Integer)

              The number of requests that failed with a 419 throttling status code.

            • OtherCount — (Integer)

              The number of requests that failed with untracked 4xx Client Error status codes.

            • TotalCount — (Integer)

              The total number of requests that failed with a 4xx Client Error status code.

          • FaultStatistics — (map)

            Information about requests that failed with a 5xx Server Error status code.

            • OtherCount — (Integer)

              The number of requests that failed with untracked 5xx Server Error status codes.

            • TotalCount — (Integer)

              The total number of requests that failed with a 5xx Server Error status code.

          • TotalCount — (Integer)

            The total number of completed requests.

          • TotalResponseTime — (Float)

            The aggregate response time of completed requests.

        • DurationHistogram — (Array<map>)

          A histogram that maps the spread of service durations.

          • Value — (Float)

            The value of the entry.

          • Count — (Integer)

            The prevalence of the entry.

        • ResponseTimeHistogram — (Array<map>)

          A histogram that maps the spread of service response times.

          • Value — (Float)

            The value of the entry.

          • Count — (Integer)

            The prevalence of the entry.

      • NextToken — (String)

        Pagination token. Not used.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getTraceGraph(params = {}, callback) ⇒ AWS.Request

Retrieves a service graph for one or more specific trace IDs.

Service Reference:

Examples:

Calling the getTraceGraph operation

var params = {
  TraceIds: [ /* required */
    'STRING_VALUE',
    /* more items */
  ],
  NextToken: 'STRING_VALUE'
};
xray.getTraceGraph(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TraceIds — (Array<String>)

      Trace IDs of requests for which to generate a service graph.

    • NextToken — (String)

      Pagination token. Not used.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Services — (Array<map>)

        The services that have processed one of the specified requests.

        • ReferenceId — (Integer)

          Identifier for the service. Unique within the service map.

        • Name — (String)

          The canonical name of the service.

        • Names — (Array<String>)

          A list of names for the service, including the canonical name.

        • Root — (Boolean)

          Indicates that the service was the first service to process a request.

        • AccountId — (String)

          Identifier of the AWS account in which the service runs.

        • Type — (String)

          The type of service.

          • AWS Resource - The type of an AWS resource. For example, AWS::EC2::Instance for a application running on Amazon EC2 or AWS::DynamoDB::Table for an Amazon DynamoDB table that the application used.

          • AWS Service - The type of an AWS service. For example, AWS::DynamoDB for downstream calls to Amazon DynamoDB that didn't target a specific table.

          • client - Represents the clients that sent requests to a root service.

          • remote - A downstream service of indeterminate type.

        • State — (String)

          The service's state.

        • StartTime — (Date)

          The start time of the first segment that the service generated.

        • EndTime — (Date)

          The end time of the last segment that the service generated.

        • Edges — (Array<map>)

          Connections to downstream services.

          • ReferenceId — (Integer)

            Identifier of the edge. Unique within a service map.

          • StartTime — (Date)

            The start time of the first segment on the edge.

          • EndTime — (Date)

            The end time of the last segment on the edge.

          • SummaryStatistics — (map)

            Response statistics for segments on the edge.

            • OkCount — (Integer)

              The number of requests that completed with a 2xx Success status code.

            • ErrorStatistics — (map)

              Information about requests that failed with a 4xx Client Error status code.

              • ThrottleCount — (Integer)

                The number of requests that failed with a 419 throttling status code.

              • OtherCount — (Integer)

                The number of requests that failed with untracked 4xx Client Error status codes.

              • TotalCount — (Integer)

                The total number of requests that failed with a 4xx Client Error status code.

            • FaultStatistics — (map)

              Information about requests that failed with a 5xx Server Error status code.

              • OtherCount — (Integer)

                The number of requests that failed with untracked 5xx Server Error status codes.

              • TotalCount — (Integer)

                The total number of requests that failed with a 5xx Server Error status code.

            • TotalCount — (Integer)

              The total number of completed requests.

            • TotalResponseTime — (Float)

              The aggregate response time of completed requests.

          • ResponseTimeHistogram — (Array<map>)

            A histogram that maps the spread of client response times on an edge.

            • Value — (Float)

              The value of the entry.

            • Count — (Integer)

              The prevalence of the entry.

          • Aliases — (Array<map>)

            Aliases for the edge.

            • Name — (String)

              The canonical name of the alias.

            • Names — (Array<String>)

              A list of names for the alias, including the canonical name.

            • Type — (String)

              The type of the alias.

        • SummaryStatistics — (map)

          Aggregated statistics for the service.

          • OkCount — (Integer)

            The number of requests that completed with a 2xx Success status code.

          • ErrorStatistics — (map)

            Information about requests that failed with a 4xx Client Error status code.

            • ThrottleCount — (Integer)

              The number of requests that failed with a 419 throttling status code.

            • OtherCount — (Integer)

              The number of requests that failed with untracked 4xx Client Error status codes.

            • TotalCount — (Integer)

              The total number of requests that failed with a 4xx Client Error status code.

          • FaultStatistics — (map)

            Information about requests that failed with a 5xx Server Error status code.

            • OtherCount — (Integer)

              The number of requests that failed with untracked 5xx Server Error status codes.

            • TotalCount — (Integer)

              The total number of requests that failed with a 5xx Server Error status code.

          • TotalCount — (Integer)

            The total number of completed requests.

          • TotalResponseTime — (Float)

            The aggregate response time of completed requests.

        • DurationHistogram — (Array<map>)

          A histogram that maps the spread of service durations.

          • Value — (Float)

            The value of the entry.

          • Count — (Integer)

            The prevalence of the entry.

        • ResponseTimeHistogram — (Array<map>)

          A histogram that maps the spread of service response times.

          • Value — (Float)

            The value of the entry.

          • Count — (Integer)

            The prevalence of the entry.

      • NextToken — (String)

        Pagination token. Not used.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getTraceSummaries(params = {}, callback) ⇒ AWS.Request

Retrieves IDs and metadata for traces available for a specified time frame using an optional filter. To get the full traces, pass the trace IDs to BatchGetTraces.

A filter expression can target traced requests that hit specific service nodes or edges, have errors, or come from a known user. For example, the following filter expression targets traces that pass through api.example.com:

service("api.example.com")

This filter expression finds traces that have an annotation named account with the value 12345:

annotation.account = "12345"

For a full list of indexed fields and keywords that you can use in filter expressions, see Using Filter Expressions in the AWS X-Ray Developer Guide.

Service Reference:

Examples:

Calling the getTraceSummaries operation

var params = {
  EndTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  StartTime: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789, /* required */
  FilterExpression: 'STRING_VALUE',
  NextToken: 'STRING_VALUE',
  Sampling: true || false
};
xray.getTraceSummaries(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • StartTime — (Date)

      The start of the time frame for which to retrieve traces.

    • EndTime — (Date)

      The end of the time frame for which to retrieve traces.

    • Sampling — (Boolean)

      Set to true to get summaries for only a subset of available traces.

    • FilterExpression — (String)

      Specify a filter expression to retrieve trace summaries for services or requests that meet certain requirements.

    • NextToken — (String)

      Specify the pagination token returned by a previous request to retrieve the next page of results.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TraceSummaries — (Array<map>)

        Trace IDs and metadata for traces that were found in the specified time frame.

        • Id — (String)

          The unique identifier for the request that generated the trace's segments and subsegments.

        • Duration — (Float)

          The length of time in seconds between the start time of the root segment and the end time of the last segment that completed.

        • ResponseTime — (Float)

          The length of time in seconds between the start and end times of the root segment. If the service performs work asynchronously, the response time measures the time before the response is sent to the user, while the duration measures the amount of time before the last traced activity completes.

        • HasFault — (Boolean)

          One or more of the segment documents has a 500 series error.

        • HasError — (Boolean)

          One or more of the segment documents has a 400 series error.

        • HasThrottle — (Boolean)

          One or more of the segment documents has a 429 throttling error.

        • IsPartial — (Boolean)

          One or more of the segment documents is in progress.

        • Http — (map)

          Information about the HTTP request served by the trace.

          • HttpURL — (String)

            The request URL.

          • HttpStatus — (Integer)

            The response status.

          • HttpMethod — (String)

            The request method.

          • UserAgent — (String)

            The request's user agent string.

          • ClientIp — (String)

            The IP address of the requestor.

        • Annotations — (map<Array<map>>)

          Annotations from the trace's segment documents.

          • AnnotationValue — (map)

            Values of the annotation.

            • NumberValue — (Float)

              Value for a Number annotation.

            • BooleanValue — (Boolean)

              Value for a Boolean annotation.

            • StringValue — (String)

              Value for a String annotation.

          • ServiceIds — (Array<map>)

            Services to which the annotation applies.

            • Name — (String)

            • Names — (Array<String>)

            • AccountId — (String)

            • Type — (String)

        • Users — (Array<map>)

          Users from the trace's segment documents.

          • UserName — (String)

            The user's name.

          • ServiceIds — (Array<map>)

            Services that the user's request hit.

            • Name — (String)

            • Names — (Array<String>)

            • AccountId — (String)

            • Type — (String)

        • ServiceIds — (Array<map>)

          Service IDs from the trace's segment documents.

          • Name — (String)

          • Names — (Array<String>)

          • AccountId — (String)

          • Type — (String)

      • ApproximateTime — (Date)

        The start time of this page of results.

      • TracesProcessedCount — (Integer)

        The number of traces that were processed to get this set of summaries.

      • NextToken — (String)

        If the requested time frame contained more than one page of results, you can use this token to retrieve the next page. The first page contains the most most recent results, closest to the end of the time frame.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putTelemetryRecords(params = {}, callback) ⇒ AWS.Request

Used by the AWS X-Ray daemon to upload telemetry.

Service Reference:

Examples:

Calling the putTelemetryRecords operation

var params = {
  TelemetryRecords: [ /* required */
    {
      BackendConnectionErrors: {
        ConnectionRefusedCount: 0,
        HTTPCode4XXCount: 0,
        HTTPCode5XXCount: 0,
        OtherCount: 0,
        TimeoutCount: 0,
        UnknownHostCount: 0
      },
      SegmentsReceivedCount: 0,
      SegmentsRejectedCount: 0,
      SegmentsSentCount: 0,
      SegmentsSpilloverCount: 0,
      Timestamp: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789
    },
    /* more items */
  ],
  EC2InstanceId: 'STRING_VALUE',
  Hostname: 'STRING_VALUE',
  ResourceARN: 'STRING_VALUE'
};
xray.putTelemetryRecords(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TelemetryRecords — (Array<map>)

      • Timestamp — (Date)

      • SegmentsReceivedCount — (Integer)

      • SegmentsSentCount — (Integer)

      • SegmentsSpilloverCount — (Integer)

      • SegmentsRejectedCount — (Integer)

      • BackendConnectionErrors — (map)

        • TimeoutCount — (Integer)

        • ConnectionRefusedCount — (Integer)

        • HTTPCode4XXCount — (Integer)

        • HTTPCode5XXCount — (Integer)

        • UnknownHostCount — (Integer)

        • OtherCount — (Integer)

    • EC2InstanceId — (String)

    • Hostname — (String)

    • ResourceARN — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putTraceSegments(params = {}, callback) ⇒ AWS.Request

Uploads segment documents to AWS X-Ray. The X-Ray SDK generates segment documents and sends them to the X-Ray daemon, which uploads them in batches. A segment document can be a completed segment, an in-progress segment, or an array of subsegments.

Segments must include the following fields. For the full segment document schema, see AWS X-Ray Segment Documents in the AWS X-Ray Developer Guide.

Required Segment Document Fields

  • name - The name of the service that handled the request.

  • id - A 64-bit identifier for the segment, unique among segments in the same trace, in 16 hexadecimal digits.

  • trace_id - A unique identifier that connects all segments and subsegments originating from a single client request.

  • start_time - Time the segment or subsegment was created, in floating point seconds in epoch time, accurate to milliseconds. For example, 1480615200.010 or 1.480615200010E9.

  • end_time - Time the segment or subsegment was closed. For example, 1480615200.090 or 1.480615200090E9. Specify either an end_time or in_progress.

  • in_progress - Set to true instead of specifying an end_time to record that a segment has been started, but is not complete. Send an in progress segment when your application receives a request that will take a long time to serve, to trace the fact that the request was received. When the response is sent, send the complete segment to overwrite the in-progress segment.

A trace_id consists of three numbers separated by hyphens. For example, 1-58406520-a006649127e371903a2de979. This includes:

Trace ID Format

  • The version number, i.e. 1.

  • The time of the original request, in Unix epoch time, in 8 hexadecimal digits. For example, 10:00AM December 2nd, 2016 PST in epoch time is 1480615200 seconds, or 58406520 in hexadecimal.

  • A 96-bit identifier for the trace, globally unique, in 24 hexadecimal digits.

Service Reference:

Examples:

Calling the putTraceSegments operation

var params = {
  TraceSegmentDocuments: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
xray.putTraceSegments(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TraceSegmentDocuments — (Array<String>)

      A string containing a JSON document defining one or more segments or subsegments.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • UnprocessedTraceSegments — (Array<map>)

        Segments that failed processing.

        • Id — (String)

          The segment's ID.

        • ErrorCode — (String)

          The error that caused processing to fail.

        • Message — (String)

          The error message.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.