Skip to content

Add Support for Multiple ObjectNames #42

@Mrod1598

Description

@Mrod1598

Is your feature request related to a problem? Please describe.
There is an issue when multiple mbeans are under different object names but are similar enough that they could be given the same metric name and differentiated through labels. This isn't possible currently because when a second call to instrument with the same metric name happens, it overrides the previous call to instrument.

EX:

def beanActiveTasks = otel.mbeans("org.apache.cassandra.metrics:type=ThreadPools,path=*,scope=*,name=PendingTasks")
otel.instrument(beanActiveTasks, "cassandra.current_tasks", "Number of tasks in queue with the given task status.", "1", 
    ["stage_name":{ mbean -> mbean.name().getKeyProperty("scope")},
    "task_status":{"pending"}],
    "Value", otel.&doubleValueObserver)

def beanPendingTasks = otel.mbeans("org.apache.cassandra.metrics:type=ThreadPools,path=*,scope=*,name=ActiveTasks")
otel.instrument(beanPendingTasks, "cassandra.current_tasks", "Number of tasks in queue with the given task status.", "1", 
    ["stage_name":{ mbean -> mbean.name().getKeyProperty("scope")},
    "task_status":{"active"}],
    "Value", otel.&doubleValueObserver)

Here is where there are two different calls to instrument with the same metric name. They end up overriding each other when passed through.

Describe the solution you'd like
A way to make this possible is by adding an additional signature to otel.mbeans( ) that allows multiple object names to be passed in.

EX:

def beanActiveTasks = otel.mbeans(["org.apache.cassandra.metrics:type=ThreadPools,path=*,scope=*,name=PendingTasks",
"org.apache.cassandra.metrics:type=ThreadPools,path=*,scope=*,name=ActiveTasks"])
otel.instrument(beanActiveTasks, "cassandra.current_tasks", "Number of tasks in queue with the given task status.", "1", 
    ["stage_name":{ mbean -> mbean.name().getKeyProperty("scope")},
    "task_status":{ mbean -> mbean.name().getKeyProperty("name")}],
    "Value", otel.&doubleValueObserver)

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