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

Azure Monitor Exporter - Update codegen #14895

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ internal async ValueTask<int> AddBatchActivityAsync(Batch<Activity> batchActivit
return 0;
}

List<TelemetryEnvelope> telemetryItems = new List<TelemetryEnvelope>();
TelemetryEnvelope telemetryItem;
List<TelemetryItem> telemetryItems = new List<TelemetryItem>();
TelemetryItem telemetryItem;

foreach (var activity in batchActivity)
{
telemetryItem = GeneratePartAEnvelope(activity);
telemetryItem.IKey = this.instrumentationKey;
telemetryItem.InstrumentationKey = this.instrumentationKey;
telemetryItem.Data = GenerateTelemetryData(activity);
telemetryItems.Add(telemetryItem);
}
Expand All @@ -79,24 +79,23 @@ internal async ValueTask<int> AddBatchActivityAsync(Batch<Activity> batchActivit
return response.Value.ItemsAccepted.GetValueOrDefault();
}

private static TelemetryEnvelope GeneratePartAEnvelope(Activity activity)
private static TelemetryItem GeneratePartAEnvelope(Activity activity)
{
// TODO: Get TelemetryEnvelope name changed in swagger
TelemetryEnvelope envelope = new TelemetryEnvelope(PartA_Name_Mapping[activity.GetTelemetryType()], activity.StartTimeUtc);
rajkumar-rangaraj marked this conversation as resolved.
Show resolved Hide resolved
TelemetryItem telemetryItem = new TelemetryItem(PartA_Name_Mapping[activity.GetTelemetryType()], activity.StartTimeUtc);
// TODO: Validate if Azure SDK has common function to generate role instance
envelope.Tags[ContextTagKeys.AiCloudRoleInstance.ToString()] = "testRoleInstance";
telemetryItem.Tags[ContextTagKeys.AiCloudRoleInstance.ToString()] = "testRoleInstance";

envelope.Tags[ContextTagKeys.AiOperationId.ToString()] = activity.TraceId.ToHexString();
telemetryItem.Tags[ContextTagKeys.AiOperationId.ToString()] = activity.TraceId.ToHexString();
if (activity.Parent != null)
{
envelope.Tags[ContextTagKeys.AiOperationParentId.ToString()] = activity.Parent.SpanId.ToHexString();
telemetryItem.Tags[ContextTagKeys.AiOperationParentId.ToString()] = activity.Parent.SpanId.ToHexString();
}

// TODO: "ai.location.ip"
// TODO: Handle exception
envelope.Tags[ContextTagKeys.AiInternalSdkVersion.ToString()] = SdkVersionUtils.SdkVersion;
telemetryItem.Tags[ContextTagKeys.AiInternalSdkVersion.ToString()] = SdkVersionUtils.SdkVersion;

return envelope;
return telemetryItem;
}

private MonitorBase GenerateTelemetryData(Activity activity)
Expand All @@ -123,7 +122,7 @@ private MonitorBase GenerateTelemetryData(Activity activity)
}
else if (telemetryType == TelemetryType.Dependency)
{
var dependency = new RemoteDependencyData(2, activity.DisplayName, activity.Duration)
var dependency = new RemoteDependencyData(2, activity.DisplayName, activity.Duration.ToString("c", CultureInfo.InvariantCulture))
{
Id = activity.Context.SpanId.ToHexString(),
Success = activity.GetStatus().IsOk
Expand Down
16 changes: 0 additions & 16 deletions sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Base.cs

This file was deleted.

16 changes: 0 additions & 16 deletions sdk/monitor/OpenTelemetry.Exporter.AzureMonitor/src/Domain.cs

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading