Skip to content
This repository has been archived by the owner on Jul 5, 2020. It is now read-only.

Support reading metadata when collecting EventCounter data #1287

Closed
Expecho opened this issue Oct 7, 2019 · 2 comments
Closed

Support reading metadata when collecting EventCounter data #1287

Expecho opened this issue Oct 7, 2019 · 2 comments

Comments

@Expecho
Copy link
Contributor

Expecho commented Oct 7, 2019

Regarding the (new) Microsoft.ApplicationInsights.EventCounterCollector:

When I define a custom EventCounter I can add metadata to it:

methodDurationCounter = new EventCounter(nameof(methodDurationCounter), this);
methodDurationCounter.AddMetadata("Environment", "Production");
methodDurationCounter.AddMetadata("Customer", "Ibis");

This metadata is added to the payload. I would be very happy when this data is included as custom properties of the MetricTelemetry that is send. See the source.

I would be more than willing to provide a PR for this.

@cijothomas
Copy link
Contributor

AddMetadata is available only in .NET Core 3.0 right? But it shouldn't affect listener.

Yes we are happy to accept a PR to make this enhancement.

@Expecho
Copy link
Contributor Author

Expecho commented Oct 7, 2019

AddMetadata is available only in .NET Core 3.0 right? But it shouldn't affect listener.
Yes we are happy to accept a PR to make this enhancement.

Yes, .Net Core 3 only. But we can check for payload availability so we can make it backwards compatible.

I'll probably start working on it in the next few days.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants