Skip to content

[Question] No env and prod converges to the same value. Invitation to human error?  #25

Description

@linearregression

When people (or mistake in the script) forget to put value for env, it will output the same
value as if "prod" has been put in. It looks like it hides a mistake, and makes is a hard to find error.

Suggest to make env a required settings, not optional, during init for least surprises.

File: elixometer/lib/elixometer.ex

def name_to_exometer(metric_type, name) when is_bitstring(name) do
    config = Application.get_all_env(:elixometer)
    prefix = config[:metric_prefix] || "elixometer"
    base_name = case config[:env] do
                  nil -> "#{prefix}.#{metric_type}.#{name}"    <<<<<<<<<<<<<<<<<<<<<<<
                  :prod -> "#{prefix}.#{metric_type}.#{name}"   <<<<<<<<<<<<<<<<<<<<<<
                  env -> "#{prefix}.#{env}.#{metric_type}.#{name}"
                end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions