Skip to main content

Overview

The @track_endpoint decorator provides HTTP endpoint tracing for Flask applications with automatic request/response monitoring. It’s designed to work seamlessly with Flask and extends the functionality of the basic @trace decorator.

Quick Example with OpenAI

Here’s a simple Flask endpoint that generates text using OpenAI:
The decorator automatically captures:
  • HTTP request data (method, URL, headers, body)
  • HTTP response data (status code, headers, body)
  • OpenAI API calls and their results
  • Any errors that occur during request processing
You can customize tracing with parameters like:
  • name: Custom name for the trace
  • tags: List or dict of tags for categorizing traces
  • capture_request: Whether to capture request data (default: True)
  • capture_response: Whether to capture response data (default: True)