Skip to content

XRayClient#

Index > XRay > XRayClient

Auto-generated documentation for XRay type annotations stubs module mypy-boto3-xray.

XRayClient#

Type annotations and code completion for boto3.client("xray"). boto3 documentation

# XRayClient usage example

from boto3.session import Session
from mypy_boto3_xray.client import XRayClient

def get_xray_client() -> XRayClient:
    return Session().client("xray")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("xray").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("xray")

try:
    do_something(client)
except (
    client.exceptions.ClientError,
    client.exceptions.InvalidPolicyRevisionIdException,
    client.exceptions.InvalidRequestException,
    client.exceptions.LockoutPreventionException,
    client.exceptions.MalformedPolicyDocumentException,
    client.exceptions.PolicyCountLimitExceededException,
    client.exceptions.PolicySizeLimitExceededException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.RuleLimitExceededException,
    client.exceptions.ThrottledException,
    client.exceptions.TooManyTagsException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_xray.client import Exceptions

def handle_error(exc: Exceptions.ClientError) -> None:
    ...

Methods#

batch_get_traces#

Retrieves a list of traces specified by ID.

Type annotations and code completion for boto3.client("xray").batch_get_traces method. boto3 documentation

# batch_get_traces method definition

def batch_get_traces(
    self,
    *,
    TraceIds: Sequence[str],
    NextToken: str = ...,
) -> BatchGetTracesResultTypeDef:  # (1)
    ...
  1. See BatchGetTracesResultTypeDef
# batch_get_traces method usage example with argument unpacking

kwargs: BatchGetTracesRequestRequestTypeDef = {  # (1)
    "TraceIds": ...,
}

parent.batch_get_traces(**kwargs)
  1. See BatchGetTracesRequestRequestTypeDef

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("xray").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("xray").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

create_group#

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

Type annotations and code completion for boto3.client("xray").create_group method. boto3 documentation

# create_group method definition

def create_group(
    self,
    *,
    GroupName: str,
    FilterExpression: str = ...,
    InsightsConfiguration: InsightsConfigurationTypeDef = ...,  # (1)
    Tags: Sequence[TagTypeDef] = ...,  # (2)
) -> CreateGroupResultTypeDef:  # (3)
    ...
  1. See InsightsConfigurationTypeDef
  2. See TagTypeDef
  3. See CreateGroupResultTypeDef
# create_group method usage example with argument unpacking

kwargs: CreateGroupRequestRequestTypeDef = {  # (1)
    "GroupName": ...,
}

parent.create_group(**kwargs)
  1. See CreateGroupRequestRequestTypeDef

create_sampling_rule#

Creates a rule to control sampling behavior for instrumented applications.

Type annotations and code completion for boto3.client("xray").create_sampling_rule method. boto3 documentation

# create_sampling_rule method definition

def create_sampling_rule(
    self,
    *,
    SamplingRule: SamplingRuleTypeDef,  # (1)
    Tags: Sequence[TagTypeDef] = ...,  # (2)
) -> CreateSamplingRuleResultTypeDef:  # (3)
    ...
  1. See SamplingRuleTypeDef
  2. See TagTypeDef
  3. See CreateSamplingRuleResultTypeDef
# create_sampling_rule method usage example with argument unpacking

kwargs: CreateSamplingRuleRequestRequestTypeDef = {  # (1)
    "SamplingRule": ...,
}

parent.create_sampling_rule(**kwargs)
  1. See CreateSamplingRuleRequestRequestTypeDef

delete_group#

Deletes a group resource.

Type annotations and code completion for boto3.client("xray").delete_group method. boto3 documentation

# delete_group method definition

def delete_group(
    self,
    *,
    GroupName: str = ...,
    GroupARN: str = ...,
) -> Dict[str, Any]:
    ...
# delete_group method usage example with argument unpacking

kwargs: DeleteGroupRequestRequestTypeDef = {  # (1)
    "GroupName": ...,
}

parent.delete_group(**kwargs)
  1. See DeleteGroupRequestRequestTypeDef

delete_resource_policy#

Deletes a resource policy from the target Amazon Web Services account.

Type annotations and code completion for boto3.client("xray").delete_resource_policy method. boto3 documentation

# delete_resource_policy method definition

def delete_resource_policy(
    self,
    *,
    PolicyName: str,
    PolicyRevisionId: str = ...,
) -> Dict[str, Any]:
    ...
# delete_resource_policy method usage example with argument unpacking

kwargs: DeleteResourcePolicyRequestRequestTypeDef = {  # (1)
    "PolicyName": ...,
}

parent.delete_resource_policy(**kwargs)
  1. See DeleteResourcePolicyRequestRequestTypeDef

delete_sampling_rule#

Deletes a sampling rule.

Type annotations and code completion for boto3.client("xray").delete_sampling_rule method. boto3 documentation

# delete_sampling_rule method definition

def delete_sampling_rule(
    self,
    *,
    RuleName: str = ...,
    RuleARN: str = ...,
) -> DeleteSamplingRuleResultTypeDef:  # (1)
    ...
  1. See DeleteSamplingRuleResultTypeDef
# delete_sampling_rule method usage example with argument unpacking

kwargs: DeleteSamplingRuleRequestRequestTypeDef = {  # (1)
    "RuleName": ...,
}

parent.delete_sampling_rule(**kwargs)
  1. See DeleteSamplingRuleRequestRequestTypeDef

generate_presigned_url#

Generate a presigned url given a client, its method, and arguments.

Type annotations and code completion for boto3.client("xray").generate_presigned_url method. boto3 documentation

# generate_presigned_url method definition

def generate_presigned_url(
    self,
    ClientMethod: str,
    Params: Mapping[str, Any] = ...,
    ExpiresIn: int = 3600,
    HttpMethod: str = ...,
) -> str:
    ...

get_encryption_config#

Retrieves the current encryption configuration for X-Ray data.

Type annotations and code completion for boto3.client("xray").get_encryption_config method. boto3 documentation

# get_encryption_config method definition

def get_encryption_config(
    self,
) -> GetEncryptionConfigResultTypeDef:  # (1)
    ...
  1. See GetEncryptionConfigResultTypeDef

get_group#

Retrieves group resource details.

Type annotations and code completion for boto3.client("xray").get_group method. boto3 documentation

# get_group method definition

def get_group(
    self,
    *,
    GroupName: str = ...,
    GroupARN: str = ...,
) -> GetGroupResultTypeDef:  # (1)
    ...
  1. See GetGroupResultTypeDef
# get_group method usage example with argument unpacking

kwargs: GetGroupRequestRequestTypeDef = {  # (1)
    "GroupName": ...,
}

parent.get_group(**kwargs)
  1. See GetGroupRequestRequestTypeDef

get_groups#

Retrieves all active group details.

Type annotations and code completion for boto3.client("xray").get_groups method. boto3 documentation

# get_groups method definition

def get_groups(
    self,
    *,
    NextToken: str = ...,
) -> GetGroupsResultTypeDef:  # (1)
    ...
  1. See GetGroupsResultTypeDef
# get_groups method usage example with argument unpacking

kwargs: GetGroupsRequestRequestTypeDef = {  # (1)
    "NextToken": ...,
}

parent.get_groups(**kwargs)
  1. See GetGroupsRequestRequestTypeDef

get_insight#

Retrieves the summary information of an insight.

Type annotations and code completion for boto3.client("xray").get_insight method. boto3 documentation

# get_insight method definition

def get_insight(
    self,
    *,
    InsightId: str,
) -> GetInsightResultTypeDef:  # (1)
    ...
  1. See GetInsightResultTypeDef
# get_insight method usage example with argument unpacking

kwargs: GetInsightRequestRequestTypeDef = {  # (1)
    "InsightId": ...,
}

parent.get_insight(**kwargs)
  1. See GetInsightRequestRequestTypeDef

get_insight_events#

X-Ray reevaluates insights periodically until they're resolved, and records each intermediate state as an event.

Type annotations and code completion for boto3.client("xray").get_insight_events method. boto3 documentation

# get_insight_events method definition

def get_insight_events(
    self,
    *,
    InsightId: str,
    MaxResults: int = ...,
    NextToken: str = ...,
) -> GetInsightEventsResultTypeDef:  # (1)
    ...
  1. See GetInsightEventsResultTypeDef
# get_insight_events method usage example with argument unpacking

kwargs: GetInsightEventsRequestRequestTypeDef = {  # (1)
    "InsightId": ...,
}

parent.get_insight_events(**kwargs)
  1. See GetInsightEventsRequestRequestTypeDef

get_insight_impact_graph#

Retrieves a service graph structure filtered by the specified insight.

Type annotations and code completion for boto3.client("xray").get_insight_impact_graph method. boto3 documentation

# get_insight_impact_graph method definition

def get_insight_impact_graph(
    self,
    *,
    InsightId: str,
    StartTime: Union[datetime, str],
    EndTime: Union[datetime, str],
    NextToken: str = ...,
) -> GetInsightImpactGraphResultTypeDef:  # (1)
    ...
  1. See GetInsightImpactGraphResultTypeDef
# get_insight_impact_graph method usage example with argument unpacking

kwargs: GetInsightImpactGraphRequestRequestTypeDef = {  # (1)
    "InsightId": ...,
    "StartTime": ...,
    "EndTime": ...,
}

parent.get_insight_impact_graph(**kwargs)
  1. See GetInsightImpactGraphRequestRequestTypeDef

get_insight_summaries#

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

Type annotations and code completion for boto3.client("xray").get_insight_summaries method. boto3 documentation

# get_insight_summaries method definition

def get_insight_summaries(
    self,
    *,
    StartTime: Union[datetime, str],
    EndTime: Union[datetime, str],
    States: Sequence[InsightStateType] = ...,  # (1)
    GroupARN: str = ...,
    GroupName: str = ...,
    MaxResults: int = ...,
    NextToken: str = ...,
) -> GetInsightSummariesResultTypeDef:  # (2)
    ...
  1. See InsightStateType
  2. See GetInsightSummariesResultTypeDef
# get_insight_summaries method usage example with argument unpacking

kwargs: GetInsightSummariesRequestRequestTypeDef = {  # (1)
    "StartTime": ...,
    "EndTime": ...,
}

parent.get_insight_summaries(**kwargs)
  1. See GetInsightSummariesRequestRequestTypeDef

get_sampling_rules#

Retrieves all sampling rules.

Type annotations and code completion for boto3.client("xray").get_sampling_rules method. boto3 documentation

# get_sampling_rules method definition

def get_sampling_rules(
    self,
    *,
    NextToken: str = ...,
) -> GetSamplingRulesResultTypeDef:  # (1)
    ...
  1. See GetSamplingRulesResultTypeDef
# get_sampling_rules method usage example with argument unpacking

kwargs: GetSamplingRulesRequestRequestTypeDef = {  # (1)
    "NextToken": ...,
}

parent.get_sampling_rules(**kwargs)
  1. See GetSamplingRulesRequestRequestTypeDef

get_sampling_statistic_summaries#

Retrieves information about recent sampling results for all sampling rules.

Type annotations and code completion for boto3.client("xray").get_sampling_statistic_summaries method. boto3 documentation

# get_sampling_statistic_summaries method definition

def get_sampling_statistic_summaries(
    self,
    *,
    NextToken: str = ...,
) -> GetSamplingStatisticSummariesResultTypeDef:  # (1)
    ...
  1. See GetSamplingStatisticSummariesResultTypeDef
# get_sampling_statistic_summaries method usage example with argument unpacking

kwargs: GetSamplingStatisticSummariesRequestRequestTypeDef = {  # (1)
    "NextToken": ...,
}

parent.get_sampling_statistic_summaries(**kwargs)
  1. See GetSamplingStatisticSummariesRequestRequestTypeDef

get_sampling_targets#

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

Type annotations and code completion for boto3.client("xray").get_sampling_targets method. boto3 documentation

# get_sampling_targets method definition

def get_sampling_targets(
    self,
    *,
    SamplingStatisticsDocuments: Sequence[SamplingStatisticsDocumentTypeDef],  # (1)
) -> GetSamplingTargetsResultTypeDef:  # (2)
    ...
  1. See SamplingStatisticsDocumentTypeDef
  2. See GetSamplingTargetsResultTypeDef
# get_sampling_targets method usage example with argument unpacking

kwargs: GetSamplingTargetsRequestRequestTypeDef = {  # (1)
    "SamplingStatisticsDocuments": ...,
}

parent.get_sampling_targets(**kwargs)
  1. See GetSamplingTargetsRequestRequestTypeDef

get_service_graph#

Retrieves a document that describes services that process incoming requests, and downstream services that they call as a result.

Type annotations and code completion for boto3.client("xray").get_service_graph method. boto3 documentation

# get_service_graph method definition

def get_service_graph(
    self,
    *,
    StartTime: Union[datetime, str],
    EndTime: Union[datetime, str],
    GroupName: str = ...,
    GroupARN: str = ...,
    NextToken: str = ...,
) -> GetServiceGraphResultTypeDef:  # (1)
    ...
  1. See GetServiceGraphResultTypeDef
# get_service_graph method usage example with argument unpacking

kwargs: GetServiceGraphRequestRequestTypeDef = {  # (1)
    "StartTime": ...,
    "EndTime": ...,
}

parent.get_service_graph(**kwargs)
  1. See GetServiceGraphRequestRequestTypeDef

get_time_series_service_statistics#

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

Type annotations and code completion for boto3.client("xray").get_time_series_service_statistics method. boto3 documentation

# get_time_series_service_statistics method definition

def get_time_series_service_statistics(
    self,
    *,
    StartTime: Union[datetime, str],
    EndTime: Union[datetime, str],
    GroupName: str = ...,
    GroupARN: str = ...,
    EntitySelectorExpression: str = ...,
    Period: int = ...,
    ForecastStatistics: bool = ...,
    NextToken: str = ...,
) -> GetTimeSeriesServiceStatisticsResultTypeDef:  # (1)
    ...
  1. See GetTimeSeriesServiceStatisticsResultTypeDef
# get_time_series_service_statistics method usage example with argument unpacking

kwargs: GetTimeSeriesServiceStatisticsRequestRequestTypeDef = {  # (1)
    "StartTime": ...,
    "EndTime": ...,
}

parent.get_time_series_service_statistics(**kwargs)
  1. See GetTimeSeriesServiceStatisticsRequestRequestTypeDef

get_trace_graph#

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

Type annotations and code completion for boto3.client("xray").get_trace_graph method. boto3 documentation

# get_trace_graph method definition

def get_trace_graph(
    self,
    *,
    TraceIds: Sequence[str],
    NextToken: str = ...,
) -> GetTraceGraphResultTypeDef:  # (1)
    ...
  1. See GetTraceGraphResultTypeDef
# get_trace_graph method usage example with argument unpacking

kwargs: GetTraceGraphRequestRequestTypeDef = {  # (1)
    "TraceIds": ...,
}

parent.get_trace_graph(**kwargs)
  1. See GetTraceGraphRequestRequestTypeDef

get_trace_summaries#

Retrieves IDs and annotations for traces available for a specified time frame using an optional filter.

Type annotations and code completion for boto3.client("xray").get_trace_summaries method. boto3 documentation

# get_trace_summaries method definition

def get_trace_summaries(
    self,
    *,
    StartTime: Union[datetime, str],
    EndTime: Union[datetime, str],
    TimeRangeType: TimeRangeTypeType = ...,  # (1)
    Sampling: bool = ...,
    SamplingStrategy: SamplingStrategyTypeDef = ...,  # (2)
    FilterExpression: str = ...,
    NextToken: str = ...,
) -> GetTraceSummariesResultTypeDef:  # (3)
    ...
  1. See TimeRangeTypeType
  2. See SamplingStrategyTypeDef
  3. See GetTraceSummariesResultTypeDef
# get_trace_summaries method usage example with argument unpacking

kwargs: GetTraceSummariesRequestRequestTypeDef = {  # (1)
    "StartTime": ...,
    "EndTime": ...,
}

parent.get_trace_summaries(**kwargs)
  1. See GetTraceSummariesRequestRequestTypeDef

list_resource_policies#

Returns the list of resource policies in the target Amazon Web Services account.

Type annotations and code completion for boto3.client("xray").list_resource_policies method. boto3 documentation

# list_resource_policies method definition

def list_resource_policies(
    self,
    *,
    NextToken: str = ...,
) -> ListResourcePoliciesResultTypeDef:  # (1)
    ...
  1. See ListResourcePoliciesResultTypeDef
# list_resource_policies method usage example with argument unpacking

kwargs: ListResourcePoliciesRequestRequestTypeDef = {  # (1)
    "NextToken": ...,
}

parent.list_resource_policies(**kwargs)
  1. See ListResourcePoliciesRequestRequestTypeDef

list_tags_for_resource#

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

Type annotations and code completion for boto3.client("xray").list_tags_for_resource method. boto3 documentation

# list_tags_for_resource method definition

def list_tags_for_resource(
    self,
    *,
    ResourceARN: str,
    NextToken: str = ...,
) -> ListTagsForResourceResponseTypeDef:  # (1)
    ...
  1. See ListTagsForResourceResponseTypeDef
# list_tags_for_resource method usage example with argument unpacking

kwargs: ListTagsForResourceRequestRequestTypeDef = {  # (1)
    "ResourceARN": ...,
}

parent.list_tags_for_resource(**kwargs)
  1. See ListTagsForResourceRequestRequestTypeDef

put_encryption_config#

Updates the encryption configuration for X-Ray data.

Type annotations and code completion for boto3.client("xray").put_encryption_config method. boto3 documentation

# put_encryption_config method definition

def put_encryption_config(
    self,
    *,
    Type: EncryptionTypeType,  # (1)
    KeyId: str = ...,
) -> PutEncryptionConfigResultTypeDef:  # (2)
    ...
  1. See EncryptionTypeType
  2. See PutEncryptionConfigResultTypeDef
# put_encryption_config method usage example with argument unpacking

kwargs: PutEncryptionConfigRequestRequestTypeDef = {  # (1)
    "Type": ...,
}

parent.put_encryption_config(**kwargs)
  1. See PutEncryptionConfigRequestRequestTypeDef

put_resource_policy#

Sets the resource policy to grant one or more Amazon Web Services services and accounts permissions to access X-Ray.

Type annotations and code completion for boto3.client("xray").put_resource_policy method. boto3 documentation

# put_resource_policy method definition

def put_resource_policy(
    self,
    *,
    PolicyName: str,
    PolicyDocument: str,
    PolicyRevisionId: str = ...,
    BypassPolicyLockoutCheck: bool = ...,
) -> PutResourcePolicyResultTypeDef:  # (1)
    ...
  1. See PutResourcePolicyResultTypeDef
# put_resource_policy method usage example with argument unpacking

kwargs: PutResourcePolicyRequestRequestTypeDef = {  # (1)
    "PolicyName": ...,
    "PolicyDocument": ...,
}

parent.put_resource_policy(**kwargs)
  1. See PutResourcePolicyRequestRequestTypeDef

put_telemetry_records#

Used by the Amazon Web Services X-Ray daemon to upload telemetry.

Type annotations and code completion for boto3.client("xray").put_telemetry_records method. boto3 documentation

# put_telemetry_records method definition

def put_telemetry_records(
    self,
    *,
    TelemetryRecords: Sequence[TelemetryRecordTypeDef],  # (1)
    EC2InstanceId: str = ...,
    Hostname: str = ...,
    ResourceARN: str = ...,
) -> Dict[str, Any]:
    ...
  1. See TelemetryRecordTypeDef
# put_telemetry_records method usage example with argument unpacking

kwargs: PutTelemetryRecordsRequestRequestTypeDef = {  # (1)
    "TelemetryRecords": ...,
}

parent.put_telemetry_records(**kwargs)
  1. See PutTelemetryRecordsRequestRequestTypeDef

put_trace_segments#

Uploads segment documents to Amazon Web Services X-Ray.

Type annotations and code completion for boto3.client("xray").put_trace_segments method. boto3 documentation

# put_trace_segments method definition

def put_trace_segments(
    self,
    *,
    TraceSegmentDocuments: Sequence[str],
) -> PutTraceSegmentsResultTypeDef:  # (1)
    ...
  1. See PutTraceSegmentsResultTypeDef
# put_trace_segments method usage example with argument unpacking

kwargs: PutTraceSegmentsRequestRequestTypeDef = {  # (1)
    "TraceSegmentDocuments": ...,
}

parent.put_trace_segments(**kwargs)
  1. See PutTraceSegmentsRequestRequestTypeDef

tag_resource#

Applies tags to an existing Amazon Web Services X-Ray group or sampling rule.

Type annotations and code completion for boto3.client("xray").tag_resource method. boto3 documentation

# tag_resource method definition

def tag_resource(
    self,
    *,
    ResourceARN: str,
    Tags: Sequence[TagTypeDef],  # (1)
) -> Dict[str, Any]:
    ...
  1. See TagTypeDef
# tag_resource method usage example with argument unpacking

kwargs: TagResourceRequestRequestTypeDef = {  # (1)
    "ResourceARN": ...,
    "Tags": ...,
}

parent.tag_resource(**kwargs)
  1. See TagResourceRequestRequestTypeDef

untag_resource#

Removes tags from an Amazon Web Services X-Ray group or sampling rule.

Type annotations and code completion for boto3.client("xray").untag_resource method. boto3 documentation

# untag_resource method definition

def untag_resource(
    self,
    *,
    ResourceARN: str,
    TagKeys: Sequence[str],
) -> Dict[str, Any]:
    ...
# untag_resource method usage example with argument unpacking

kwargs: UntagResourceRequestRequestTypeDef = {  # (1)
    "ResourceARN": ...,
    "TagKeys": ...,
}

parent.untag_resource(**kwargs)
  1. See UntagResourceRequestRequestTypeDef

update_group#

Updates a group resource.

Type annotations and code completion for boto3.client("xray").update_group method. boto3 documentation

# update_group method definition

def update_group(
    self,
    *,
    GroupName: str = ...,
    GroupARN: str = ...,
    FilterExpression: str = ...,
    InsightsConfiguration: InsightsConfigurationTypeDef = ...,  # (1)
) -> UpdateGroupResultTypeDef:  # (2)
    ...
  1. See InsightsConfigurationTypeDef
  2. See UpdateGroupResultTypeDef
# update_group method usage example with argument unpacking

kwargs: UpdateGroupRequestRequestTypeDef = {  # (1)
    "GroupName": ...,
}

parent.update_group(**kwargs)
  1. See UpdateGroupRequestRequestTypeDef

update_sampling_rule#

Modifies a sampling rule's configuration.

Type annotations and code completion for boto3.client("xray").update_sampling_rule method. boto3 documentation

# update_sampling_rule method definition

def update_sampling_rule(
    self,
    *,
    SamplingRuleUpdate: SamplingRuleUpdateTypeDef,  # (1)
) -> UpdateSamplingRuleResultTypeDef:  # (2)
    ...
  1. See SamplingRuleUpdateTypeDef
  2. See UpdateSamplingRuleResultTypeDef
# update_sampling_rule method usage example with argument unpacking

kwargs: UpdateSamplingRuleRequestRequestTypeDef = {  # (1)
    "SamplingRuleUpdate": ...,
}

parent.update_sampling_rule(**kwargs)
  1. See UpdateSamplingRuleRequestRequestTypeDef

get_paginator#

Type annotations and code completion for boto3.client("xray").get_paginator method with overloads.