Giter Club home page Giter Club logo

Comments (12)

JacksonWeber avatar JacksonWeber commented on May 27, 2024 2

@prateekkathal @jcbit Thank you for raising this issue. A fix PR has already been merged and will be available in the next release: #1312.

from applicationinsights-node.js.

prateekkathal avatar prateekkathal commented on May 27, 2024 2

@JacksonWeber Thanks, that makes sense. I wish there was a way to just stop the package from emitting out these logs until a "DEBUG" flag was turned on for example.

These extra logs are not useful for many developers directly using this SDK. Maybe something you can add in the release pipeline?

As far as this issue is concerned though, you can mark it as resolved. Have a good one!

from applicationinsights-node.js.

JacksonWeber avatar JacksonWeber commented on May 27, 2024

@jcbit Can I take a look at your package.json file and your code you use to initialize Application Insights?

Also make sure that you're not calling client.track() in your code, only specific track methods (ex: client.trackDependency()) are supported by Application Insights 3.X SDK.

from applicationinsights-node.js.

prateekkathal avatar prateekkathal commented on May 27, 2024

Seeing the same issue when using trackException()

Envelopes could not be exported and are not retriable. Error message: [
   'Error "body.data.baseData.ver cannot be null or undefined." occurred in serializing the payload - "body".'
]

My code is a simple:

try {
 // Running code...
} catch (e) {
  appInsights.defaultClient.trackException({ exception: e, severity: appInsights.KnownSeverityLevel.Error });
}

Even if I manually override - exception: new Error('Test'), I still see the same error.

from applicationinsights-node.js.

prateekkathal avatar prateekkathal commented on May 27, 2024

@JacksonWeber Thank you for the fix. I tested v3.0.1 and it works as expected.

However, I finding these warning logs being emitted as well (also reported in #1316):

@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'
]
Accessing resource attributes before async attributes settled []

My code looks like this:

appInsights
  .setup(connectionString)
  .setAutoCollectRequests(false)
  .setAutoCollectPerformance(false, false)
  .setAutoCollectExceptions(false)
  .setAutoCollectDependencies(false)
  .setAutoCollectConsole(false)
  .setUseDiskRetryCaching(false)
  .setSendLiveMetrics(false)
  .start();

this.client = appInsights.defaultClient;
this.client.setAutoPopulateAzureProperties();

Also, if I don't use the set config functions above after setup, I see even more warnings like these:

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 []

Not sure if this requires a fix? Will be great if you can confirm though. Maybe something I am doing wrong?

from applicationinsights-node.js.

JacksonWeber avatar JacksonWeber commented on May 27, 2024

@prateekkathal To address each of these:

  1. Regarding the warning about @azure/core-tracing being logged. The discussion here goes into detail about how you can ignore it if you wish, and it won't impact functionality for you.
  2. The invalid metric names are the performance counters in Application Insights. OpenTelemetry complains about their metric names as they have spaces, but performance counter functionality is not impacted. The reason removing your config caused these warnings is that you had disabled performance counters in your custom config, but they're configured on by default.

Please let me know if you have any other concerns.

from applicationinsights-node.js.

chriskuech avatar chriskuech commented on May 27, 2024

I'm still facing this issue. I've audited my code for .track and only see these methods used:

  • trackEvent
  • trackException
  • trackTrace
  • trackNodeHttpRequest

And I appear to be using the app insights version with the patch (v3.0.1):
image

I have also modified my config to match #1310 (comment).

Yet I'm still getting the errors below... did I miss anything?

Envelopes could not be exported and are not retriable. Error message: [
  'Error "body.data.baseData.ver cannot be null or undefined." occurred in serializing the payload - "body".'
]
{"stack":"Error: Error \"body.data.baseData.ver cannot be null or undefined.\" occurred in serializing the payload - \"body\".\n    at serializeRequestBody (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-client/src/serializationPolicy.ts:200:13)\n    at Object.sendRequest (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-client/src/serializationPolicy.ts:58:9)\n    at /Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-rest-pipeline/src/pipeline.ts:170:25\n    at HttpPipeline.sendRequest (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-rest-pipeline/src/pipeline.ts:176:12)\n    at ApplicationInsightsClient.sendRequest (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-client/src/serviceClient.ts:125:26)\n    at ApplicationInsightsClient.sendOperationRequest (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/core-client/src/serviceClient.ts:207:38)\n    at ApplicationInsightsClient.track (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:1834:21)\n    at HttpSender.send (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:2800:38)\n    at HttpSender.exportEnvelopes (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:2589:55)\n    at /Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:3864:47\n    at AsyncLocalStorage.run (node:async_hooks:346:14)\n    at AsyncLocalStorageContextManager.with (/Users/kuech/Repositories/monorepo/api/node_modules/@opentelemetry/context-async-hooks/src/AsyncLocalStorageContextManager.ts:40:36)\n    at ContextAPI.with (/Users/kuech/Repositories/monorepo/api/node_modules/@opentelemetry/api/src/api/context.ts:77:42)\n    at AzureMonitorLogExporter.export (/Users/kuech/Repositories/monorepo/api/node_modules/@azure/monitor-opentelemetry-exporter/dist/index.js:3863:31)\n    at /Users/kuech/Repositories/monorepo/api/node_modules/@opentelemetry/core/src/internal/exporter.ts:36:22\n    at AsyncLocalStorage.run (node:async_hooks:346:14)","message":"Error \"body.data.baseData.ver cannot be null or undefined.\" occurred in serializing the payload - \"body\".","name":"Error"} []

from applicationinsights-node.js.

JacksonWeber avatar JacksonWeber commented on May 27, 2024

@chriskuech Please make sure to use version 3.0.1 of the Application Insights SDK as 3.0.0 has an issue with the manual track methods from incorrect serialization of the log body. Let me know if that version works for you.

from applicationinsights-node.js.

chriskuech avatar chriskuech commented on May 27, 2024

@JacksonWeber yes that package.json screenshot is from within my node_modules folder to confirm I'm running v3.0.1.

from applicationinsights-node.js.

JacksonWeber avatar JacksonWeber commented on May 27, 2024

@chriskuech Not seeing any similar errors on my end with trackEvent, trackException or trackTrace. However, trackNodeHttpRequest isn't supported in versions 3.0.0 or higher. Can I take a look at one of your example track methods that's throwing that error for you?

from applicationinsights-node.js.

chriskuech avatar chriskuech commented on May 27, 2024

Interesting. I restarted the upgrade fresh and removed the trackNodeHttpRequest and no longer have an issue. Sorry for the churn--feel free to close.

from applicationinsights-node.js.

JacksonWeber avatar JacksonWeber commented on May 27, 2024

@chriskuech No worries! Always appreciate folks reporting issues, thanks for taking the time to report!

from applicationinsights-node.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.