-
Notifications
You must be signed in to change notification settings - Fork 4.9k
[FEATURE REQ] Unable to override specific field in Application Insights schema #46021
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
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cijothomas @rajkumar-rangaraj @reyang @TimothyMothra. |
For some of the linked issues, there are multiple changes needed.
For example, the AI session ID and user ID issue includes both. |
That's fair, I'll update my summary above so we don't lose sight of this. |
+1 for this ability. Unfortunately, there is currently no way to set the synthetic source property of Application Insights ( |
It would be great to be able to specify |
This is a blocker for migrating from App Insights where custom properties are set e.g. DeviceType, custom OS information etc. This could be accomplished by an additional tags processor which extracts a known series of tags from Resource and items (Activity, Metric, Log). These tags would be those tags that are not extracted from anywhere else. /// <summary>
/// Processor that handles known resource attributes (mapped to <see cref="ContextTagKeys"/>).
/// </summary>
internal static class KnownResourceAttributesProcessor
{
/// <summary>
/// A map of attributes to their corresponding <see cref="ContextTagKeys"/> and maximum length.
/// </summary>
public static readonly Dictionary<string, (ContextTagKeys Key, int MaxLength)> Attributes = new()
{
// device.* attributes
{
SemanticConventions.AttributeDeviceType,
(ContextTagKeys.AiDeviceType, SchemaConstants.Tags_AiDeviceType_MaxLength)
},
{
SemanticConventions.AttributeDeviceId,
(ContextTagKeys.AiDeviceId, SchemaConstants.Tags_AiDeviceId_MaxLength)
},
{
SemanticConventions.AttributeDeviceManufacturer,
(ContextTagKeys.AiDeviceOemName, SchemaConstants.Tags_AiDeviceOemName_MaxLength)
},
{
SemanticConventions.AttributeDeviceModelId,
(ContextTagKeys.AiDeviceModel, SchemaConstants.Tags_AiDeviceModel_MaxLength)
},
// browser.* attributes
{
SemanticConventions.AttributeBrowserLanguage,
(ContextTagKeys.AiDeviceLocale, SchemaConstants.Tags_AiDeviceLocale_MaxLength)
},
// os.* attributes
{
SemanticConventions.AttributeOsDescription,
(ContextTagKeys.AiDeviceOsVersion, SchemaConstants.Tags_AiDeviceOsVersion_MaxLength)
},
};
} These attributes could then be added to the resource: ResourceBuilder.CreateDefault().AddAttributes([
new KeyValuePair<string, object>("device.type", "Phone"),
new KeyValuePair<string, object>("device.model.identifier", "SM-G920F"),
]); |
Actually, we need the ability to override specific fields through middleware. The code given above needs to be set once for the resource, but the session ID and user ID need to be set on a per-request basis. Currently, in middleware, all new tags (using activity.settag) move those properties to custom dimensions. |
@PraveenVerma17 - See my comment here - it works if you're willing to put in the work. You can add either an /// <summary>
/// Adds tags to activity that are stored in request baggage.
/// </summary>
/// <remarks>
/// The objective here is to duplicate key tags in all downstream activities, eg
/// app insights session.id and user.id are useful in the whole downstream tree.
/// </remarks>
internal sealed class AddRequestBaggageActivityProcessor : BaseProcessor<Activity>
{
public override void OnStart(Activity activity)
{
AddTagsFromBaggage(activity);
}
internal static bool CreateTagFromBaggage(string key)
{
return key.StartsWith("ai.")
|| key.StartsWith("user.");
}
internal static void AddTagsFromBaggage(Activity activity)
{
if (activity.IsAllDataRequested)
{
foreach (var kvp in Baggage.GetBaggage())
{
if (CreateTagFromBaggage(kvp.Key))
{
activity.SetTag(kvp.Key, kvp.Value);
}
}
}
}
} Then you have to set the values you want in Baggage (using request middleware), and the trickiest part is you need to set the |
@johncrim We have numerous dashboards built using the existing standard columns, so changing them all would require significant effort. I'm looking for a solution that maintains backward compatibility before we transition fully to Azure Monitor with OpenTelemetry. |
I'm opening this issue to track and consolidate all other reported instances of this problem.
Currently, the Azure Monitor Exporter does not offer any mechanism to override every attribute in the Application Insights schema. While several attributes are mapped today, several others are not. My team is investigating how to better document this and how to close this feature gap.
This affects users manually creating telemetry and users wishing to override attributes created by an Instrumentation library.
Affected Libraries
Reported Issues
[FEATURE REQ] Support for extending app insights Dependency.Type values #45112
Override Dependency.Type because unsupported dependencies show as "OTHER" and displays in UX. (E2E transactions)
[FEATURE REQ] Set, or support setting, App Insights session ID and user ID via otel exporter #45089
[BUG] Azure.Monitor.OpenTelemetry.AspNetCore Anonymouse user ID and Session ID not stored as expected. #49412
Set sessionId and userId
Can these values be set automatically, consistent with classic AI SDK?
[BUG] OpenTelemetryExporter prevents setting the span name for Request telemetry #44971
Override span name for Request telemetry.
[FEATURE REQ] How to set UserAccountId in AppInsights with Azure.Monitor.OpenTelemetry.Exporter #44837
Set user AccountId
[FEATURE REQ] Controlling the "type" name of an OTEL activity in Application Insights #44762
Overriding Dependency.Type currently shows as "InProc" or "HTTP". Wants to set name of api (ie: AcmeApi)
[FEATURE REQ] Open Telemetry Sample Request #44587
Set operationName
[BUG] The operation_Name field is not getting populated property. #41946 (comment)
Override operationName
[FEATURE REQ] How to set Application Insights Metrics Namespace in AzureMonitorOpenTelemetryExporter #38270
Set Metrics Namespace
[FEATURE REQ] Support Activity.StatusDescription in Exporter #41057
Support for Activity.StatusDescription
[FEATURE REQ] Unable to override specific field in Application Insights schema #46021 (comment)
Set ai.operation.syntheticSource
[FEATURE REQ] Unable to override specific field in Application Insights schema #46021 (comment)
Set ai.device.id, ai.device.type
The text was updated successfully, but these errors were encountered: