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

Not possible to set cloud_RoleName #655

Closed
maciejo-nordcloud opened this issue Oct 4, 2021 · 5 comments
Closed

Not possible to set cloud_RoleName #655

maciejo-nordcloud opened this issue Oct 4, 2021 · 5 comments

Comments

@maciejo-nordcloud
Copy link

maciejo-nordcloud commented Oct 4, 2021

Hi,

I tried to set the cloud_RoleName using ITelemetryInitializer but it doesn't work. In App Insights it is still being set as the name of the app service which is hosting it.

public class TelemetryInitializer : ITelemetryInitializer { private static string RoleName = "Modernised.Responses"; public void Initialize(ITelemetry telemetry) { // set custom role name here telemetry.Context.Cloud.RoleName = "Name"; } }

services.AddSingleton<ITelemetryInitializer, TelemetryInitializer>();

Is there any other way to do it?

@ghost ghost assigned fabiocav Oct 4, 2021
@fabiocav
Copy link
Member

This is not exposed to the worker, as the host is in control of this behavior.

@maciejo-nordcloud can you please expand on your scenario/requirement?

@brettsam is this something we want to add?

@maciejo-nordcloud
Copy link
Author

@fabiocav the requirement is to have human-friendly names on Application Map (like in this article)

After downgrading the function to netcoreapp3.1 it works as expected

@fabiocav fabiocav added enhancement New feature or request and removed Needs: Attention 👋 labels Nov 16, 2021
@fabiocav fabiocav added the design label Dec 1, 2021
@fabiocav
Copy link
Member

fabiocav commented Dec 1, 2021

Flagging this for discussion/design.

For clarity, the difference here is not between v3 and v4, but instead, between in-proc and out-of-proc models. One of the potential solutions is to expose a configuration we could use for any of the supported languages, but we need to discuss.

@brettsam
Copy link
Member

I think we'll need to look at OpenTelemetry concepts here and see if there's a more general, non-AppInsights, solution. I don't really want to expose some ApplicationInsights-specific setting value only to move onto OpenTelemetry soon.

For now, this value cannot be changed from the host side unless you register your own ITelemetryInitializer in the host via an extension, which isn't a great experience. You'd also have to register one via the worker (if using the new AppInsights worker package: #944 (comment)) in order for the two sets of logs to match.

@jviau
Copy link
Contributor

jviau commented Jun 21, 2023

We will be working on improving observability from the host side. Following OTel semantics, which should cover cloud_RoleName for application insights will be included.

Closing this against that issue: Azure/azure-functions-host#9273

@jviau jviau closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants