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

Duplicate/Invalid metric errors when starting useAzureMonitor #1218

Open
pedro37 opened this issue Sep 27, 2023 · 7 comments
Open

Duplicate/Invalid metric errors when starting useAzureMonitor #1218

pedro37 opened this issue Sep 27, 2023 · 7 comments

Comments

@pedro37
Copy link

pedro37 commented Sep 27, 2023

I add config as per README and get duplicate errors in the config am I missing something?

import { useAzureMonitor } from 'applicationinsights';
const config= {
      azureMonitorExporterOptions: {
        connectionString: myConnectionString,
      },
      samplingRatio: 1,
      enableAutoCollectExceptions: true,
      enableAutoCollectStandardMetrics: true,
      enableAutoCollectPerformance: true,
      instrumentationOptions: {
        azureSdk: { enabled: true },
        http: { enabled: true },
        redis: { enabled: true }
      },
      logInstrumentationOptions: {
        bunyan: { enabled: true},
        winston: { enabled: true},
      },
      extendedMetrics: {
        gc: true,
        heap: true,
        loop: true
      }
    };
    useAzureMonitor(config);`


ApplicationInsights:Invalid metric name: "Request Duration". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "\Memory\Available Bytes". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Throttle Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Request Failure Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Exception Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights: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. []
ApplicationInsights:Invalid metric name: "Request Success Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Retry Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Throttle Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights: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. []
'Module @azure/core-tracing has been loaded before @azure/opentelemetry-instrumentation-azure-sdk so it might not work, please initialize it before requiring @azure/core-tracing'
ApplicationInsights:Invalid metric name: "Request Failure Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Exception Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Throttle Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights: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. []
'Module @azure/core-tracing has been loaded before @azure/opentelemetry-instrumentation-azure-sdk so it might not work, please initialize it before requiring @azure/core-tracing'
ApplicationInsights:Invalid metric name: "Request Failure Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Exception Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Throttle Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Request Duration". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "\Processor(_Total)\% Processor Time". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights: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. []
ApplicationInsights:Invalid metric name: "Request Success Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Request Duration". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Retry Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Request Success Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Request Failure Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Exception Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Retry Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Throttle Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Throttle Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Retry Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Request Duration". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Request Success Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Exception Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Exception Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Request Duration". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights: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. []
ApplicationInsights:Invalid metric name: "Request Success Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Request Failure Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:@azure/opentelemetry-instrumentation-azure-sdk [
ApplicationInsights:Invalid metric name: "Request Failure Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
ApplicationInsights:Invalid metric name: "Retry Count". The metric name should be a ASCII string with a length no greater than 255 characters. []
@hectorhdzg
Copy link
Member

We are aware of this warnings, but these should not cause any change of behavior in the SDK, we fixed that in Azure Monitor OpenTelemetry Exporter recently and should be published soon.

Related to
Azure/azure-sdk-for-js#27179

Other issue related to Azure Instrumentation is also not causing problems but we are working on trying to avoid the unnecessary noise.
Related to
#1107

@pedro37
Copy link
Author

pedro37 commented Sep 27, 2023

Thanks, I have another issue I have set a startActiveSpan but it is not showing in the appinsights metrics.

@hectorhdzg
Copy link
Member

@pedro37 can you elaborate on your issue? what kind of metrics are you expecting to see?

@pedro37
Copy link
Author

pedro37 commented Sep 27, 2023

Yes, I have essentially the following code snippet and I am expecting span-name to appear in the application insights metric dropdown, using the config above

startActiveSpan('span-name', (span) => {
  doSomething();
  span.end();
});

@ericis
Copy link

ericis commented Jan 3, 2024

We are aware of this warnings, but these should not cause any change of behavior in the SDK, we fixed that in Azure Monitor OpenTelemetry Exporter recently and should be published soon.

Related to Azure/azure-sdk-for-js#27179

Other issue related to Azure Instrumentation is also not causing problems but we are working on trying to avoid the unnecessary noise. Related to #1107

These are not simply warnings. These output to the terminal when run, so it is not currently possible to use the Azure Monitor OpenTelemetry solution in a CLI, since every execution displays this (incredibly odd) "warning" to the users and the CLI developers do not have the ability to control this behavior: #1107 (comment)

@sebastianvitterso
Copy link

sebastianvitterso commented Apr 30, 2024

@hectorhdzg any update on this? We use applicationinsights for the main-thread of our electron app, but it still outputs eight lines whenever it's started (even in production):

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. []
Accessing resource attributes before async attributes settled []
Accessing resource attributes before async attributes settled []
yarn.lock entry
applicationinsights@^3.0.1:
  version "3.0.1"
  resolved "https://registry.yarnpkg.com/applicationinsights/-/applicationinsights-3.0.1.tgz#3967c804afa5ef590a7f014f9c630cb380f04454"
  integrity sha512-SbvRSveOduzYl1OFfW6zTnK/T8EFG6IqSlZ28orf/YTkLFvFZ9tgIffeY21xSzypYWKITkICyQpi+IiTQEgz0g==
  dependencies:
    "@azure/core-auth" "^1.3.0"
    "@azure/core-client" "^1.0.0"
    "@azure/core-rest-pipeline" "^1.9.2"
    "@azure/identity" "^3.1.3"
    "@azure/monitor-opentelemetry" "^1.4.0"
    "@azure/monitor-opentelemetry-exporter" "^1.0.0-beta.22"
    "@azure/opentelemetry-instrumentation-azure-sdk" "^1.0.0-beta.5"
    "@opentelemetry/api" "^1.8.0"
    "@opentelemetry/api-logs" "^0.50.0"
    "@opentelemetry/core" "^1.23.0"
    "@opentelemetry/exporter-logs-otlp-http" "^0.50.0"
    "@opentelemetry/exporter-metrics-otlp-http" "^0.50.0"
    "@opentelemetry/exporter-trace-otlp-http" "^0.50.0"
    "@opentelemetry/otlp-exporter-base" "^0.50.0"
    "@opentelemetry/resources" "^1.23.0"
    "@opentelemetry/sdk-logs" "^0.50.0"
    "@opentelemetry/sdk-metrics" "^1.23.0"
    "@opentelemetry/sdk-trace-base" "^1.23.0"
    "@opentelemetry/sdk-trace-node" "^1.23.0"
    "@opentelemetry/semantic-conventions" "^1.23.0"
    diagnostic-channel "1.1.1"
    diagnostic-channel-publishers "1.0.8"

@skhilliard
Copy link

I am also getting similar errors on startup....I am following the "upgrade" path...for example....

  • xxx has been loaded before xxx
  • Invalid metric name xxx
  • Accessing resource attributes before async attributes settled
  • The iKey configuration option is not supported by the shim
@azure/opentelemetry-instrumentation-azure-sdk [
  'Module @azure/core-tracing has been loaded before @azure/opentelemetry-instrumentation-azure-sdk so it might not work, please initialize it before requiring @azure/core-tracing'
]
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. []
Accessing resource attributes before async attributes settled []
The iKey configuration option is not supported by the shim. Please configure the the connection string instead. Please reference the Azure Monitor OpenTelemetry Migration Doc for more information. If this functionality is required, please revert to Application Insights 2.X SDK. []

...additionally, I am not sure why I am getting this error...

The iKey configuration option is not supported by the shim. Please configure the the connection string instead. Please reference the Azure Monitor OpenTelemetry Migration Doc for more information. If this functionality is required, please revert to Application Insights 2.X SDK. []

I am initializing it this way...

import * as appinsights from 'applicationinsights';
if (!!process.env.APPINSIGHTS_INSTRUMENTATIONKEY) {
    appinsights
        .setup(process.env.APPINSIGHTS_INSTRUMENTATIONKEY)
        .setDistributedTracingMode(appinsights.DistributedTracingModes.AI_AND_W3C)
        .start();
    appinsights.defaultClient.config.enableLoggerErrorToTrace = true;
}

The value of process.env.APPINSIGHTS_INSTRUMENTATIONKEY is actually of the form InstrumentationKey=xxxxx

Also one other question (I can create a separate item for this if needed)....am I still allowed to track custom metrics and events thusly?

appinsights.defaultClient.trackMetric({ name: 'Redis Health Check', value: 1 });

appinsights.defaultClient.trackEvent({
	name: UserChallengeEvent.loginAttemptAccountLocked,
	properties: {
		userId: user._id
	}
});

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

5 participants