aws_xray_sdk.core.sampling.connector

Module Contents

class ServiceConnector

Bases:object

Connector class that translates Centralized Sampling poller functions to actual X-Ray back-end APIs and communicates with X-Ray daemon as the signing proxy.

context
_context_wrapped(func)

Wrapping boto calls with dummy segment. This is because botocore has two dependencies (requests and httplib) that might be monkey-patched in user code to capture subsegments. The wrapper makes sure there is always a non-sampled segment present when the connector makes an AWS API call using botocore. This context wrapper doesn’t work with asyncio based context as event loop is not thread-safe.

fetch_sampling_rules(self)

Use X-Ray botocore client to get the centralized sampling rules from X-Ray service. The call is proxied and signed by X-Ray Daemon.

fetch_sampling_target(self, rules)

Report the current statistics of sampling rules and get back the new assgiend quota/TTL froom the X-Ray service. The call is proxied and signed via X-Ray Daemon.

setup_xray_client(self, ip, port, client)

Setup the xray client based on ip and port. If a preset client is specified, ip and port will be ignored.

_generate_reporting_docs(self, rules, now)
_dt_to_epoch(self, dt)

Convert a offset-aware datetime to POSIX time.

_is_rule_valid(self, record)
_create_xray_client(self, ip='127.0.0.1', port='2000')