Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dogstatsd] Add statsd_constant_tags kwarg to datadog.initialize() #494

Merged
merged 4 commits into from
Dec 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions datadog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

def initialize(api_key=None, app_key=None, host_name=None, api_host=None,
statsd_host=None, statsd_port=None, statsd_use_default_route=False,
statsd_socket_path=None, statsd_namespace=None, return_raw_response=False,
hostname_from_config=True, **kwargs):
statsd_socket_path=None, statsd_namespace=None, statsd_constant_tags=None,
return_raw_response=False, hostname_from_config=True, **kwargs):
"""
Initialize and configure Datadog.api and Datadog.statsd modules

Expand Down Expand Up @@ -65,6 +65,9 @@ def initialize(api_key=None, app_key=None, host_name=None, api_host=None,
:param statsd_socket_path: path to the DogStatsd UNIX socket. Supersedes statsd_host
and stats_port if provided.

:param statsd_constant_tags: A list of tags to be applied to all metrics ("tag", "tag:value")
:type statsd_constant_tags: list of string

:param cacert: Path to local certificate file used to verify SSL \
certificates. Can also be set to True (default) to use the systems \
certificate store, or False to skip SSL verification
Expand Down Expand Up @@ -105,6 +108,8 @@ def initialize(api_key=None, app_key=None, host_name=None, api_host=None,
statsd.port = int(statsd_port)
if statsd_namespace:
statsd.namespace = text(statsd_namespace)
if statsd_constant_tags:
statsd.constant_tags += statsd_constant_tags

api._return_raw_response = return_raw_response

Expand Down