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].limit_exceeded #=> true/false
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.

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",
  insights_configuration: {
    insights_enabled: false,
    notifications_enabled: false,
  },
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue", # required
    },
  ],
})

Response structure


resp.group.group_name #=> String
resp.group.group_arn #=> String
resp.group.filter_expression #=> String
resp.group.insights_configuration.insights_enabled #=> true/false
resp.group.insights_configuration.notifications_enabled #=> true/false

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.

  • :insights_configuration (Types::InsightsConfiguration)

    The structure containing configurations related to insights.

    • The InsightsEnabled boolean can be set to true to enable insights for the new group or false to disable insights for the new group.

    • The NotifcationsEnabled boolean can be set to true to enable insights notifications for the new group. Notifications may only be enabled on a group with InsightsEnabled set to true.

  • :tags (Array<Types::Tag>)

    A map that contains one or more tag keys and tag values to attach to an X-Ray group. For more information about ways to use tags, see Tagging AWS resources in the AWS General Reference.

    The following restrictions apply to tags:

    • Maximum number of user-applied tags per resource: 50

    • Maximum tag key length: 128 Unicode characters

    • Maximum tag value length: 256 Unicode characters

    • Valid values for key and value: a-z, A-Z, 0-9, space, and the following characters: _ . : / = + - and @

    • Tag keys and values are case sensitive.

    • Don\'t use aws: as a prefix for keys; it\'s reserved for AWS use.

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",
    },
  },
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue", # required
    },
  ],
})

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

  • :sampling_rule (required, Types::SamplingRule)

    The rule definition.

  • :tags (Array<Types::Tag>)

    A map that contains one or more tag keys and tag values to attach to an X-Ray sampling rule. For more information about ways to use tags, see Tagging AWS resources in the AWS General Reference.

    The following restrictions apply to tags:

    • Maximum number of user-applied tags per resource: 50

    • Maximum tag key length: 128 Unicode characters

    • Maximum tag value length: 256 Unicode characters

    • Valid values for key and value: a-z, A-Z, 0-9, space, and the following characters: _ . : / = + - and @

    • Tag keys and values are case sensitive.

    • Don\'t use aws: as a prefix for keys; it\'s reserved for AWS use.

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
resp.group.insights_configuration.insights_enabled #=> true/false
resp.group.insights_configuration.notifications_enabled #=> true/false

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.groups[0].insights_configuration.insights_enabled #=> true/false
resp.groups[0].insights_configuration.notifications_enabled #=> true/false
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    Pagination token.

Returns:

See Also:

#get_insight(options = {}) ⇒ Types::GetInsightResult

Retrieves the summary information of an insight. This includes impact to clients and root cause services, the top anomalous services, the category, the state of the insight, and the start and end time of the insight.

Examples:

Request syntax with placeholder values


resp = client.get_insight({
  insight_id: "InsightId", # required
})

Response structure


resp.insight.insight_id #=> String
resp.insight.group_arn #=> String
resp.insight.group_name #=> String
resp.insight.root_cause_service_id.name #=> String
resp.insight.root_cause_service_id.names #=> Array
resp.insight.root_cause_service_id.names[0] #=> String
resp.insight.root_cause_service_id. #=> String
resp.insight.root_cause_service_id.type #=> String
resp.insight.categories #=> Array
resp.insight.categories[0] #=> String, one of "FAULT"
resp.insight.state #=> String, one of "ACTIVE", "CLOSED"
resp.insight.start_time #=> Time
resp.insight.end_time #=> Time
resp.insight.summary #=> String
resp.insight.client_request_impact_statistics.fault_count #=> Integer
resp.insight.client_request_impact_statistics.ok_count #=> Integer
resp.insight.client_request_impact_statistics.total_count #=> Integer
resp.insight.root_cause_service_request_impact_statistics.fault_count #=> Integer
resp.insight.root_cause_service_request_impact_statistics.ok_count #=> Integer
resp.insight.root_cause_service_request_impact_statistics.total_count #=> Integer
resp.insight.top_anomalous_services #=> Array
resp.insight.top_anomalous_services[0].service_id.name #=> String
resp.insight.top_anomalous_services[0].service_id.names #=> Array
resp.insight.top_anomalous_services[0].service_id.names[0] #=> String
resp.insight.top_anomalous_services[0].service_id. #=> String
resp.insight.top_anomalous_services[0].service_id.type #=> String

Options Hash (options):

  • :insight_id (required, String)

    The insight\'s unique identifier. Use the GetInsightSummaries action to retrieve an InsightId.

Returns:

See Also:

#get_insight_events(options = {}) ⇒ Types::GetInsightEventsResult

X-Ray reevaluates insights periodically until they're resolved, and records each intermediate state as an event. You can review an insight's events in the Impact Timeline on the Inspect page in the X-Ray console.

Examples:

Request syntax with placeholder values


resp = client.get_insight_events({
  insight_id: "InsightId", # required
  max_results: 1,
  next_token: "Token",
})

Response structure


resp.insight_events #=> Array
resp.insight_events[0].summary #=> String
resp.insight_events[0].event_time #=> Time
resp.insight_events[0].client_request_impact_statistics.fault_count #=> Integer
resp.insight_events[0].client_request_impact_statistics.ok_count #=> Integer
resp.insight_events[0].client_request_impact_statistics.total_count #=> Integer
resp.insight_events[0].root_cause_service_request_impact_statistics.fault_count #=> Integer
resp.insight_events[0].root_cause_service_request_impact_statistics.ok_count #=> Integer
resp.insight_events[0].root_cause_service_request_impact_statistics.total_count #=> Integer
resp.insight_events[0].top_anomalous_services #=> Array
resp.insight_events[0].top_anomalous_services[0].service_id.name #=> String
resp.insight_events[0].top_anomalous_services[0].service_id.names #=> Array
resp.insight_events[0].top_anomalous_services[0].service_id.names[0] #=> String
resp.insight_events[0].top_anomalous_services[0].service_id. #=> String
resp.insight_events[0].top_anomalous_services[0].service_id.type #=> String
resp.next_token #=> String

Options Hash (options):

  • :insight_id (required, String)

    The insight\'s unique identifier. Use the GetInsightSummaries action to retrieve an InsightId.

  • :max_results (Integer)

    Used to retrieve at most the specified value of events.

  • :next_token (String)

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

Returns:

See Also:

#get_insight_impact_graph(options = {}) ⇒ Types::GetInsightImpactGraphResult

Retrieves a service graph structure filtered by the specified insight. The service graph is limited to only structural information. For a complete service graph, use this API with the GetServiceGraph API.

Examples:

Request syntax with placeholder values


resp = client.get_insight_impact_graph({
  insight_id: "InsightId", # required
  start_time: Time.now, # required
  end_time: Time.now, # required
  next_token: "Token",
})

Response structure


resp.insight_id #=> String
resp.start_time #=> Time
resp.end_time #=> Time
resp.service_graph_start_time #=> Time
resp.service_graph_end_time #=> Time
resp.services #=> Array
resp.services[0].reference_id #=> Integer
resp.services[0].type #=> String
resp.services[0].name #=> String
resp.services[0].names #=> Array
resp.services[0].names[0] #=> String
resp.services[0]. #=> String
resp.services[0].edges #=> Array
resp.services[0].edges[0].reference_id #=> Integer
resp.next_token #=> String

Options Hash (options):

  • :insight_id (required, String)

    The insight\'s unique identifier. Use the GetInsightSummaries action to retrieve an InsightId.

  • :start_time (required, Time)

    The estimated start time of the insight, in Unix time seconds. The StartTime is inclusive of the value provided and can\'t be more than 30 days old.

  • :end_time (required, Time)

    The estimated end time of the insight, in Unix time seconds. The EndTime is exclusive of the value provided. The time range between the start time and end time can\'t be more than six hours.

  • :next_token (String)

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

Returns:

See Also:

#get_insight_summaries(options = {}) ⇒ Types::GetInsightSummariesResult

Retrieves the summaries of all insights in the specified group matching the provided filter values.

Examples:

Request syntax with placeholder values


resp = client.get_insight_summaries({
  states: ["ACTIVE"], # accepts ACTIVE, CLOSED
  group_arn: "GroupARN",
  group_name: "GroupName",
  start_time: Time.now, # required
  end_time: Time.now, # required
  max_results: 1,
  next_token: "Token",
})

Response structure


resp.insight_summaries #=> Array
resp.insight_summaries[0].insight_id #=> String
resp.insight_summaries[0].group_arn #=> String
resp.insight_summaries[0].group_name #=> String
resp.insight_summaries[0].root_cause_service_id.name #=> String
resp.insight_summaries[0].root_cause_service_id.names #=> Array
resp.insight_summaries[0].root_cause_service_id.names[0] #=> String
resp.insight_summaries[0].root_cause_service_id. #=> String
resp.insight_summaries[0].root_cause_service_id.type #=> String
resp.insight_summaries[0].categories #=> Array
resp.insight_summaries[0].categories[0] #=> String, one of "FAULT"
resp.insight_summaries[0].state #=> String, one of "ACTIVE", "CLOSED"
resp.insight_summaries[0].start_time #=> Time
resp.insight_summaries[0].end_time #=> Time
resp.insight_summaries[0].summary #=> String
resp.insight_summaries[0].client_request_impact_statistics.fault_count #=> Integer
resp.insight_summaries[0].client_request_impact_statistics.ok_count #=> Integer
resp.insight_summaries[0].client_request_impact_statistics.total_count #=> Integer
resp.insight_summaries[0].root_cause_service_request_impact_statistics.fault_count #=> Integer
resp.insight_summaries[0].root_cause_service_request_impact_statistics.ok_count #=> Integer
resp.insight_summaries[0].root_cause_service_request_impact_statistics.total_count #=> Integer
resp.insight_summaries[0].top_anomalous_services #=> Array
resp.insight_summaries[0].top_anomalous_services[0].service_id.name #=> String
resp.insight_summaries[0].top_anomalous_services[0].service_id.names #=> Array
resp.insight_summaries[0].top_anomalous_services[0].service_id.names[0] #=> String
resp.insight_summaries[0].top_anomalous_services[0].service_id. #=> String
resp.insight_summaries[0].top_anomalous_services[0].service_id.type #=> String
resp.insight_summaries[0].last_update_time #=> Time
resp.next_token #=> String

Options Hash (options):

  • :states (Array<String>)

    The list of insight states.

  • :group_arn (String)

    The Amazon Resource Name (ARN) of the group. Required if the GroupName isn\'t provided.

  • :group_name (String)

    The name of the group. Required if the GroupARN isn\'t provided.

  • :start_time (required, Time)

    The beginning of the time frame in which the insights started. The start time can\'t be more than 30 days old.

  • :end_time (required, Time)

    The end of the time frame in which the insights ended. The end time can\'t be more than 30 days old.

  • :max_results (Integer)

    The maximum number of results to display.

  • :next_token (String)

    Pagination token.

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.

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.

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 based on which you want to generate a graph.

  • :group_arn (String)

    The Amazon Resource Name (ARN) of a group based on which you want to generate a graph.

  • :next_token (String)

    Pagination token.

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,
  forecast_statistics: false,
  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].service_forecast_statistics.fault_count_high #=> Integer
resp.time_series_service_statistics[0].service_forecast_statistics.fault_count_low #=> Integer
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 Amazon Resource Name (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.

  • :forecast_statistics (Boolean)

    The forecasted high and low fault count values. Forecast enabled requests require the EntitySelectorExpression ID be provided.

  • :next_token (String)

    Pagination token.

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.

Returns:

See Also:

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

Retrieves IDs and annotations 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].fault_root_causes[0].client_impacting #=> 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].error_root_causes[0].client_impacting #=> 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].response_time_root_causes[0].client_impacting #=> 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 parameter 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:

#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse

Returns a list of tags that are applied to the specified AWS X-Ray group or sampling rule.

Examples:

Request syntax with placeholder values


resp = client.list_tags_for_resource({
  resource_arn: "AmazonResourceName", # required
  next_token: "String",
})

Response structure


resp.tags #=> Array
resp.tags[0].key #=> String
resp.tags[0].value #=> String
resp.next_token #=> String

Options Hash (options):

  • :resource_arn (required, String)

    The Amazon Resource Number (ARN) of an X-Ray group or sampling rule.

  • :next_token (String)

    A pagination token. If multiple pages of results are returned, use the NextToken value returned with the current page of results as the value of this parameter to get 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. AWS X-Ray does not support asymmetric CMKs.

    • 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 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, for instance, 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:

#tag_resource(options = {}) ⇒ Struct

Applies tags to an existing AWS X-Ray group or sampling rule.

Examples:

Request syntax with placeholder values


resp = client.tag_resource({
  resource_arn: "AmazonResourceName", # required
  tags: [ # required
    {
      key: "TagKey", # required
      value: "TagValue", # required
    },
  ],
})

Options Hash (options):

  • :resource_arn (required, String)

    The Amazon Resource Number (ARN) of an X-Ray group or sampling rule.

  • :tags (required, Array<Types::Tag>)

    A map that contains one or more tag keys and tag values to attach to an X-Ray group or sampling rule. For more information about ways to use tags, see Tagging AWS resources in the AWS General Reference.

    The following restrictions apply to tags:

    • Maximum number of user-applied tags per resource: 50

    • Maximum tag key length: 128 Unicode characters

    • Maximum tag value length: 256 Unicode characters

    • Valid values for key and value: a-z, A-Z, 0-9, space, and the following characters: _ . : / = + - and @

    • Tag keys and values are case sensitive.

    • Don\'t use aws: as a prefix for keys; it\'s reserved for AWS use. You cannot edit or delete system tags.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#untag_resource(options = {}) ⇒ Struct

Removes tags from an AWS X-Ray group or sampling rule. You cannot edit or delete system tags (those with an aws: prefix).

Examples:

Request syntax with placeholder values


resp = client.untag_resource({
  resource_arn: "AmazonResourceName", # required
  tag_keys: ["TagKey"], # required
})

Options Hash (options):

  • :resource_arn (required, String)

    The Amazon Resource Number (ARN) of an X-Ray group or sampling rule.

  • :tag_keys (required, Array<String>)

    Keys for one or more tags that you want to remove from an X-Ray group or sampling rule.

Returns:

  • (Struct)

    Returns an empty response.

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",
  insights_configuration: {
    insights_enabled: false,
    notifications_enabled: false,
  },
})

Response structure


resp.group.group_name #=> String
resp.group.group_arn #=> String
resp.group.filter_expression #=> String
resp.group.insights_configuration.insights_enabled #=> true/false
resp.group.insights_configuration.notifications_enabled #=> true/false

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.

  • :insights_configuration (Types::InsightsConfiguration)

    The structure containing configurations related to insights.

    • The InsightsEnabled boolean can be set to true to enable insights for the group or false to disable insights for the group.

    • The NotifcationsEnabled boolean can be set to true to enable insights notifications for the group. Notifications can only be enabled on a group with InsightsEnabled set to true.

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.