Skip to main content

Vibemonitor Python SDK — capture and send logs to Vibemonitor

Project description

Vibemonitor Python SDK

Capture and send application logs to Vibemonitor with one line of code.

Installation

pip install vibemonitor

Quick Start

import vibemonitor

vibemonitor.init(api_key="your-api-key")

That's it. All your existing Python logging is now auto-captured and sent to Vibemonitor.

import logging

logger = logging.getLogger("auth-service")

logger.info("User 46 logged in")              # → sent to Vibemonitor
logger.error("OTP expired for user 45")        # → sent to Vibemonitor
logger.exception("Payment failed")            # → sent with full traceback

How It Works

  1. Auto-capture — The SDK hooks into Python's built-in logging module. Every logger.info(), logger.error(), logger.exception() call is automatically captured.

  2. Non-blocking — Logs are queued in memory and sent by a background thread. Your application is never slowed down.

  3. Compressed — Logs are gzip-compressed before sending, reducing bandwidth by ~80%.

  4. Safe — The SDK never crashes your application. All internal errors are silently handled.

  5. Auto-detect service name — If you don't specify a service name, the SDK detects it automatically from pyproject.toml, Flask, Django, FastAPI, or the script filename.

Get Your API Key

  1. Log in to vibemonitor.ai
  2. Go to SettingsAPI Keys
  3. Click Create API Key and copy the token

Configuration

vibemonitor.init(
    api_key="your-api-key",
    service="auth-service",      # optional: auto-detected if not set
    environment="production",    # optional: from VIBEMONITOR_ENV env var
    version="2.3.1",             # optional: from VIBEMONITOR_VERSION env var
)

Service Name Auto-Detection

If you don't pass service=, the SDK detects it automatically:

Priority Source Example
1 init(service="auth") auth
2 VIBEMONITOR_SERVICE env var auth-service
3 pyproject.toml name field my-api
4 Flask / Django / FastAPI app name payments
5 Script filename auth_service (from auth_service.py)
6 Fallback unknown-service

Environment Variables

All settings can be configured via environment variables:

VIBEMONITOR_SERVICE=auth-service
VIBEMONITOR_ENV=production
VIBEMONITOR_VERSION=2.3.1
VIBEMONITOR_FLUSH_INTERVAL=2.0          # seconds between flushes (default: 2)
VIBEMONITOR_MAX_QUEUE_SIZE=1000         # max logs in queue (default: 1000)
VIBEMONITOR_SCRUB_PATTERNS=email,ip,credit_card,password,jwt,aws_key

Data Scrubbing

The SDK automatically redacts sensitive data before sending. Enabled by default for: emails, phone numbers, IPs, credit cards, passwords, JWTs, AWS keys, and more.

Manual Logging

For logs outside the standard logging module:

vibemonitor.log(
    severity="ERROR",
    message="Custom event occurred",
    attributes={"user_id": "45", "order_id": "991"}
)

Shutdown

To flush remaining logs on app exit:

vibemonitor.shutdown()

This is called automatically via atexit, but you can call it explicitly for immediate flush.

Requirements

  • Python 3.8+
  • httpx (installed automatically)

Development

Releasing a New Version

  1. Update version in pyproject.toml:

    version = "0.1.0"  →  version = "0.2.0"
    
  2. Commit the change:

    git add pyproject.toml
    git commit -m "bump version to 0.2.0"
    
  3. Tag and push:

    git tag v0.2.0
    git push origin main --tags
    

GitHub Actions automatically builds and publishes to PyPI when it sees the tag.

How the Release Pipeline Works

git push --tags
    │
    ▼
GitHub sees tag v0.2.0
    │
    ▼
Workflow runs (.github/workflows/publish.yml):
    1. Checkout code
    2. Verify pyproject.toml version matches tag (safety check)
    3. python -m build (creates .whl and .tar.gz)
    4. twine upload to PyPI (uses PYPI_API_TOKEN secret)
    │
    ▼
PyPI has vibemonitor 0.2.0
    │
    ▼
Customers update: pip install --upgrade vibemonitor

Setup (One-Time)

Add your PyPI API token as a GitHub secret:

  1. Go to pypi.org/manage/account/#api-tokens → Create token
  2. Go to your SDK repo → Settings → Secrets → Actions → New secret
  3. Name: PYPI_API_TOKEN, Value: the token from step 1

Local Development

To test the SDK locally without publishing:

# Install in editable mode
pip install -e .

# Override the endpoint for local testing
export VIBEMONITOR_ENDPOINT=http://localhost:8000/api/v1/ingest/logs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vibemonitor-0.2.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vibemonitor-0.2.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file vibemonitor-0.2.0.tar.gz.

File metadata

  • Download URL: vibemonitor-0.2.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for vibemonitor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0779f69162ebc4e3a5e0150973a216b1f7c5c6c58e981cc32822dcce4edf8bad
MD5 a226e824eb4dd7f98f353bae97393b66
BLAKE2b-256 b96b3574d2832127ebb6829cfcd45a9350f0dddb404c44159be4f1e03d6fb8cb

See more details on using hashes here.

File details

Details for the file vibemonitor-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: vibemonitor-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for vibemonitor-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d2dddc5197a1b3716fc1af0d2703ea7c1f1dc24acee3576837f8140c179e1bf
MD5 04b8e508e44cf35a0b9307d85381d254
BLAKE2b-256 e102a7fe4d7dc0c65cd629e5818c7e70b0cebf22edbbecb41055993d52a801f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page