Open
Description
Describe your environment
OS: Fedora 41
Python version: 3.13
Package version: 0.49b2 / latest
What happened?
A simple app is not instrumented properly
from http.server import BaseHTTPRequestHandler, HTTPServer
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/':
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write(b'Hello')
else:
self.send_response(404)
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write(b'not found')
def run(server_class=HTTPServer, handler_class=RequestHandler, port=8080):
server_address = ('', port)
httpd = server_class(server_address, handler_class)
print(f'Starting server on: {port}')
httpd.serve_forever()
if __name__ == '__main__':
run()
Steps to Reproduce
And instrument
pip install opentelemetry-distro opentelemetry-exporter-otlp
~/.local/bin/opentelemetry-bootstrap -a install
~/.local/bin/opentelemetry-instrument --service_name python-example --exporter_otlp_endpoint localhost:4317 --traces_exporter console,otlp --metrics_exporter console python helloworld.py
...
Starting httpd server on port 8080
127.0.0.1 - - [02/Dec/2024 13:59:40] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [02/Dec/2024 13:59:40] "GET / HTTP/1.1" 200 -
Follow steps in https://github.com/pavolloffay/otel-python-bug-03969593
Expected Result
See traces from HTTP server
Actual Result
No traces reported, no logged error in the app.
Additional context
https://github.com/pavolloffay/otel-python-bug-03969593
Would you like to implement a fix?
None