-
Notifications
You must be signed in to change notification settings - Fork 116
Labels
type: bugA code related bugA code related bug
Description
A note for the community
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Problem
Behavior observed with the following scripts
server
#!/usr/bin/env python3
"""
Simple HTTP server that returns 500 N times before returning 200.
Usage: python3 flaky_server.py <fail_count> [port]
fail_count number of 500 responses before returning 200
port port to listen on (default: 8080)
"""
import sys
from http.server import BaseHTTPRequestHandler, HTTPServer
fail_count = 0
request_count = 0
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
global request_count
request_count += 1
if request_count % (fail_count + 1) != 0:
self.send_response(500)
self.end_headers()
self.wfile.write(f"Error (attempt {request_count}/{fail_count})\n".encode())
print(f"Request {request_count}: 500")
else:
self.send_response(200)
self.end_headers()
self.wfile.write(b"OK\n")
print(f"Request {request_count}: 200")
def log_message(self, format, *args):
pass # suppress default access log
if __name__ == "__main__":
if len(sys.argv) < 2:
print(__doc__)
sys.exit(1)
fail_count = int(sys.argv[1])
port = int(sys.argv[2]) if len(sys.argv) > 2 else 8080
print(f"Listening on :{port} — will 500 for first {fail_count} request(s)")
HTTPServer(("", port), Handler).serve_forever()Reproducer:
Start the server
./scripts/flaky_server.py 2Run vrl
echo 'http_request!("http://localhost:8080/")' | cargo run -p vrl-cli -q -- -qoutput:
Listening on :8080 — will 500 for first 2 request(s)
Request 1: 500
Request 2: 500
Request 3: 200
Request 4: 500
Request 5: 500
Request 6: 200
VRL Program
VRL and/or Vector Version
main
Debug Output
Example
No response
Additional Context
No response
References
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugA code related bugA code related bug