Python Metrics

Learn how to setup metrics in your Python application.

Setup

Open the Vigilant dashboard and generate an API key.

Install

Install the Vigilant SDK in your Python application.

pip install vigilant-py

Initialize

Initialize the Vigilant SDK in your Python application. Vigilant automatically captures print statements.

from vigilant import init_vigilant

init_vigilant(
  name="backend",
  token="tk_1234567890" # Use your API key from the dashboard
)

Metrics Functions

The Vigilant SDK provides a function to emit metrics.

from vigilant import metric_event

def function():
  # Create a metric event
  metric_event("user_login", 1)

  # Create a metric event with a tag
  metric_event("user_login", 1, {"route": "/"})

Optional Setup

The Vigilant SDK exposes a few setup options when you initialize it.

from vigilant import init_vigilant

init_vigilant(
  # Disable all functionality
  noop=True,
)