Skip to content

Dynamically nameable metrics  #160

Open
@alfiejfs

Description

@alfiejfs

Feature Request

I would like a way for metrics to be nameable at runtime.

Motivation

With the current API, I don't believe you can pass in a metric name which is determined at runtime. This is fully within the realm of possibility when using the OpenTelemtry API, so it would be reasonable for this crate to support that somehow.

Proposal

I assume the most reasonable way might be a reserved field name for the metric name and metric value. However, I am not sure how this would interact with the existing interface.

Below is something like what I just described, but if there is any better way I'd prefer that. I just don't know how much flexibility or control we have here as we are using the tracing macros.

info!(metric.name = format!("histogram.{my_string}"), metric.value = 5)

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