You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::XRay::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#api_requests, #stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

    a customizable set of options



153
154
155
# File 'gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb', line 153

def initialize(*args)
  super
end

Instance Method Details

#batch_get_traces(params = {}) ⇒ Types::BatchGetTracesResult

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.

Examples:

Request syntax with placeholder values


resp = client.batch_get_traces({
  trace_ids: ["TraceId"], # required
  next_token: "String",
})

Response structure


resp.traces #=> Array
resp.traces[0].id #=> String
resp.traces[0].duration #=> Float
resp.traces[0].segments #=> Array
resp.traces[0].segments[0].id #=> String
resp.traces[0].segments[0].document #=> String
resp.unprocessed_trace_ids #=> Array
resp.unprocessed_trace_ids[0] #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :trace_ids (required, Array<String>)

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

  • :next_token (String)

    Pagination token. Not used.

Returns:

See Also:



198
199
200
201
# File 'gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb', line 198

def batch_get_traces(params = {}, options = {})
  req = build_request(:batch_get_traces, params)
  req.send_request(options)
end

#get_encryption_config(params = {}) ⇒ Types::GetEncryptionConfigResult

Retrieves the current encryption configuration for X-Ray data.

Examples:

Response structure


resp.encryption_config.key_id #=> String
resp.encryption_config.status #=> String, one of "UPDATING", "ACTIVE"
resp.encryption_config.type #=> String, one of "NONE", "KMS"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

See Also:



219
220
221
222
# File 'gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb', line 219

def get_encryption_config(params = {}, options = {})
  req = build_request(:get_encryption_config, params)
  req.send_request(options)
end

#get_service_graph(params = {}) ⇒ Types::GetServiceGraphResult

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.

Examples:

Request syntax with placeholder values


resp = client.get_service_graph({
  start_time: Time.now, # required
  end_time: Time.now, # required
  next_token: "String",
})

Response structure


resp.start_time #=> Time
resp.end_time #=> Time
resp.services #=> Array
resp.services[0].reference_id #=> Integer
resp.services[0].name #=> String
resp.services[0].names #=> Array
resp.services[0].names[0] #=> String
resp.services[0].root #=> Boolean
resp.services[0]. #=> String
resp.services[0].type #=> String
resp.services[0].state #=> String
resp.services[0].start_time #=> Time
resp.services[0].end_time #=> Time
resp.services[0].edges #=> Array
resp.services[0].edges[0].reference_id #=> Integer
resp.services[0].edges[0].start_time #=> Time
resp.services[0].edges[0].end_time #=> Time
resp.services[0].edges[0].summary_statistics.ok_count #=> Integer
resp.services[0].edges[0].summary_statistics.error_statistics.throttle_count #=> Integer
resp.services[0].edges[0].summary_statistics.error_statistics.other_count #=> Integer
resp.services[0].edges[0].summary_statistics.error_statistics.total_count #=> Integer
resp.services[0].edges[0].summary_statistics.fault_statistics.other_count #=> Integer
resp.services[0].edges[0].summary_statistics.fault_statistics.total_count #=> Integer
resp.services[0].edges[0].summary_statistics.total_count #=> Integer
resp.services[0].edges[0].summary_statistics.total_response_time #=> Float
resp.services[0].edges[0].response_time_histogram #=> Array
resp.services[0].edges[0].response_time_histogram[0].value #=> Float
resp.services[0].edges[0].response_time_histogram[0].count #=> Integer
resp.services[0].edges[0].aliases #=> Array
resp.services[0].edges[0].aliases[0].name #=> String
resp.services[0].edges[0].aliases[0].names #=> Array
resp.services[0].edges[0].aliases[0].names[0] #=> String
resp.services[0].edges[0].aliases[0].type #=> String
resp.services[0].summary_statistics.ok_count #=> Integer
resp.services[0].summary_statistics.error_statistics.throttle_count #=> Integer
resp.services[0].summary_statistics.error_statistics.other_count #=> Integer
resp.services[0].summary_statistics.error_statistics.total_count #=> Integer
resp.services[0].summary_statistics.fault_statistics.other_count #=> Integer
resp.services[0].summary_statistics.fault_statistics.total_count #=> Integer
resp.services[0].summary_statistics.total_count #=> Integer
resp.services[0].summary_statistics.total_response_time #=> Float
resp.services[0].duration_histogram #=> Array
resp.services[0].duration_histogram[0].value #=> Float
resp.services[0].duration_histogram[0].count #=> Integer
resp.services[0].response_time_histogram #=> Array
resp.services[0].response_time_histogram[0].value #=> Float
resp.services[0].response_time_histogram[0].count #=> Integer
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :start_time (required, Time, DateTime, Date, Integer, String)

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

  • :end_time (required, Time, DateTime, Date, Integer, String)

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

  • :next_token (String)

    Pagination token. Not used.

Returns:

See Also:



310
311
312
313
# File 'gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb', line 310

def get_service_graph(params = {}, options = {})
  req = build_request(:get_service_graph, params)
  req.send_request(options)
end

#get_trace_graph(params = {}) ⇒ Types::GetTraceGraphResult

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

Examples:

Request syntax with placeholder values


resp = client.get_trace_graph({
  trace_ids: ["TraceId"], # required
  next_token: "String",
})

Response structure


resp.services #=> Array
resp.services[0].reference_id #=> Integer
resp.services[0].name #=> String
resp.services[0].names #=> Array
resp.services[0].names[0] #=> String
resp.services[0].root #=> Boolean
resp.services[0]. #=> String
resp.services[0].type #=> String
resp.services[0].state #=> String
resp.services[0].start_time #=> Time
resp.services[0].end_time #=> Time
resp.services[0].edges #=> Array
resp.services[0].edges[0].reference_id #=> Integer
resp.services[0].edges[0].start_time #=> Time
resp.services[0].edges[0].end_time #=> Time
resp.services[0].edges[0].summary_statistics.ok_count #=> Integer
resp.services[0].edges[0].summary_statistics.error_statistics.throttle_count #=> Integer
resp.services[0].edges[0].summary_statistics.error_statistics.other_count #=> Integer
resp.services[0].edges[0].summary_statistics.error_statistics.total_count #=> Integer
resp.services[0].edges[0].summary_statistics.fault_statistics.other_count #=> Integer
resp.services[0].edges[0].summary_statistics.fault_statistics.total_count #=> Integer
resp.services[0].edges[0].summary_statistics.total_count #=> Integer
resp.services[0].edges[0].summary_statistics.total_response_time #=> Float
resp.services[0].edges[0].response_time_histogram #=> Array
resp.services[0].edges[0].response_time_histogram[0].value #=> Float
resp.services[0].edges[0].response_time_histogram[0].count #=> Integer
resp.services[0].edges[0].aliases #=> Array
resp.services[0].edges[0].aliases[0].name #=> String
resp.services[0].edges[0].aliases[0].names #=> Array
resp.services[0].edges[0].aliases[0].names[0] #=> String
resp.services[0].edges[0].aliases[0].type #=> String
resp.services[0].summary_statistics.ok_count #=> Integer
resp.services[0].summary_statistics.error_statistics.throttle_count #=> Integer
resp.services[0].summary_statistics.error_statistics.other_count #=> Integer
resp.services[0].summary_statistics.error_statistics.total_count #=> Integer
resp.services[0].summary_statistics.fault_statistics.other_count #=> Integer
resp.services[0].summary_statistics.fault_statistics.total_count #=> Integer
resp.services[0].summary_statistics.total_count #=> Integer
resp.services[0].summary_statistics.total_response_time #=> Float
resp.services[0].duration_histogram #=> Array
resp.services[0].duration_histogram[0].value #=> Float
resp.services[0].duration_histogram[0].count #=> Integer
resp.services[0].response_time_histogram #=> Array
resp.services[0].response_time_histogram[0].value #=> Float
resp.services[0].response_time_histogram[0].count #=> Integer
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :trace_ids (required, Array<String>)

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

  • :next_token (String)

    Pagination token. Not used.

Returns:

See Also:



388
389
390
391
# File 'gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb', line 388

def get_trace_graph(params = {}, options = {})
  req = build_request(:get_trace_graph, params)
  req.send_request(options)
end

#get_trace_summaries(params = {}) ⇒ Types::GetTraceSummariesResult

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.

Examples:

Request syntax with placeholder values


resp = client.get_trace_summaries({
  start_time: Time.now, # required
  end_time: Time.now, # required
  sampling: false,
  filter_expression: "FilterExpression",
  next_token: "String",
})

Response structure


resp.trace_summaries #=> Array
resp.trace_summaries[0].id #=> String
resp.trace_summaries[0].duration #=> Float
resp.trace_summaries[0].response_time #=> Float
resp.trace_summaries[0].has_fault #=> Boolean
resp.trace_summaries[0].has_error #=> Boolean
resp.trace_summaries[0].has_throttle #=> Boolean
resp.trace_summaries[0].is_partial #=> Boolean
resp.trace_summaries[0].http.http_url #=> String
resp.trace_summaries[0].http.http_status #=> Integer
resp.trace_summaries[0].http.http_method #=> String
resp.trace_summaries[0].http.user_agent #=> String
resp.trace_summaries[0].http.client_ip #=> String
resp.trace_summaries[0].annotations #=> Hash
resp.trace_summaries[0].annotations["AnnotationKey"] #=> Array
resp.trace_summaries[0].annotations["AnnotationKey"][0].annotation_value.number_value #=> Float
resp.trace_summaries[0].annotations["AnnotationKey"][0].annotation_value.boolean_value #=> Boolean
resp.trace_summaries[0].annotations["AnnotationKey"][0].annotation_value.string_value #=> String
resp.trace_summaries[0].annotations["AnnotationKey"][0].service_ids #=> Array
resp.trace_summaries[0].annotations["AnnotationKey"][0].service_ids[0].name #=> String
resp.trace_summaries[0].annotations["AnnotationKey"][0].service_ids[0].names #=> Array
resp.trace_summaries[0].annotations["AnnotationKey"][0].service_ids[0].names[0] #=> String
resp.trace_summaries[0].annotations["AnnotationKey"][0].service_ids[0]. #=> String
resp.trace_summaries[0].annotations["AnnotationKey"][0].service_ids[0].type #=> String
resp.trace_summaries[0].users #=> Array
resp.trace_summaries[0].users[0].user_name #=> String
resp.trace_summaries[0].users[0].service_ids #=> Array
resp.trace_summaries[0].users[0].service_ids[0].name #=> String
resp.trace_summaries[0].users[0].service_ids[0].names #=> Array
resp.trace_summaries[0].users[0].service_ids[0].names[0] #=> String
resp.trace_summaries[0].users[0].service_ids[0]. #=> String
resp.trace_summaries[0].users[0].service_ids[0].type #=> String
resp.trace_summaries[0].service_ids #=> Array
resp.trace_summaries[0].service_ids[0].name #=> String
resp.trace_summaries[0].service_ids[0].names #=> Array
resp.trace_summaries[0].service_ids[0].names[0] #=> String
resp.trace_summaries[0].service_ids[0]. #=> String
resp.trace_summaries[0].service_ids[0].type #=> String
resp.approximate_time #=> Time
resp.traces_processed_count #=> Integer
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :start_time (required, Time, DateTime, Date, Integer, String)

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

  • :end_time (required, Time, DateTime, Date, Integer, String)

    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.

  • :filter_expression (String)

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

  • :next_token (String)

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

Returns:

See Also:



499
500
501
502
# File 'gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb', line 499

def get_trace_summaries(params = {}, options = {})
  req = build_request(:get_trace_summaries, params)
  req.send_request(options)
end

#put_encryption_config(params = {}) ⇒ Types::PutEncryptionConfigResult

Updates the encryption configuration for X-Ray data.

Examples:

Request syntax with placeholder values


resp = client.put_encryption_config({
  key_id: "EncryptionKeyId",
  type: "NONE", # required, accepts NONE, KMS
})

Response structure


resp.encryption_config.key_id #=> String
resp.encryption_config.status #=> String, one of "UPDATING", "ACTIVE"
resp.encryption_config.type #=> String, one of "NONE", "KMS"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :key_id (String)

    An AWS KMS customer master key (CMK) in one of the following formats:

    • Alias - The name of the key. For example, alias/MyKey.

    • Key ID - The KMS key ID of the key. For example, ae4aa6d49-a4d8-9df9-a475-4ff6d7898456.

    • ARN - The full Amazon Resource Name of the key ID or alias. For example, arn:aws:kms:us-east-2:123456789012:key/ae4aa6d49-a4d8-9df9-a475-4ff6d7898456. Use this format to specify a key in a different account.

    Omit this key if you set Type to NONE.

  • :type (required, String)

    The type of encryption. Set to KMS to use your own key for encryption. Set to NONE for default encryption.

Returns:

See Also:



546
547
548
549
# File 'gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb', line 546

def put_encryption_config(params = {}, options = {})
  req = build_request(:put_encryption_config, params)
  req.send_request(options)
end

#put_telemetry_records(params = {}) ⇒ Struct

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

Examples:

Request syntax with placeholder values


resp = client.put_telemetry_records({
  telemetry_records: [ # required
    {
      timestamp: Time.now, # required
      segments_received_count: 1,
      segments_sent_count: 1,
      segments_spillover_count: 1,
      segments_rejected_count: 1,
      backend_connection_errors: {
        timeout_count: 1,
        connection_refused_count: 1,
        http_code_4_xx_count: 1,
        http_code_5_xx_count: 1,
        unknown_host_count: 1,
        other_count: 1,
      },
    },
  ],
  ec2_instance_id: "EC2InstanceId",
  hostname: "Hostname",
  resource_arn: "ResourceARN",
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :telemetry_records (required, Array<Types::TelemetryRecord>)
  • :ec2_instance_id (String)
  • :hostname (String)
  • :resource_arn (String)

Returns:

  • (Struct)

    Returns an empty response.

See Also:



592
593
594
595
# File 'gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb', line 592

def put_telemetry_records(params = {}, options = {})
  req = build_request(:put_telemetry_records, params)
  req.send_request(options)
end

#put_trace_segments(params = {}) ⇒ Types::PutTraceSegmentsResult

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.

Examples:

Request syntax with placeholder values


resp = client.put_trace_segments({
  trace_segment_documents: ["TraceSegmentDocument"], # required
})

Response structure


resp.unprocessed_trace_segments #=> Array
resp.unprocessed_trace_segments[0].id #=> String
resp.unprocessed_trace_segments[0].error_code #=> String
resp.unprocessed_trace_segments[0].message #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :trace_segment_documents (required, Array<String>)

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

Returns:

See Also:



674
675
676
677
# File 'gems/aws-sdk-xray/lib/aws-sdk-xray/client.rb', line 674

def put_trace_segments(params = {}, options = {})
  req = build_request(:put_trace_segments, params)
  req.send_request(options)
end