census-instrumentation / opencensus-python

A stats collection and distributed tracing framework
Apache License 2.0
669 stars 250 forks source link

Multiple measure for one view in azure #1174

Closed mpostument closed 1 year ago

mpostument commented 1 year ago

Before opening a feature request against this repo, consider whether the feature should/could be implemented in the other OpenCensus client libraries. If so, please open an issue on opencensus-specs first.

Is your feature request related to a problem? I need to publish metrics to azure under the same namespace but with different tags.

My view definition:

my_measure = measure_module.MeasureInt("Monitor", "metrics", "health")
my_view = view_module.View(
    "Services",
    "services metrics",
    ["service", "name", "node", "metric_name"],
    my_measure,
    aggregation_module.LastValueAggregation(),
)

And then in loop i am trying to publish metrics

    mmap = stats_recorder.new_measurement_map()
    tmap = tag_map_module.TagMap()
    tmap.insert("service", dimension_service)
    tmap.insert("name", dimension_name)
    tmap.insert("node", dimension_node)
    tmap.insert("metric_name", metric_name)

    mmap.measure_int_put(avmon_measure, int(dimension_healthy))
    mmap.record(tmap)

    metrics = list(mmap.measure_to_view_map.get_metrics(datetime.utcnow()))
    print(metrics[0].time_series[0])

But what i see it just one metric with the same labels

TimeSeries([ValueLong(1)], label_values=('rabbit', 'TestRabbitmqExchangesAndBindings', 'IP', 'dQueue'), start_timestamp=None)

Describe the solution you'd like. Append metrics to view which will be uploaded under one namespace to azure but can be filtered out using labels

Describe alternatives you've considered. Which alternative solutions or features have you considered?

Additional context. Add any other context about the feature request here.

lzchen commented 1 year ago

@mpostument

I'm not sure how this feature is specific to azure? What do you mean by uploaded under one namespace to azure?

mpostument commented 1 year ago

I found the way how to do it. This issue can be closed