import http.server,json,gzip,time,sys
from pathlib import Path
out=Path(sys.argv[1])
class Handler(http.server.BaseHTTPRequestHandler):
 def do_POST(self):
  body=self.rfile.read(int(self.headers['Content-Length']))
  if self.headers.get('Content-Encoding')=='gzip': body=gzip.decompress(body)
  with (out/'otlp-private.ndjson').open('ab') as f:f.write(body+b'\n')
  self.send_response(200); self.send_header('Content-Type','application/json'); self.end_headers(); self.wfile.write(b'{}')
 def log_message(self,*a):pass
http.server.HTTPServer(('127.0.0.1',14318),Handler).serve_forever()
