microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
321 stars 138 forks source link

Invalid metric name: The metric name should be a ASCII string with a length no greater than 255 characters. #1315

Closed JCBauza closed 2 months ago

JCBauza commented 2 months ago

I get the following error message:

Invalid metric name: "Global Pongs (snapshot)". The metric name should be a ASCII string with a length no greater than 255 characters. []

However, I believe the string contains only ASCII characters. Tried removing the () and still the same:

Invalid metric name: "Global Pongs Snapshot". The metric name should be a ASCII string with a length no greater than 255 characters. []

This happens when I track a Metric with the following code: appInsights.defaultClient.insightsClient().trackMetric({ name: "Global Pongs Snapshot", value: snapshot.length });

Any ideas what could be the issue?

JacksonWeber commented 2 months ago

@JCBauza You should be able to resolve this issue by removing any spaces in your metric name. Possibly something like "Global_Pongs_Snapshot". Please let me know if that change works for you. Thanks!

JCBauza commented 2 months ago

Thanks, it worked!