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

Class: Aws::XRay::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for AWS X-Ray. To construct a client, you need to configure a :region and :credentials.

xray = Aws::XRay::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::XRay::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

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

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::XRay::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :active_endpoint_cache (Boolean)

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :disable_host_prefix_injection (Boolean)

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available. See Plugins::EndpointPattern for more details.

  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :endpoint_cache_max_entries (Integer)

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_max_threads (Integer)

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_poll_interval (Integer)

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec. See Plugins::EndpointDiscovery for more details.

  • :endpoint_discovery (Boolean)

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#batch_get_traces(options = {}) ⇒ 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

Options Hash (options):

  • :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:

#create_group(options = {}) ⇒ Types::CreateGroupResult

Creates a group resource with a name and a filter expression.

Examples:

Request syntax with placeholder values


resp = client.create_group({
  group_name: "GroupName", # required
  filter_expression: "FilterExpression",
})

Response structure


resp.group.group_name #=> String
resp.group.group_arn #=> String
resp.group.filter_expression #=> String

Options Hash (options):

  • :group_name (required, String)

    The case-sensitive name of the new group. Default is a reserved name and names must be unique.

  • :filter_expression (String)

    The filter expression defining criteria by which to group traces.

Returns:

See Also:

#create_sampling_rule(options = {}) ⇒ Types::CreateSamplingRuleResult

Creates a rule to control sampling behavior for instrumented applications. Services retrieve rules with GetSamplingRules, and evaluate each rule in ascending order of priority for each request. If a rule matches, the service records a trace, borrowing it from the reservoir size. After 10 seconds, the service reports back to X-Ray with GetSamplingTargets to get updated versions of each in-use rule. The updated rule contains a trace quota that the service can use instead of borrowing from the reservoir.

Examples:

Request syntax with placeholder values


resp = client.create_sampling_rule({
  sampling_rule: { # required
    rule_name: "RuleName",
    rule_arn: "String",
    resource_arn: "ResourceARN", # required
    priority: 1, # required
    fixed_rate: 1.0, # required
    reservoir_size: 1, # required
    service_name: "ServiceName", # required
    service_type: "ServiceType", # required
    host: "Host", # required
    http_method: "HTTPMethod", # required
    url_path: "URLPath", # required
    version: 1, # required
    attributes: {
      "AttributeKey" => "AttributeValue",
    },
  },
})

Response structure


resp.sampling_rule_record.sampling_rule.rule_name #=> String
resp.sampling_rule_record.sampling_rule.rule_arn #=> String
resp.sampling_rule_record.sampling_rule.resource_arn #=> String
resp.sampling_rule_record.sampling_rule.priority #=> Integer
resp.sampling_rule_record.sampling_rule.fixed_rate #=> Float
resp.sampling_rule_record.sampling_rule.reservoir_size #=> Integer
resp.sampling_rule_record.sampling_rule.service_name #=> String
resp.sampling_rule_record.sampling_rule.service_type #=> String
resp.sampling_rule_record.sampling_rule.host #=> String
resp.sampling_rule_record.sampling_rule.http_method #=> String
resp.sampling_rule_record.sampling_rule.url_path #=> String
resp.sampling_rule_record.sampling_rule.version #=> Integer
resp.sampling_rule_record.sampling_rule.attributes #=> Hash
resp.sampling_rule_record.sampling_rule.attributes["AttributeKey"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.sampling_rule_record.created_at #=> Time
resp.sampling_rule_record.modified_at #=> Time

Options Hash (options):

Returns:

See Also:

#delete_group(options = {}) ⇒ Struct

Deletes a group resource.

Examples:

Request syntax with placeholder values


resp = client.delete_group({
  group_name: "GroupName",
  group_arn: "GroupARN",
})

Options Hash (options):

  • :group_name (String)

    The case-sensitive name of the group.

  • :group_arn (String)

    The ARN of the group that was generated on creation.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_sampling_rule(options = {}) ⇒ Types::DeleteSamplingRuleResult

Deletes a sampling rule.

Examples:

Request syntax with placeholder values


resp = client.delete_sampling_rule({
  rule_name: "String",
  rule_arn: "String",
})

Response structure


resp.sampling_rule_record.sampling_rule.rule_name #=> String
resp.sampling_rule_record.sampling_rule.rule_arn #=> String
resp.sampling_rule_record.sampling_rule.resource_arn #=> String
resp.sampling_rule_record.sampling_rule.priority #=> Integer
resp.sampling_rule_record.sampling_rule.fixed_rate #=> Float
resp.sampling_rule_record.sampling_rule.reservoir_size #=> Integer
resp.sampling_rule_record.sampling_rule.service_name #=> String
resp.sampling_rule_record.sampling_rule.service_type #=> String
resp.sampling_rule_record.sampling_rule.host #=> String
resp.sampling_rule_record.sampling_rule.http_method #=> String
resp.sampling_rule_record.sampling_rule.url_path #=> String
resp.sampling_rule_record.sampling_rule.version #=> Integer
resp.sampling_rule_record.sampling_rule.attributes #=> Hash
resp.sampling_rule_record.sampling_rule.attributes["AttributeKey"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.sampling_rule_record.created_at #=> Time
resp.sampling_rule_record.modified_at #=> Time

Options Hash (options):

  • :rule_name (String)

    The name of the sampling rule. Specify a rule by either name or ARN, but not both.

  • :rule_arn (String)

    The ARN of the sampling rule. Specify a rule by either name or ARN, but not both.

Returns:

See Also:

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

Retrieves the current encryption configuration for X-Ray data.

Examples:

Request syntax with placeholder values


resp = client.get_encryption_config()

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"

Returns:

See Also:

#get_group(options = {}) ⇒ Types::GetGroupResult

Retrieves group resource details.

Examples:

Request syntax with placeholder values


resp = client.get_group({
  group_name: "GroupName",
  group_arn: "GroupARN",
})

Response structure


resp.group.group_name #=> String
resp.group.group_arn #=> String
resp.group.filter_expression #=> String

Options Hash (options):

  • :group_name (String)

    The case-sensitive name of the group.

  • :group_arn (String)

    The ARN of the group that was generated on creation.

Returns:

See Also:

#get_groups(options = {}) ⇒ Types::GetGroupsResult

Retrieves all active group details.

Examples:

Request syntax with placeholder values


resp = client.get_groups({
  next_token: "GetGroupsNextToken",
})

Response structure


resp.groups #=> Array
resp.groups[0].group_name #=> String
resp.groups[0].group_arn #=> String
resp.groups[0].filter_expression #=> String
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    Pagination token. Not used.

Returns:

See Also:

#get_sampling_rules(options = {}) ⇒ Types::GetSamplingRulesResult

Retrieves all sampling rules.

Examples:

Request syntax with placeholder values


resp = client.get_sampling_rules({
  next_token: "String",
})

Response structure


resp.sampling_rule_records #=> Array
resp.sampling_rule_records[0].sampling_rule.rule_name #=> String
resp.sampling_rule_records[0].sampling_rule.rule_arn #=> String
resp.sampling_rule_records[0].sampling_rule.resource_arn #=> String
resp.sampling_rule_records[0].sampling_rule.priority #=> Integer
resp.sampling_rule_records[0].sampling_rule.fixed_rate #=> Float
resp.sampling_rule_records[0].sampling_rule.reservoir_size #=> Integer
resp.sampling_rule_records[0].sampling_rule.service_name #=> String
resp.sampling_rule_records[0].sampling_rule.service_type #=> String
resp.sampling_rule_records[0].sampling_rule.host #=> String
resp.sampling_rule_records[0].sampling_rule.http_method #=> String
resp.sampling_rule_records[0].sampling_rule.url_path #=> String
resp.sampling_rule_records[0].sampling_rule.version #=> Integer
resp.sampling_rule_records[0].sampling_rule.attributes #=> Hash
resp.sampling_rule_records[0].sampling_rule.attributes["AttributeKey"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.sampling_rule_records[0].created_at #=> Time
resp.sampling_rule_records[0].modified_at #=> Time
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    Pagination token. Not used.

Returns:

See Also:

#get_sampling_statistic_summaries(options = {}) ⇒ Types::GetSamplingStatisticSummariesResult

Retrieves information about recent sampling results for all sampling rules.

Examples:

Request syntax with placeholder values


resp = client.get_sampling_statistic_summaries({
  next_token: "String",
})

Response structure


resp.sampling_statistic_summaries #=> Array
resp.sampling_statistic_summaries[0].rule_name #=> String
resp.sampling_statistic_summaries[0].timestamp #=> Time
resp.sampling_statistic_summaries[0].request_count #=> Integer
resp.sampling_statistic_summaries[0].borrow_count #=> Integer
resp.sampling_statistic_summaries[0].sampled_count #=> Integer
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    Pagination token. Not used.

Returns:

See Also:

#get_sampling_targets(options = {}) ⇒ Types::GetSamplingTargetsResult

Requests a sampling quota for rules that the service is using to sample requests.

Examples:

Request syntax with placeholder values


resp = client.get_sampling_targets({
  sampling_statistics_documents: [ # required
    {
      rule_name: "RuleName", # required
      client_id: "ClientID", # required
      timestamp: Time.now, # required
      request_count: 1, # required
      sampled_count: 1, # required
      borrow_count: 1,
    },
  ],
})

Response structure


resp.sampling_target_documents #=> Array
resp.sampling_target_documents[0].rule_name #=> String
resp.sampling_target_documents[0].fixed_rate #=> Float
resp.sampling_target_documents[0].reservoir_quota #=> Integer
resp.sampling_target_documents[0].reservoir_quota_ttl #=> Time
resp.sampling_target_documents[0].interval #=> Integer
resp.last_rule_modification #=> Time
resp.unprocessed_statistics #=> Array
resp.unprocessed_statistics[0].rule_name #=> String
resp.unprocessed_statistics[0].error_code #=> String
resp.unprocessed_statistics[0].message #=> String

Options Hash (options):

Returns:

See Also:

#get_service_graph(options = {}) ⇒ 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
  group_name: "GroupName",
  group_arn: "GroupARN",
  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 #=> true/false
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.contains_old_group_versions #=> true/false
resp.next_token #=> String

Options Hash (options):

  • :start_time (required, Time)

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

  • :end_time (required, Time)

    The end of the timeframe for which to generate a graph.

  • :group_name (String)

    The name of a group to generate a graph based on.

  • :group_arn (String)

    The ARN of a group to generate a graph based on.

  • :next_token (String)

    Pagination token. Not used.

Returns:

See Also:

#get_time_series_service_statistics(options = {}) ⇒ Types::GetTimeSeriesServiceStatisticsResult

Get an aggregation of service statistics defined by a specific time range.

Examples:

Request syntax with placeholder values


resp = client.get_time_series_service_statistics({
  start_time: Time.now, # required
  end_time: Time.now, # required
  group_name: "GroupName",
  group_arn: "GroupARN",
  entity_selector_expression: "EntitySelectorExpression",
  period: 1,
  next_token: "String",
})

Response structure


resp.time_series_service_statistics #=> Array
resp.time_series_service_statistics[0].timestamp #=> Time
resp.time_series_service_statistics[0].edge_summary_statistics.ok_count #=> Integer
resp.time_series_service_statistics[0].edge_summary_statistics.error_statistics.throttle_count #=> Integer
resp.time_series_service_statistics[0].edge_summary_statistics.error_statistics.other_count #=> Integer
resp.time_series_service_statistics[0].edge_summary_statistics.error_statistics.total_count #=> Integer
resp.time_series_service_statistics[0].edge_summary_statistics.fault_statistics.other_count #=> Integer
resp.time_series_service_statistics[0].edge_summary_statistics.fault_statistics.total_count #=> Integer
resp.time_series_service_statistics[0].edge_summary_statistics.total_count #=> Integer
resp.time_series_service_statistics[0].edge_summary_statistics.total_response_time #=> Float
resp.time_series_service_statistics[0].service_summary_statistics.ok_count #=> Integer
resp.time_series_service_statistics[0].service_summary_statistics.error_statistics.throttle_count #=> Integer
resp.time_series_service_statistics[0].service_summary_statistics.error_statistics.other_count #=> Integer
resp.time_series_service_statistics[0].service_summary_statistics.error_statistics.total_count #=> Integer
resp.time_series_service_statistics[0].service_summary_statistics.fault_statistics.other_count #=> Integer
resp.time_series_service_statistics[0].service_summary_statistics.fault_statistics.total_count #=> Integer
resp.time_series_service_statistics[0].service_summary_statistics.total_count #=> Integer
resp.time_series_service_statistics[0].service_summary_statistics.total_response_time #=> Float
resp.time_series_service_statistics[0].response_time_histogram #=> Array
resp.time_series_service_statistics[0].response_time_histogram[0].value #=> Float
resp.time_series_service_statistics[0].response_time_histogram[0].count #=> Integer
resp.contains_old_group_versions #=> true/false
resp.next_token #=> String

Options Hash (options):

  • :start_time (required, Time)

    The start of the time frame for which to aggregate statistics.

  • :end_time (required, Time)

    The end of the time frame for which to aggregate statistics.

  • :group_name (String)

    The case-sensitive name of the group for which to pull statistics from.

  • :group_arn (String)

    The ARN of the group for which to pull statistics from.

  • :entity_selector_expression (String)

    A filter expression defining entities that will be aggregated for statistics. Supports ID, service, and edge functions. If no selector expression is specified, edge statistics are returned.

  • :period (Integer)

    Aggregation period in seconds.

  • :next_token (String)

    Pagination token. Not used.

Returns:

See Also:

#get_trace_graph(options = {}) ⇒ 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 #=> true/false
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

Options Hash (options):

  • :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:

#get_trace_summaries(options = {}) ⇒ 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
  time_range_type: "TraceId", # accepts TraceId, Event
  sampling: false,
  sampling_strategy: {
    name: "PartialScan", # accepts PartialScan, FixedRate
    value: 1.0,
  },
  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 #=> true/false
resp.trace_summaries[0].has_error #=> true/false
resp.trace_summaries[0].has_throttle #=> true/false
resp.trace_summaries[0].is_partial #=> true/false
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 #=> true/false
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.trace_summaries[0].resource_arns #=> Array
resp.trace_summaries[0].resource_arns[0].arn #=> String
resp.trace_summaries[0].instance_ids #=> Array
resp.trace_summaries[0].instance_ids[0].id #=> String
resp.trace_summaries[0].availability_zones #=> Array
resp.trace_summaries[0].availability_zones[0].name #=> String
resp.trace_summaries[0].entry_point.name #=> String
resp.trace_summaries[0].entry_point.names #=> Array
resp.trace_summaries[0].entry_point.names[0] #=> String
resp.trace_summaries[0].entry_point. #=> String
resp.trace_summaries[0].entry_point.type #=> String
resp.trace_summaries[0].fault_root_causes #=> Array
resp.trace_summaries[0].fault_root_causes[0].services #=> Array
resp.trace_summaries[0].fault_root_causes[0].services[0].name #=> String
resp.trace_summaries[0].fault_root_causes[0].services[0].names #=> Array
resp.trace_summaries[0].fault_root_causes[0].services[0].names[0] #=> String
resp.trace_summaries[0].fault_root_causes[0].services[0].type #=> String
resp.trace_summaries[0].fault_root_causes[0].services[0]. #=> String
resp.trace_summaries[0].fault_root_causes[0].services[0].entity_path #=> Array
resp.trace_summaries[0].fault_root_causes[0].services[0].entity_path[0].name #=> String
resp.trace_summaries[0].fault_root_causes[0].services[0].entity_path[0].exceptions #=> Array
resp.trace_summaries[0].fault_root_causes[0].services[0].entity_path[0].exceptions[0].name #=> String
resp.trace_summaries[0].fault_root_causes[0].services[0].entity_path[0].exceptions[0].message #=> String
resp.trace_summaries[0].fault_root_causes[0].services[0].entity_path[0].remote #=> true/false
resp.trace_summaries[0].fault_root_causes[0].services[0].inferred #=> true/false
resp.trace_summaries[0].error_root_causes #=> Array
resp.trace_summaries[0].error_root_causes[0].services #=> Array
resp.trace_summaries[0].error_root_causes[0].services[0].name #=> String
resp.trace_summaries[0].error_root_causes[0].services[0].names #=> Array
resp.trace_summaries[0].error_root_causes[0].services[0].names[0] #=> String
resp.trace_summaries[0].error_root_causes[0].services[0].type #=> String
resp.trace_summaries[0].error_root_causes[0].services[0]. #=> String
resp.trace_summaries[0].error_root_causes[0].services[0].entity_path #=> Array
resp.trace_summaries[0].error_root_causes[0].services[0].entity_path[0].name #=> String
resp.trace_summaries[0].error_root_causes[0].services[0].entity_path[0].exceptions #=> Array
resp.trace_summaries[0].error_root_causes[0].services[0].entity_path[0].exceptions[0].name #=> String
resp.trace_summaries[0].error_root_causes[0].services[0].entity_path[0].exceptions[0].message #=> String
resp.trace_summaries[0].error_root_causes[0].services[0].entity_path[0].remote #=> true/false
resp.trace_summaries[0].error_root_causes[0].services[0].inferred #=> true/false
resp.trace_summaries[0].response_time_root_causes #=> Array
resp.trace_summaries[0].response_time_root_causes[0].services #=> Array
resp.trace_summaries[0].response_time_root_causes[0].services[0].name #=> String
resp.trace_summaries[0].response_time_root_causes[0].services[0].names #=> Array
resp.trace_summaries[0].response_time_root_causes[0].services[0].names[0] #=> String
resp.trace_summaries[0].response_time_root_causes[0].services[0].type #=> String
resp.trace_summaries[0].response_time_root_causes[0].services[0]. #=> String
resp.trace_summaries[0].response_time_root_causes[0].services[0].entity_path #=> Array
resp.trace_summaries[0].response_time_root_causes[0].services[0].entity_path[0].name #=> String
resp.trace_summaries[0].response_time_root_causes[0].services[0].entity_path[0].coverage #=> Float
resp.trace_summaries[0].response_time_root_causes[0].services[0].entity_path[0].remote #=> true/false
resp.trace_summaries[0].response_time_root_causes[0].services[0].inferred #=> true/false
resp.trace_summaries[0].revision #=> Integer
resp.trace_summaries[0].matched_event_time #=> Time
resp.approximate_time #=> Time
resp.traces_processed_count #=> Integer
resp.next_token #=> String

Options Hash (options):

  • :start_time (required, Time)

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

  • :end_time (required, Time)

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

  • :time_range_type (String)

    A parameter to indicate whether to query trace summaries by TraceId or Event time.

  • :sampling (Boolean)

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

  • :sampling_strategy (Types::SamplingStrategy)

    A paramater to indicate whether to enable sampling on trace summaries. Input parameters are Name and Value.

  • :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:

#put_encryption_config(options = {}) ⇒ 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"

Options Hash (options):

  • :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:

#put_telemetry_records(options = {}) ⇒ 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",
})

Options Hash (options):

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

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#put_trace_segments(options = {}) ⇒ 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

Options Hash (options):

  • :trace_segment_documents (required, Array<String>)

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

Returns:

See Also:

#update_group(options = {}) ⇒ Types::UpdateGroupResult

Updates a group resource.

Examples:

Request syntax with placeholder values


resp = client.update_group({
  group_name: "GroupName",
  group_arn: "GroupARN",
  filter_expression: "FilterExpression",
})

Response structure


resp.group.group_name #=> String
resp.group.group_arn #=> String
resp.group.filter_expression #=> String

Options Hash (options):

  • :group_name (String)

    The case-sensitive name of the group.

  • :group_arn (String)

    The ARN that was generated upon creation.

  • :filter_expression (String)

    The updated filter expression defining criteria by which to group traces.

Returns:

See Also:

#update_sampling_rule(options = {}) ⇒ Types::UpdateSamplingRuleResult

Modifies a sampling rule's configuration.

Examples:

Request syntax with placeholder values


resp = client.update_sampling_rule({
  sampling_rule_update: { # required
    rule_name: "RuleName",
    rule_arn: "String",
    resource_arn: "ResourceARN",
    priority: 1,
    fixed_rate: 1.0,
    reservoir_size: 1,
    host: "Host",
    service_name: "ServiceName",
    service_type: "ServiceType",
    http_method: "HTTPMethod",
    url_path: "URLPath",
    attributes: {
      "AttributeKey" => "AttributeValue",
    },
  },
})

Response structure


resp.sampling_rule_record.sampling_rule.rule_name #=> String
resp.sampling_rule_record.sampling_rule.rule_arn #=> String
resp.sampling_rule_record.sampling_rule.resource_arn #=> String
resp.sampling_rule_record.sampling_rule.priority #=> Integer
resp.sampling_rule_record.sampling_rule.fixed_rate #=> Float
resp.sampling_rule_record.sampling_rule.reservoir_size #=> Integer
resp.sampling_rule_record.sampling_rule.service_name #=> String
resp.sampling_rule_record.sampling_rule.service_type #=> String
resp.sampling_rule_record.sampling_rule.host #=> String
resp.sampling_rule_record.sampling_rule.http_method #=> String
resp.sampling_rule_record.sampling_rule.url_path #=> String
resp.sampling_rule_record.sampling_rule.version #=> Integer
resp.sampling_rule_record.sampling_rule.attributes #=> Hash
resp.sampling_rule_record.sampling_rule.attributes["AttributeKey"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.sampling_rule_record.created_at #=> Time
resp.sampling_rule_record.modified_at #=> Time

Options Hash (options):

Returns:

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

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

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:

Returns:

  • (Array<Symbol>)

    the list of supported waiters.