OpenTelemetry HTTP Utilities

0.61b0 · active · verified Sat Mar 28

Provides HTTP-related utilities for OpenTelemetry instrumentation, currently at version 0.61b0, with a beta release cadence.

Warnings

Install

Imports

Quickstart

A basic example of using OpenTelemetry's HTTPX instrumentation to monitor HTTP requests.

import os
from opentelemetry.instrumentation.httpx import HttpInstrumentation

# Initialize the HTTPX instrumentation
httpx_instrumentor = HttpInstrumentation()
httpx_instrumentor.enable()

# Your application code here
# For example, making an HTTP request using httpx
import httpx

client = httpx.Client()
response = client.get('http://example.com')
print(response.status_code)

# Disable the instrumentation when done
httpx_instrumentor.disable()

view raw JSON →