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

Global sample rate #22

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

yaro-m
Copy link

@yaro-m yaro-m commented Mar 30, 2018

Add ability to set the global sample rate

lib/statix.ex Outdated
@@ -335,8 +335,9 @@ defmodule Statix do
@doc false
def transmit(conn, type, key, val, options)
when (is_binary(key) or is_list(key)) and is_list(options) do
sample_rate = Keyword.get(options, :sample_rate)
sample_rate = Keyword.get(options, :sample_rate, Application.get_env(:statix, :sample_rate))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of fetching the value from env each call we should read it once and store in the connection struct.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Let me update PR and see if I'm on right track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants