asafm commented on PR #4164:
URL: https://github.com/apache/bookkeeper/pull/4164#issuecomment-1877234231
> OK, Now I am filtering JVM metrics by writing a Python server proxy ——————
>
> ```python
> #!/bin/python
>
> import SimpleHTTPServer
> import SocketServer
> import subprocess
> import requests
>
> class CustomHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
> def do_GET(self):
> if self.path == '/metrics':
>
> response = requests.get('http://localhost:8080/metrics/')
> output = '\n'.join(line for line in response.text.split('\n')
if 'jvm' in line)
> self.send_response(200)
> self.send_header('Content-type', 'text/plain')
> self.end_headers()
> self.wfile.write(output)
>
> PORT = 9001
> httpd = SocketServer.TCPServer(("", PORT), CustomHandler)
> print "Server running on port", PORT
> httpd.serve_forever()
> ```
You can just use OTel Collector. It has built-in functionality to do just
that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]