Skip to main content
Netra’s manual tracing capabilities allow you to track external API calls and custom operations with detailed observability. This section covers how to use the custom span tracking utility to monitor your application’s behavior at a granular level.

Getting Started with Manual Tracing

To start manual tracing, you’ll need to:
  1. Import the required classes
  2. Create a new span
  3. Track your operations
  4. Add relevant attributes and events
Here’s a basic example:

Start a New Span

Setting Span Attributes

You can add various attributes to your spans to provide more context about the operation:

Tracking Usage Data

Use the UsageModel to track resource usage and costs:

Adding Custom Attributes

Add custom attributes to provide additional context about your operation:

Adding Action Tracking

Enable custom action tracking in your application using our action tracking utility. The action tracking utility in Netra follows the given schema:
Refer the sample code given to understand how to implement action tracking utility in your application.

Recording Events

Track important events during the span’s lifecycle:

Real-world Examples

1. Image Generation Workflow

python

2. API Request Processing

python

3. Batch Processing

python

Common Use Cases

  1. API Request/Response Tracking
    • Track HTTP requests and responses
    • Monitor response times
    • Track error rates
    • Record request parameters
  2. Batch Processing
    • Track batch operations
    • Monitor progress
    • Record processing times
    • Track success/failure rates
  3. Image/Video Processing
    • Track media processing operations
    • Monitor resource usage
    • Record processing times
    • Track quality metrics
  4. Data Processing Pipelines
    • Track data transformation steps
    • Monitor processing stages
    • Record data volumes
    • Track error rates
  5. Machine Learning Operations
    • Track model inference
    • Monitor resource usage
    • Record processing times
    • Track model performance metricstitle: “Manual Tracking” description: “Welcome to the home of your new documentation”