Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customMetrics problems #1323

Open
skhilliard opened this issue May 3, 2024 · 3 comments
Open

customMetrics problems #1323

skhilliard opened this issue May 3, 2024 · 3 comments

Comments

@skhilliard
Copy link

When upgrading from 2.x to 3.0.1, we are seeing a lot of warnings like this...

  • Invalid metric name: "\ASP.NET Applications(??APP_W3SVC_PROC??)\Request Execution Time". The metric name should be a ASCII string with a length no greater than 255 characters. []
  • Invalid metric name: "\ASP.NET Applications(??APP_W3SVC_PROC??)\Requests/Sec". The metric name should be a ASCII string with a length no greater than 255 characters. []
  • Invalid metric name: "\Process(??APP_WIN32_PROC??)\Private Bytes". The metric name should be a ASCII string with a length no greater than 255 characters. []
  • Invalid metric name: "\Memory\Available Bytes". The metric name should be a ASCII string with a length no greater than 255 characters. []
  • Invalid metric name: "\Processor(_Total)\% Processor Time". The metric name should be a ASCII string with a length no greater than 255 characters. []
  • Invalid metric name: "\Process(??APP_WIN32_PROC??)\% Processor Time". The metric name should be a ASCII string with a length no greater than 255 characters. []
  • Invalid metric name: "Redis Health Check". The metric name should be a ASCII string with a length no greater than 255 characters. []

The first 6 of these aren't generated by any metrics we are doing, which is odd. The last one is one that we are using. It seems like the code doesn't like the fact that we have spaces in the metric name, which was allowed before. I do still see these appearing in metrics though, so it seems like a false warning.

Also, it looks like different instances of these sometimes get aggregated with 3.x, which isn't good for metrics...for example:

image

vs. 2.x

image

@JacksonWeber
Copy link
Contributor

@skhilliard Those first 6 warnings are performance counters. You can disable them via configuration options in Application Insights if you don't need them and want to remove the warnings. A fix will be applied to the Azure Monitor Exporter that will remove these warnings.

Your last metric "Redis Health Check" is invalid because of added spaces. This is another effect of moving to OpenTelemetry under the hood in 3.X and something I believe is worth updating in the migration guide. Thank you for your input there!

If you want fine grain control of how metrics are collected, I'd suggest following the migration guide above and moving to the Azure Monitor OpenTelemetry. Application Insights version 3.X is intended to be an easy upgrade path for those who have basic instrumentations with 2.X, while if you want more control and the advantages of OpenTelemetry, it's best to take advantage of the Azure Monitor OpenTelemetry.

@skhilliard
Copy link
Author

@JacksonWeber Did you see my question regarding the metrics being "merged" into one value? E.g. instead of 4 Redis Health Check items with value of one, they are combined into one with a value of 4?

@JacksonWeber
Copy link
Contributor

@skhilliard Apologies for the missed answer there. Regarding the aggregated metric, you have two options with the 3.X SDK.

  1. You could change to using a custom event here if you just need to record that the health check was reported at a timestamp. This will save money on reporting fields you don't appear to use like valueMin, valueMax, etc.

  2. If you're using the metrics reported values or just need this health check to be reported in the custom metrics table, you could use the Azure Monitor OpenTelemetry package and apply an Observable Gauge to capture these custom metrics instead of this package.

Please let me know if you have questions about either of these approaches. Thanks!

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

No branches or pull requests

2 participants