get_sampling_targets

get_sampling_targets(**kwargs)

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

See also: AWS API Documentation

Request Syntax

response = client.get_sampling_targets(
    SamplingStatisticsDocuments=[
        {
            'RuleName': 'string',
            'ClientID': 'string',
            'Timestamp': datetime(2015, 1, 1),
            'RequestCount': 123,
            'SampledCount': 123,
            'BorrowCount': 123
        },
    ]
)
Parameters
SamplingStatisticsDocuments (list) --

[REQUIRED]

Information about rules that the service is using to sample requests.

  • (dict) --

    Request sampling results for a single rule from a service. Results are for the last 10 seconds unless the service has been assigned a longer reporting interval after a previous call to GetSamplingTargets.

    • RuleName (string) -- [REQUIRED]

      The name of the sampling rule.

    • ClientID (string) -- [REQUIRED]

      A unique identifier for the service in hexadecimal.

    • Timestamp (datetime) -- [REQUIRED]

      The current time.

    • RequestCount (integer) -- [REQUIRED]

      The number of requests that matched the rule.

    • SampledCount (integer) -- [REQUIRED]

      The number of requests recorded.

    • BorrowCount (integer) --

      The number of requests recorded with borrowed reservoir quota.

Return type
dict
Returns
Response Syntax
{
    'SamplingTargetDocuments': [
        {
            'RuleName': 'string',
            'FixedRate': 123.0,
            'ReservoirQuota': 123,
            'ReservoirQuotaTTL': datetime(2015, 1, 1),
            'Interval': 123
        },
    ],
    'LastRuleModification': datetime(2015, 1, 1),
    'UnprocessedStatistics': [
        {
            'RuleName': 'string',
            'ErrorCode': 'string',
            'Message': 'string'
        },
    ]
}

Response Structure

  • (dict) --
    • SamplingTargetDocuments (list) --

      Updated rules that the service should use to sample requests.

      • (dict) --

        Temporary changes to a sampling rule configuration. To meet the global sampling target for a rule, X-Ray calculates a new reservoir for each service based on the recent sampling results of all services that called GetSamplingTargets.

        • RuleName (string) --

          The name of the sampling rule.

        • FixedRate (float) --

          The percentage of matching requests to instrument, after the reservoir is exhausted.

        • ReservoirQuota (integer) --

          The number of requests per second that X-Ray allocated for this service.

        • ReservoirQuotaTTL (datetime) --

          When the reservoir quota expires.

        • Interval (integer) --

          The number of seconds for the service to wait before getting sampling targets again.

    • LastRuleModification (datetime) --

      The last time a user changed the sampling rule configuration. If the sampling rule configuration changed since the service last retrieved it, the service should call GetSamplingRules to get the latest version.

    • UnprocessedStatistics (list) --

      Information about SamplingStatisticsDocument that X-Ray could not process.

      • (dict) --

        Sampling statistics from a call to GetSamplingTargets that X-Ray could not process.

        • RuleName (string) --

          The name of the sampling rule.

        • ErrorCode (string) --

          The error code.

        • Message (string) --

          The error message.

Exceptions

  • XRay.Client.exceptions.InvalidRequestException
  • XRay.Client.exceptions.ThrottledException