Skip to content

Confusing documentation for telemetry #167

Open
@hazardfn

Description

@hazardfn

With the latest nebulex version the telemetry setup/integration changed quite a lot and broke a few of our dashboards (this is fine, that one's on us for updating), I have finally gotten around to updating our code to match the new telemetry layout! This task took longer than I thought it would because the initial examples in the documentation didn't work in our use case.

The documentation implies that the prefix, no matter what adapter being used, is the same:

  defp metrics do
    [
      # Nebulex Stats Metrics
      last_value("my_app.cache.stats.hits", tags: [:cache]),
      last_value("my_app.cache.stats.misses", tags: [:cache]),
      last_value("my_app.cache.stats.writes", tags: [:cache]),
      last_value("my_app.cache.stats.updates", tags: [:cache]),
      last_value("my_app.cache.stats.evictions", tags: [:cache]),
      last_value("my_app.cache.stats.expirations", tags: [:cache])
    ]
  end

When using the replicated cache this prefix appears to be incorrect, eventually after digging through the internals I found out how to extract the default prefix for that particular adapter:

name = YYY.ReplicatedCache.get_dynamic_cache()

Nebulex.Adapter.with_meta(name, fn _adapter, meta -> meta end)

%{
  cache: YYY.ReplicatedCache,
  name: YYY.ReplicatedCache,
  pid: #PID<0.913.0>,
  primary_name: nil,
  stats: true,
  task_sup: nil,
  telemetry: true,
  telemetry_prefix: [:yyy, :replicated_cache] # <- HERE
}

Changing the format then to "my_app.replicated_cache.stats.expirations" as an example yielded the expected results. I feel it should be made more obvious in the documentation that the "cache" prefix is not static by default and changes by adapter.

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