Skip to content

Variable name clashing in subscription DSL #23

@surik

Description

@surik

For example this module:

defmodule Mapping do
  use Metricman.Subscription

  @reporter expose: [:exometer_report_influxdb]

  scope [:sessions], @reporter do
    map [:total],       [:sessions, :total]
    map [:access_class, '$access_class'], [:sessions, :access_class '$access_class']
  end
end

Will generate get/2 function which works like:

> Mapping.get [:sessions, :access_class, :online], :counter
{:ok, {[:sessions, :online, :access_class], [:value], [expose: [:exometer_report_influxdb]]}}

but it is not was expected. The correct result should looks like:

{:ok, {[:sessions, :access_class, :online], [:value], [expose: [:exometer_report_influxdb]]}}

It happens because we have names clashing: :access_class and '$access_class'.
If we rename '$access_class' to '$class' all works correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions