use of com.amazonaws.services.xray.model.SamplingStatisticsDocument in project aws-xray-sdk-java by aws.
the class CentralizedManifest method snapshots.
public List<SamplingStatisticsDocument> snapshots(Instant now) {
List<SamplingStatisticsDocument> snapshots = new ArrayList<>(rules.size() + 1);
Date date = Date.from(now);
for (CentralizedRule rule : rules.values()) {
if (!rule.isStale(now)) {
continue;
}
SamplingStatisticsDocument snapshot = rule.snapshot(date);
snapshot.withClientID(CentralizedSamplingStrategy.getClientID());
snapshots.add(snapshot);
}
if (defaultRule != null && defaultRule.isStale(now)) {
SamplingStatisticsDocument snapshot = defaultRule.snapshot(date);
snapshot.withClientID(CentralizedSamplingStrategy.getClientID());
snapshots.add(snapshot);
}
return snapshots;
}
use of com.amazonaws.services.xray.model.SamplingStatisticsDocument in project aws-xray-sdk-java by aws.
the class TargetPoller method pollManifest.
private void pollManifest() {
List<SamplingStatisticsDocument> statistics = manifest.snapshots(clock.instant());
if (statistics.size() == 0) {
logger.trace("No statistics to report. Not refreshing sampling targets.");
return;
}
logger.debug("Polling sampling targets.");
GetSamplingTargetsRequest req = new GetSamplingTargetsRequest().withSamplingStatisticsDocuments(statistics);
GetSamplingTargetsResult result = client.getSamplingTargets(req);
manifest.putTargets(result.getSamplingTargetDocuments(), clock.instant());
}
Aggregations