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

add support for max_traces_per_second option to datadog.conf #291

Merged
merged 4 commits into from
Mar 15, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Some configuration parameters can be changed with environment variables:

* `DD_COLLECT_LABELS_AS_TAGS` Enables the collection of the listed labels as tags. Comma separated string, without spaces unless in quotes. Exemple: `-e DD_COLLECT_LABELS_AS_TAGS='com.docker.label.foo, com.docker.label.bar'` or `-e DD_COLLECT_LABELS_AS_TAGS=com.docker.label.foo,com.docker.label.bar`.

* `MAX_TRACES_PER_SECOND`: Specifies the maximum number of traces per second to sample for APM. Set to `0` to disable this limit.

**Note:** Some of those have alternative names, but with the same impact: it is possible to use `DD_TAGS` instead of `TAGS`, `DD_LOG_LEVEL` instead of `LOG_LEVEL` and `DD_API_KEY` instead of `API_KEY`.


Expand Down
4 changes: 4 additions & 0 deletions config_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def build_datadog_conf(self):
self.set_from_env_mapping('SD_BACKEND_PASSWORD', 'sd_backend_password')
# Magic trick to automatically add properties not yet define in the doc
self.set_generics('DD_CONF_')
##### Trace Config #####
self.set_from_env_mapping('MAX_TRACES_PER_SECOND', 'max_traces_per_second', 'trace.sampler')

self.save_config(self.datadog_conf_file)

Expand Down Expand Up @@ -157,6 +159,8 @@ def set_property(self, property_name, property_value, section='Main'):
'''
Sets the given property to the given value in the configuration
'''
if not self.config.has_selection(section):
self.config.add_section(section)
if self.config is None:
logging.error('config object needs to be created before setting properties')
exit(1)
Expand Down