Skip to main content

datadog-http-handler

Python logging module allowing you to log directly to Datadog via https. Currently support only for python 3.6+.

Installation

Install python

Install pip

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

Install datadog-http-handler

pip install datadog-http-handler

Usage

The typical usage of this library to output to datadog

from datadog_http_handler import DatadogHttpHandler

logger = DatadogHttpHandler(
    api_key=os.getenv('DATADOG_API_KEY', ''),
    service='test',
    host='your_hostname',
    logger_name='example',
    tags={'env': 'test', 'user': 'Tim the Enchanter'}
).logger

logger.info('Hello World')

Since sending logs to datadog via http can issue in a request failure for a myriad of reasons, it would be good to know if the failure accord. By setting raise_failure=True when creating the DatadogHttpHandler object, an exception will now be thrown if the status code of the response is not 200. See below:

import traceback

from datadog_http_handler import DatadogHttpHandler

logger = DatadogHttpHandler(
    api_key=os.getenv('DATADOG_API_KEY', ''),
    raise_exception=True,
    service='test',
    host='your_hostname',
    logger_name='example',
    tags={'env': 'test', 'user': 'Tim the Enchanter'}
).logger

try:
    logger.info('Hello World')
exceptException as e:
    print(traceback.format_exc())

LICENSE

MIT

AUTHORS

  • NRCCUA Software Engineers

See also the list of contributors who participated in this project.

ACKNOWLEDGEMENTS

  • Bryan Cusatis - NRCCUA Architecture Team Lead

  • Tim Reichard - NRCCUA Architecture Team Member

  • Grant Evans - NRCCUA DevOps Engineering Lead

Metadata

Release files for datadog-http-handler 1.0.7

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

Source distribution (sdist)

Source distribution for datadog-http-handler 1.0.7
File Size Uploaded Provenance Actions
datadog-http-handler-1.0.7.tar.gz 3.1 kB Without provenance Details for datadog-http-handler-1.0.7.tar.gz

Release files / datadog-http-handler-1.0.7.tar.gz

Download URL datadog-http-handler-1.0.7.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
39ed73386572e2caa081c454e023cc0507224f3fe4df2092bd6f80302a660a07
BLAKE2b-256 checksum
How to use checksums
a7b11c01c66ac286838a7219ac202be227983826ff4235db907ef0e919142f50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for datadog-http-handler 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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