Skip to main content

devskin-agent

DevSkin APM Agent for Python - Automatic instrumentation for Flask, Django, and FastAPI.

Installation

pip install devskin-agent

Quick Start

Flask

from flask import Flask
from devskin_agent import init, start_agent
from devskin_agent.instrumentation import flask_middleware

# Initialize agent
agent = init(
    server_url='http://localhost:3000',
    api_key='your-api-key',
    service_name='my-flask-app',
    service_version='1.0.0',
    environment='production',
)

start_agent()

# Create Flask app
app = Flask(__name__)

# Add middleware
flask_middleware(app, agent)

@app.route('/api/users')
def get_users():
    # Automatically traced!
    return {'users': []}

if __name__ == '__main__':
    app.run()

Django

Add to your settings.py:

MIDDLEWARE = [
    'devskin_agent.instrumentation.DjangoMiddleware',
    # ... other middleware
]

# At the end of settings.py
from devskin_agent import init, start_agent

DEVSKIN_AGENT = init(
    server_url='http://localhost:3000',
    api_key='your-api-key',
    service_name='my-django-app',
    environment='production',
)

start_agent()

FastAPI

from fastapi import FastAPI
from devskin_agent import init, start_agent
from devskin_agent.instrumentation import fastapi_middleware

# Initialize agent
agent = init(
    server_url='http://localhost:3000',
    api_key='your-api-key',
    service_name='my-fastapi-app',
)

start_agent()

# Create FastAPI app
app = FastAPI()

# Add middleware
fastapi_middleware(app, agent)

@app.get('/api/users')
async def get_users():
    # Automatically traced!
    return {'users': []}

Manual Span Creation

from devskin_agent import get_agent, SpanBuilder, SpanKind

agent = get_agent()

def process_order(order_id):
    span = SpanBuilder(
        name='process_order',
        kind=SpanKind.INTERNAL,
        service_name=agent.get_config().service_name,
        agent=agent
    )

    span.set_attribute('order.id', order_id)

    try:
        # Your business logic
        order = fetch_order(order_id)
        span.set_attribute('order.amount', order['amount'])
        return order
    except Exception as e:
        span.record_error(e)
        raise
    finally:
        span.end()

Configuration

Parameter Type Default Description
server_url str required DevSkin backend URL
api_key str required API key for authentication
service_name str required Name of your service
service_version str None Version of your service
environment str None Environment (production, staging, etc)
enabled bool True Enable/disable agent
sample_rate float 1.0 Sample rate (0.0 to 1.0)
batch_size int 100 Batch size before flushing
flush_interval float 10.0 Flush interval in seconds
debug bool False Enable debug logging

Environment Variables

export DEVSKIN_SERVER_URL=http://localhost:3000
export DEVSKIN_API_KEY=your-api-key
export DEVSKIN_SERVICE_NAME=my-service
export DEVSKIN_ENVIRONMENT=production
export DEVSKIN_SAMPLE_RATE=1.0
import os
from devskin_agent import init

agent = init(
    server_url=os.getenv('DEVSKIN_SERVER_URL'),
    api_key=os.getenv('DEVSKIN_API_KEY'),
    service_name=os.getenv('DEVSKIN_SERVICE_NAME'),
    environment=os.getenv('DEVSKIN_ENVIRONMENT'),
    sample_rate=float(os.getenv('DEVSKIN_SAMPLE_RATE', '1.0')),
)

Features

  • ✅ Automatic Flask instrumentation
  • ✅ Automatic Django instrumentation
  • ✅ Automatic FastAPI instrumentation
  • ✅ Manual span creation
  • ✅ Distributed tracing with trace ID propagation
  • ✅ Error tracking and reporting
  • ✅ Sampling support
  • ✅ Context propagation across async operations
  • ✅ Service discovery

License

MIT

Metadata

Release files for devskin-agent 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for devskin-agent 1.0.0
File Size Uploaded
devskin_agent-1.0.0.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for devskin-agent 1.0.0
File Interpreter ABI Platform
devskin_agent-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / devskin_agent-1.0.0.tar.gz

Download URL devskin_agent-1.0.0.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8f22a75ff0eceb4baaf9198825e7ab50f153be799d563a0bcf507c2e149f948e
BLAKE2b-256 checksum
How to use checksums
9de5de54d9ddb9ec0b11b4b93cec1b3cb791b8df1a16aa9066a28b1eade7c7bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / devskin_agent-1.0.0-py3-none-any.whl

Download URL devskin_agent-1.0.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4bb7515dd1c34c357d660969729e9839d5f77c501b03840940e9c5d1cbba42c2
BLAKE2b-256 checksum
How to use checksums
716fe4701dccaa7efba915a962afddbb05ec80ce18a16a2bd9f97d175b06af82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page