@@ -5,33 +5,33 @@ Record HTTP request/response pairs in a controlled environment, inspect a captur
55> ** Security notice**
66> Replay is intended for ** development, staging, canary, and incident-response environments** . Do not expose the admin endpoints publicly on the open internet.
77
8- ## Ne zaman kullanılır?
8+ ## When to use it
99
10- Replay en çok şu durumlarda işe yarar :
10+ Replay is most useful when :
1111
12- - staging ile local arasında davranış farkı varsa
13- - bir regresyonu gerçek trafik örneğiyle yeniden üretmek istiyorsanız
14- - yeni bir sürümü canary ortamına almadan önce kritik istekleri tekrar koşturmak istiyorsanız
15- - “bu istek neden dün çalışıyordu da bugün bozuldu ?” sorusuna zaman makinesi tadında cevap arıyorsanız
12+ - behavior differs between staging and local
13+ - you need to reproduce a regression using a real traffic sample
14+ - you want to rerun critical requests before promoting a new version to canary
15+ - you are asking, “why did this request work yesterday but break today ?” and want a time-machine-style answer
1616
17- ## Ön koşullar
17+ ## Prerequisites
1818
19- Uygulamada canonical replay feature'ını açın :
19+ Enable the canonical replay feature in your application :
2020
2121``` toml
2222[dependencies ]
2323rustapi-rs = { version = " 0.1.335" , features = [" extras-replay" ] }
2424```
2525
26- CLI tarafında ` cargo-rustapi ` yeterlidir ; replay komutları varsayılan kurulumun parçasıdır :
26+ On the CLI side, ` cargo-rustapi ` is enough ; replay commands are part of the default installation :
2727
2828``` bash
2929cargo install cargo-rustapi
3030```
3131
32- ## 1) Replay kaydını etkinleştir
32+ ## 1) Enable replay recording
3333
34- En küçük pratik kurulum için in-memory store ile başlayın :
34+ For the smallest practical setup, start with an in-memory store:
3535
3636``` rust,ignore
3737use rustapi_rs::extras::replay::{InMemoryReplayStore, ReplayConfig, ReplayLayer};
@@ -62,122 +62,122 @@ async fn main() -> std::result::Result<(), Box<dyn std::error::Error + Send + Sy
6262}
6363```
6464
65- Bu kurulum şunları yapar :
65+ This setup :
6666
67- - replay kaydını açık hale getirir
68- - admin endpoint'lerini bearer token ile korur
69- - probe endpoint'lerini kayıttan çıkarır
70- - girdileri 15 dakika saklar
71- - bellekte en fazla 200 kayıt tutar
67+ - enables replay recording
68+ - protects the admin endpoints with a bearer token
69+ - excludes probe endpoints from recording
70+ - keeps entries for 15 minutes
71+ - stores at most 200 records in memory
7272
73- ## 2) Hedef trafiği üret
73+ ## 2) Generate target traffic
7474
75- Artık uygulamaya normal şekilde istek atın. Replay middleware uygulama kodunuzu değiştirmeden request/response çiftlerini yakalar .
75+ Now send requests to the application as usual. The replay middleware captures request/response pairs without changing your application code .
7676
77- Kayıt akışı şöyledir :
77+ The recording flow looks like this :
7878
79- 1 . istek geçer
80- 2 . request metadata ve uygun body alanları saklanır
81- 3 . response durumu, header'ları ve yakalanabilir body içeriği saklanır
82- 4 . kayıt admin API ve CLI üzerinden erişilebilir hale gelir
79+ 1 . the request passes through
80+ 2 . request metadata and eligible body fields are stored
81+ 3 . response status, headers, and capturable body content are stored
82+ 4 . the record becomes accessible through the admin API and CLI
8383
84- ## 3) Kayıtları listele ve doğru girdiyi bul
84+ ## 3) List recordings and find the right entry
8585
86- İlk bakış için CLI en rahat yol :
86+ For a first look, the CLI is the easiest path :
8787
8888``` bash
89- # Son replay girdilerini listele
89+ # List recent replay entries
9090cargo rustapi replay list -s http://localhost:8080 -t local-replay-token
9191
92- # Sadece belirli bir endpoint'i filtrele
92+ # Filter to a specific endpoint only
9393cargo rustapi replay list -s http://localhost:8080 -t local-replay-token --method GET --path /api/users --limit 20
9494```
9595
96- Liste çıktısı size şu alanları gösterir :
96+ The list output shows these fields :
9797
98- - replay kimliği
98+ - replay ID
9999- HTTP method
100100- path
101- - orijinal response status kodu
102- - toplam süre
101+ - original response status code
102+ - total duration
103103
104- ## 4) Tek bir girdiyi incele
104+ ## 4) Inspect a single entry
105105
106- Şüpheli isteği bulduktan sonra tam kaydı açın :
106+ Once you find the suspicious request, open the full record :
107107
108108``` bash
109109cargo rustapi replay show < id> -s http://localhost:8080 -t local-replay-token
110110```
111111
112- Bu komut tipik olarak şunları gösterir :
112+ This command typically shows :
113113
114- - orijinal request method ve URI
115- - saklanan header'lar
116- - yakalanan request body
117- - orijinal response status/body
118- - duration, client IP ve request ID gibi meta alanlar
114+ - the original request method and URI
115+ - stored headers
116+ - the captured request body
117+ - the original response status/body
118+ - metadata such as duration, client IP, and request ID
119119
120- ## 5) Aynı isteği başka bir ortama tekrar koştur
120+ ## 5) Replay the same request against another environment
121121
122- Şimdi aynı isteği local düzeltmeniz , staging ya da canary ortamınız üzerinde çalıştırabilirsiniz :
122+ You can now run the same request against your local fix , staging, or canary environment :
123123
124124``` bash
125125cargo rustapi replay run < id> -s http://localhost:8080 -t local-replay-token -T http://localhost:3000
126126```
127127
128- Pratik kullanım örnekleri :
128+ Practical uses include :
129129
130- - local düzeltmenin gerçekten incident'ı çözüp çözmediğini görmek
131- - staging ortamının eski üretim davranışıyla uyumunu kontrol etmek
132- - kritik endpoint'leri deploy öncesi smoke test gibi replay etmek
130+ - verifying that the local fix really resolves the incident
131+ - checking whether staging still matches the previous production behavior
132+ - replaying critical endpoints as a pre-deploy smoke test
133133
134- ## 6) Farkları otomatik çıkar
134+ ## 6) Generate diffs automatically
135135
136- Asıl sihir burada: replay edilen response ile orijinal response'u karşılaştırın .
136+ This is where the real magic happens: compare the replayed response with the original response .
137137
138138``` bash
139139cargo rustapi replay diff < id> -s http://localhost:8080 -t local-replay-token -T http://staging:8080
140140```
141141
142- ` diff ` çıktısı şu alanlarda fark arar :
142+ The ` diff ` output looks for differences in :
143143
144144- status code
145- - response header'ları
146- - JSON body alanları
145+ - response headers
146+ - JSON body fields
147147
148- Bu sayede “200 döndü ama payload değişti” gibi daha sinsi regresyonları da yakalarsınız.
148+ That lets you catch subtler regressions too, such as “it still returned 200, but the payload changed.”
149149
150- ## Önerilen resmi workflow
150+ ## Recommended workflow
151151
152- Bir incident ya da regresyon sırasında önerilen akış şu sıradadır :
152+ During an incident or regression, the recommended flow is :
153153
154- 1 . ** Kayıt aç ** : replay'i staging/canary ortamında kısa TTL ile etkinleştir .
155- 2 . ** Örneği yakala ** : problemi üreten gerçek isteği yeniden geçir .
156- 3 . ** Listele ** : ` cargo rustapi replay list ` ile doğru girdiyi bul .
157- 4 . ** İncele ** : ` cargo rustapi replay show ` ile request/response çiftini doğrula .
158- 5 . ** Düzeltmeyi dene ** : girdiyi local veya aday sürüme ` run ` ile tekrar oynat .
159- 6 . ** Diff al ** : ` diff ` ile davranışın beklenen şekilde değiştiğini doğrula .
160- 7 . ** Kapat ** : incident sonrası replay kaydını kapat veya TTL'i kısa tut .
154+ 1 . ** Start recording ** : enable replay in staging/canary with a short TTL .
155+ 2 . ** Capture the example ** : replay the real request that triggers the problem .
156+ 3 . ** List ** : find the right entry with ` cargo rustapi replay list ` .
157+ 4 . ** Inspect ** : validate the request/response pair with ` cargo rustapi replay show ` .
158+ 5 . ** Try the fix ** : rerun the entry against your local build or release candidate with ` run ` .
159+ 6 . ** Diff it ** : use ` diff ` to confirm the behavior changed as expected .
160+ 7 . ** Turn it off ** : disable replay recording after the incident or keep the TTL short .
161161
162- Kısacası : ** capture → inspect → replay → diff → promote** .
162+ In short : ** capture → inspect → replay → diff → promote** .
163163
164- ## Admin API referansı
164+ ## Admin API reference
165165
166- Tüm admin endpoint'leri şu header'ı ister :
166+ All admin endpoints require this header :
167167
168168``` text
169169Authorization: Bearer <admin_token>
170170```
171171
172- | Method | Path | Açıklama |
173- | --------| ------| ----------|
174- | GET | ` /__rustapi/replays ` | Kayıtları listele |
175- | GET | ` /__rustapi/replays/{id} ` | Tek bir girdiyi göster |
176- | POST | ` /__rustapi/replays/{id}/run?target=URL ` | İsteği başka hedefe replay et |
177- | POST | ` /__rustapi/replays/{id}/diff?target=URL ` | Replay et ve fark üret |
178- | DELETE | ` /__rustapi/replays/{id} ` | Bir girdiyi sil |
172+ | Method | Path | Description |
173+ | --------| ------| ------------- |
174+ | GET | ` /__rustapi/replays ` | List recordings |
175+ | GET | ` /__rustapi/replays/{id} ` | Show a single entry |
176+ | POST | ` /__rustapi/replays/{id}/run?target=URL ` | Replay the request against another target |
177+ | POST | ` /__rustapi/replays/{id}/diff?target=URL ` | Replay the request and generate a diff |
178+ | DELETE | ` /__rustapi/replays/{id} ` | Delete an entry |
179179
180- ### cURL örnekleri
180+ ### cURL examples
181181
182182``` bash
183183curl -H " Authorization: Bearer local-replay-token" \
@@ -193,9 +193,9 @@ curl -X POST -H "Authorization: Bearer local-replay-token" \
193193 " http://localhost:8080/__rustapi/replays/<id>/diff?target=http://staging:8080"
194194```
195195
196- ## Konfigürasyon notları
196+ ## Configuration notes
197197
198- ` ReplayConfig ` ile en sık ayarlanan seçenekler :
198+ These are the ` ReplayConfig ` options you will adjust most often :
199199
200200``` rust,ignore
201201use rustapi_rs::extras::replay::ReplayConfig;
@@ -218,18 +218,18 @@ let config = ReplayConfig::new()
218218 .admin_route_prefix("/__admin/replays");
219219```
220220
221- Varsayılan olarak şu header'lar ` [REDACTED] ` olarak saklanır :
221+ By default, these headers are stored as ` [REDACTED] ` :
222222
223223- ` authorization `
224224- ` cookie `
225225- ` x-api-key `
226226- ` x-auth-token `
227227
228- JSON body redaction recursive çalışır; örneğin ` password ` alanı iç içe nesnelerde de maskelenir .
228+ JSON body redaction works recursively; for example, a ` password ` field is masked even inside nested objects .
229229
230- ## Kalıcı saklama için filesystem store
230+ ## Filesystem store for persistent retention
231231
232- Geliştirici makinesi yeniden başlasa bile kayıtların kalmasını istiyorsanız filesystem store kullanın :
232+ If you want the records to survive a developer-machine restart, use the filesystem store:
233233
234234``` rust,ignore
235235use rustapi_rs::extras::replay::{
@@ -249,9 +249,9 @@ let fs_store = FsReplayStore::new(FsReplayStoreConfig {
249249let replay = ReplayLayer::new(config).with_store(fs_store);
250250```
251251
252- ## Özel backend yazmak isterseniz
252+ ## If you want to write a custom backend
253253
254- Redis, object storage ya da kurumsal bir audit backend'i kullanmak istiyorsanız ` ReplayStore ` trait'ini uygulayın :
254+ If you want to use Redis, object storage, or an enterprise audit backend, implement the ` ReplayStore ` trait:
255255
256256``` rust,ignore
257257use async_trait::async_trait;
@@ -303,33 +303,33 @@ impl ReplayStore for MyCustomStore {
303303}
304304```
305305
306- ## Doğrulama kontrol listesi
306+ ## Verification checklist
307307
308- Replay kurulumundan sonra şu kısa kontrolü yapın :
308+ After setting up replay, run this short check :
309309
310- 1 . uygulamaya bir istek gönderin
311- 2 . ` cargo rustapi replay list -t <token> ` ile girdiyi görün
312- 3 . ` cargo rustapi replay show <id> -t <token> ` ile body/header kaydını doğrulayın
313- 4 . ` cargo rustapi replay diff <id> -t <token> -T <target> ` ile karşılaştırma alın
310+ 1 . send a request to the application
311+ 2 . use ` cargo rustapi replay list -t <token> ` to confirm the entry appears
312+ 3 . use ` cargo rustapi replay show <id> -t <token> ` to verify the stored body/header data
313+ 4 . use ` cargo rustapi replay diff <id> -t <token> -T <target> ` to compare the results
314314
315- Bu dört adım başarılıysa workflow hazırdır .
315+ If these four steps succeed, the workflow is ready .
316316
317- ## Güvenlik özeti
317+ ## Security summary
318318
319- Replay sistemi birden fazla koruma ile gelir :
319+ The replay system includes several safeguards :
320320
321- 1 . ** Varsayılan kapalıdır ** : ` enabled(false) ` ile başlar .
322- 2 . ** Admin token zorunludur ** : admin endpoint'leri bearer token ister .
323- 3 . ** Header redaction vardır ** : hassas header'lar maskelenir .
324- 4 . ** Body field redaction vardır ** : JSON alanları seçmeli maskelenebilir .
325- 5 . ** TTL uygulanır ** : eski kayıtlar otomatik temizlenir .
326- 6 . ** Body boyutu sınırlandırılır ** : request/response capture sınırlıdır .
327- 7 . ** Bounded storage kullanılır ** : in-memory store FIFO eviction ile sınırlıdır .
321+ 1 . ** Disabled by default ** : it starts with ` enabled(false) ` .
322+ 2 . ** Admin token required ** : admin endpoints require a bearer token.
323+ 3 . ** Header redaction** : sensitive headers are masked .
324+ 4 . ** Body field redaction** : JSON fields can be selectively masked .
325+ 5 . ** TTL enforced ** : old records are cleaned up automatically .
326+ 6 . ** Body size limits ** : request/response capture is size-limited .
327+ 7 . ** Bounded storage** : the in-memory store is limited with FIFO eviction .
328328
329- Öneriler :
329+ Recommendations :
330330
331- - replay'i herkese açık production ingress arkasında açmayın
332- - kısa TTL kullanın
333- - uygulamaya özel gizli alanları redaction listesine ekleyin
334- - büyük kapasite ile in-memory store kullanıyorsanız bellek tüketimini izleyin
335- - incident sonrasında replay kaydını kapatmayı düşünün
331+ - do not enable replay behind a publicly exposed production ingress
332+ - use a short TTL
333+ - add application-specific secret fields to the redaction list
334+ - monitor memory usage if you use a large-capacity in-memory store
335+ - consider turning replay recording off after the incident
0 commit comments