{"library":"statshog","title":"statshog","type":"library","description":"statshog is a simple Python client for emitting metrics to StatsD servers, including both Etsy's original StatsD and InfluxDB's Telegraf StatsD server. It provides functionalities for incrementing counters, recording gauges, and tracking timings. The library is currently at version 1.0.6, with a stable but infrequent release cadence, reflecting its mature and focused functionality.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install statshog"],"cli":null},"imports":["from statshog import StatsClient","from statshog.defaults.django import statsd"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/macobo/statshog","docs":null,"changelog":null,"pypi":"https://pypi.org/project/statshog/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import statshog\nimport time\n\n# Initialize a StatsD client (defaults to localhost:8125)\n# For Telegraf's StatsD with tags, use telegraf=True\nstatsd = statshog.StatsClient(host='127.0.0.1', port=8125, telegraf=True)\n\n# Increment a counter\nstatsd.incr('my_app.requests_total')\nstatsd.incr('my_app.errors', tags={'type': 'database_error'})\n\n# Record a gauge value\nstatsd.gauge('my_app.cpu_usage', 55)\nstatsd.gauge('my_app.memory_percent', 72.5, tags={'host': 'server_a'})\n\n# Record a timing\nstart_time = time.time()\ntime.sleep(0.05) # Simulate some work\nend_time = time.time()\nduration_ms = (end_time - start_time) * 1000\nstatsd.timing('my_app.api_response_time', duration_ms, tags={'endpoint': '/api/data'})\n\nprint('Metrics sent to StatsD.')\n# In a real application, ensure your StatsD server (e.g., Telegraf) is running on 127.0.0.1:8125\n# and listening for UDP packets.","lang":"python","description":"This quickstart demonstrates how to initialize the `StatsClient` and send common metric types: increments, gauges, and timings. It also shows how to use tags when `telegraf=True` is enabled.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"1.0.6","pypi_latest":"1.0.6","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.7,"avg_import_s":0.02,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.4,"disk_size":"17.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.02,"mem_mb":1.4,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.04,"mem_mb":1.6,"disk_size":"19.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.9,"import_time_s":0.03,"mem_mb":1.6,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.03,"mem_mb":1.1,"disk_size":"11.7M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.03,"mem_mb":1.1,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.1,"disk_size":"11.4M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.02,"mem_mb":0.9,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.02,"mem_mb":1.3,"disk_size":"17.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"statshog","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.9,"import_time_s":0.02,"mem_mb":1.3,"disk_size":"18M"}]}}