microsoft / ApplicationInsights-node.js

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

Roles for Multi-component applications does not work in 3.x #1352

Open bertybot opened 5 days ago

bertybot commented 5 days ago

Hey I have an existing application that was following the docs mentioned here to define a roleName for my node application so that it would show up in the application map. As of version 3.x this no longer works, and my application shows up in the application map as unkown_service:node downgrading to version 2.9.5 fixes this issue and the name shows up correctly. Is there any recommendations to fix this issue?

JacksonWeber commented 2 days ago

Hi @bertybot it would be possible to set these values in version 3.X of the SDK currently, but you'd need to take advantage of OpenTelemetry resource attributes to do so before, which is documented here in the Azure Monitor OpenTelemetry which version 3.X of the Application Insights SDK is built on.

I'd like to add support for setting roleName in the same manner as the 2.X SDK, I can update this thread when that support arrives.

bertybot commented 2 days ago

Hi @bertybot it would be possible to set these values in version 3.X of the SDK currently, but you'd need to take advantage of OpenTelemetry resource attributes to do so before, which is documented here in the Azure Monitor OpenTelemetry which version 3.X of the Application Insights SDK is built on.

I'd like to add support for setting roleName in the same manner as the 2.X SDK, I can update this thread when that support arrives.

Do you have an example using this library? The Telemetry client only takes in a string with no way to send resources. I could just use AzureMonitor directly but, then I would have no reason to use this package. Really documentation on best practices of using this package would be much appreciated.

JacksonWeber commented 1 day ago

@bertybot Apologies, the above is intended as a workaround using another package if you're in need of this functionality immediately and wanted to use the latest package. If you can wait for support on this package and don't want to move over to the Azure Monitor OpenTelemetry distro, then that's the advised path.