aws / aws/aws-xray-sdk-java

Perform out of band sampling rule polling when sampling rules are updated in the X-Ray console

Aperta
#82 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Java
Stelle
100
Fork
100
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

# Background
For centralized sampling strategy (default), rule poller and target poller threads are asynchronously [spawned](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/CentralizedSamplingStrategy.java#L55) in the background to fetch sampling rules from the X-Ray console using X-Ray daemon.
1. Rule poller makes call to [GetSamplingRules](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/pollers/RulePoller.java#L65) X-Ray API every [5 min](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/pollers/RulePoller.java#L27) with jitter to fetch sampling rules from the X-Ray console.
2. Target poller makes call to [GetSamplingTargets](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/pollers/TargetPoller.java#L65) X-Ray API every [10 sec](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/pollers/TargetPoller.java#L22) with jitter. This reports rule matched statistics within the interval to X-Ray service.

# Issue
After rule poller fetches sampling rules, if a sampling rule is created/updated/deleted, the X-Ray instrumented application will get the updated sampling rules list in the next iteration of the rule poller fetch call. In the worst case it will take 5 min for the application to start using updated list of sampling rules fetched from the X-Ray console.

# Expected Behavior
Ideally, if the sampling rules are updated from the X-Ray console, target poller should perform out of band polling of waking up rule poller to fetch updated sampling rules. In this case, the application will start using updated sampling rules in the following iteration of target poller. The worst case will be 10 seconds.

In order to do this, leverage `GetsamplingTargets` API response instance - [`GetSamplingTargetsResult`](https://github.com/aws/aws-xray-sdk-java/blob/master/aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/strategy/sampling/pollers/TargetPoller.java#L65). It has method `getLastRuleModification()` method that returns the last time a user changed the sampling rule configuration from the X-Ray console.

# Reference
AWS X-Ray SDK for .NET/Core has necessary logic : [code](https://github.com/aws/aws-xray-sdk-dotnet/blob/f41ad03fbec63b63a246bf76e4748c5fe346cadf/sdk/src/Core/Sampling/TargetPoller.cs#L86)

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da CentralizedSamplingStrategy.java, RulePoller.java e TargetPoller.java per comprendere il flusso di polling esistente e la gestione delle risposte. Confronta il comportamento con l’implementazione .NET collegata di TargetPoller, quindi verifica che le modifiche alle regole di sampling nella console vengano rilevate tramite GetSamplingTargetsResult e che le regole aggiornate vengano recuperate entro l’intervallo di polling dei target.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
aws, java
Ambito
observability-sre
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.