Current section

Files

Jump to
new_relic_agent lib new_relic sampler reporter.ex
Raw

lib/new_relic/sampler/reporter.ex

defmodule NewRelic.Sampler.Reporter do
@moduledoc false
def report_sample(category, sample) when is_map(sample),
do: NewRelic.report_custom_event(sampler_event_type(), Map.put(sample, :category, category))
def sampler_event_type,
do: Application.get_env(:new_relic_agent, :sample_event_type, "ElixirSample")
def sample_cycle, do: Application.get_env(:new_relic_agent, :sample_cycle, 15_000)
def random_sample_offset, do: :rand.uniform(sample_cycle())
end