From 08b134fc238e6453c1b5e946202797b59b262df4 Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Thu, 26 Sep 2024 16:50:47 -0400 Subject: [PATCH 01/15] Create skeleton for EventBridge instrumentation --- .../PackageVersionsGeneratorDefinitions.json | 18 +++++++++ .../_build/Honeypot/IntegrationGroups.cs | 1 + .../EventBridge/PutEventsAsyncIntegration.cs | 40 +++++++++++++++++++ .../AWS/EventBridge/PutEventsIntegration.cs | 39 ++++++++++++++++++ .../Configuration/IntegrationId.cs | 1 + .../Metrics/IntegrationIdExtensions.cs | 1 + .../Telemetry/Metrics/MetricTags.cs | 1 + 7 files changed, 101 insertions(+) create mode 100644 tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs create mode 100644 tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs diff --git a/tracer/build/PackageVersionsGeneratorDefinitions.json b/tracer/build/PackageVersionsGeneratorDefinitions.json index f09d9807bd24..7237e1b753de 100644 --- a/tracer/build/PackageVersionsGeneratorDefinitions.json +++ b/tracer/build/PackageVersionsGeneratorDefinitions.json @@ -79,6 +79,24 @@ } ] }, + { + "IntegrationName": "AwsEventBridge", + "SampleProjectName": "Samples.AWS.EventBridge", + "NugetPackageSearchName": "AWSSDK.EventBridge", + "MinVersion": "3.3.100", + "MaxVersionExclusive": "3.8.0", + "SpecificVersions": [ + "3.3.*", + "3.5.*", + "3.7.*" + ], + "VersionConditions": [ + { + "MaxVersionExclusive": "3.3.0", + "IncludeOnlyTargetFrameworks": ["net462"] + } + ] + }, { "IntegrationName": "MongoDB", "SampleProjectName": "Samples.MongoDB", diff --git a/tracer/build/_build/Honeypot/IntegrationGroups.cs b/tracer/build/_build/Honeypot/IntegrationGroups.cs index a91e1c683b46..b763811a0684 100644 --- a/tracer/build/_build/Honeypot/IntegrationGroups.cs +++ b/tracer/build/_build/Honeypot/IntegrationGroups.cs @@ -42,6 +42,7 @@ static IntegrationMap() NugetPackages.Add("AWSSDK.Kinesis", new [] { "AWSSDK.Kinesis" }); NugetPackages.Add("AWSSDK.SQS", new [] { "AWSSDK.SQS" }); NugetPackages.Add("AWSSDK.SimpleNotificationService", new [] { "AWSSDK.SimpleNotificationService" }); + NugetPackages.Add("AWSSDK.EventBridge", new [] { "AWSSDK.EventBridge" }); NugetPackages.Add("Microsoft.Azure.Cosmos.Client", new [] { "Microsoft.Azure.Cosmos" }); NugetPackages.Add("Elasticsearch.Net", new [] { "Elasticsearch.Net" }); NugetPackages.Add("GraphQL", new [] { "GraphQL" }); diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs new file mode 100644 index 000000000000..e0bc335dfaf4 --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs @@ -0,0 +1,40 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +#nullable enable + +using System; +using System.ComponentModel; +using System.Threading; +using Datadog.Trace.ClrProfiler.CallTarget; +using Datadog.Trace.Configuration; + +namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge; + +/// +/// AWSSDK.EventBridge PutEventsAsync CallTarget instrumentation +/// +[InstrumentMethod( + AssemblyName = "AWSSDK.EventBridge", + TypeName = "Amazon.EventBridge.AmazonEventBridgeClient", + MethodName = "PutEventsAsync", + ReturnTypeName = "System.Threading.Tasks.Task`1[Amazon.EventBridge.Model.PutEventsResponse]", + ParameterTypeNames = ["Amazon.EventBridge.Model.PutEventsRequest", ClrNames.CancellationToken], + MinimumVersion = "3.3.0", + MaximumVersion = "3.*.*", + IntegrationName = nameof(IntegrationId.AwsEventBridge))] +[Browsable(false)] +[EditorBrowsable(EditorBrowsableState.Never)] +public class PutEventsAsyncIntegration +{ + internal static CallTargetState OnMethodBegin(TTarget instance, ref TRequest? request, ref CancellationToken cancellationToken) + { + return CallTargetState.GetDefault(); + } + + internal static TReturn? OnAsyncMethodEnd(TTarget instance, TReturn? returnValue, Exception exception, in CallTargetState state) + { + return returnValue; + } +} diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs new file mode 100644 index 000000000000..838c4a454c3e --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs @@ -0,0 +1,39 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +#nullable enable + +using System; +using System.ComponentModel; +using Datadog.Trace.ClrProfiler.CallTarget; +using Datadog.Trace.Configuration; + +namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge; + +/// +/// AWSSDK.EventBridge PutEvents CallTarget instrumentation +/// +[InstrumentMethod( + AssemblyName = "AWSSDK.EventBridge", + TypeName = "Amazon.EventBridge.AmazonEventBridgeClient", + MethodName = "PutEvents", + ReturnTypeName = "Amazon.EventBridge.Model.PutEventsResponse", + ParameterTypeNames = ["Amazon.EventBridge.Model.PutEventsRequest"], + MinimumVersion = "3.3.0", + MaximumVersion = "3.*.*", + IntegrationName = nameof(IntegrationId.AwsEventBridge))] +[Browsable(false)] +[EditorBrowsable(EditorBrowsableState.Never)] +public class PutEventsIntegration +{ + internal static CallTargetState OnMethodBegin(TTarget instance, ref TRequest? request) + { + return CallTargetState.GetDefault(); + } + + internal static CallTargetReturn OnMethodEnd(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state) + { + return new CallTargetReturn(returnValue); + } +} diff --git a/tracer/src/Datadog.Trace/Configuration/IntegrationId.cs b/tracer/src/Datadog.Trace/Configuration/IntegrationId.cs index d43c3cd73497..bf01a390baaa 100644 --- a/tracer/src/Datadog.Trace/Configuration/IntegrationId.cs +++ b/tracer/src/Datadog.Trace/Configuration/IntegrationId.cs @@ -40,6 +40,7 @@ internal enum IntegrationId AwsSdk, AwsSqs, AwsSns, + AwsEventBridge, AwsLambda, ILogger, Aerospike, diff --git a/tracer/src/Datadog.Trace/Telemetry/Metrics/IntegrationIdExtensions.cs b/tracer/src/Datadog.Trace/Telemetry/Metrics/IntegrationIdExtensions.cs index f418f0294429..4b843dff02b7 100644 --- a/tracer/src/Datadog.Trace/Telemetry/Metrics/IntegrationIdExtensions.cs +++ b/tracer/src/Datadog.Trace/Telemetry/Metrics/IntegrationIdExtensions.cs @@ -41,6 +41,7 @@ public static MetricTags.IntegrationName GetMetricTag(this IntegrationId integra IntegrationId.AwsSdk => MetricTags.IntegrationName.AwsSdk, IntegrationId.AwsSns => MetricTags.IntegrationName.AwsSns, IntegrationId.AwsSqs => MetricTags.IntegrationName.AwsSqs, + IntegrationId.AwsEventBridge => MetricTags.IntegrationName.AwsEventBridge, IntegrationId.AwsLambda => MetricTags.IntegrationName.AwsLambda, IntegrationId.ILogger => MetricTags.IntegrationName.ILogger, IntegrationId.Aerospike => MetricTags.IntegrationName.Aerospike, diff --git a/tracer/src/Datadog.Trace/Telemetry/Metrics/MetricTags.cs b/tracer/src/Datadog.Trace/Telemetry/Metrics/MetricTags.cs index 6d978711cbc0..0089de331d13 100644 --- a/tracer/src/Datadog.Trace/Telemetry/Metrics/MetricTags.cs +++ b/tracer/src/Datadog.Trace/Telemetry/Metrics/MetricTags.cs @@ -214,6 +214,7 @@ internal enum IntegrationName [Description("integration_name:awssdk")]AwsSdk, [Description("integration_name:awssqs")]AwsSqs, [Description("integration_name:awssns")]AwsSns, + [Description("integration_name:awseventbridge")]AwsEventBridge, [Description("integration_name:ilogger")]ILogger, [Description("integration_name:aerospike")]Aerospike, [Description("integration_name:azurefunctions")]AzureFunctions, From 5469c4f4d77dafa57d80d09b6cee79993a77f85f Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Thu, 26 Sep 2024 16:55:07 -0400 Subject: [PATCH 02/15] Inject trace context into EventBridge --- .../AWS/EventBridge/AwsEventBridgeCommon.cs | 85 ++++++++++++++++++ .../AWS/EventBridge/ContextPropagation.cs | 88 +++++++++++++++++++ .../AWS/EventBridge/IPutEventsRequest.cs | 21 +++++ .../AWS/EventBridge/IPutEventsRequestEntry.cs | 23 +++++ .../EventBridge/PutEventsAsyncIntegration.cs | 47 ++++++++-- .../AWS/EventBridge/PutEventsIntegration.cs | 45 ++++++++-- .../Configuration/Schema/MessagingSchema.cs | 6 ++ .../Tagging/AwsEventBridgeTags.cs | 85 ++++++++++++++++++ tracer/src/Datadog.Trace/Tags.cs | 5 ++ 9 files changed, 393 insertions(+), 12 deletions(-) create mode 100644 tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs create mode 100644 tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs create mode 100644 tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequest.cs create mode 100644 tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequestEntry.cs create mode 100644 tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs new file mode 100644 index 000000000000..1f72575d41ae --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs @@ -0,0 +1,85 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// + +#nullable enable + +using System; +using System.Collections; +using System.Linq; +using Datadog.Trace.Configuration; +using Datadog.Trace.DuckTyping; +using Datadog.Trace.Logging; +using Datadog.Trace.Tagging; + +namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge +{ + internal static class AwsEventBridgeCommon + { + private const string DatadogAwsEventBridgeServiceName = "aws-eventbridge"; + private const string EventBridgeRequestOperationName = "eventbridge.request"; + private const string EventBridgeServiceName = "EventBridge"; + private const string EventBridgeOperationName = "aws.eventbridge"; + private static readonly IDatadogLogger Log = DatadogLogging.GetLoggerFor(typeof(AwsEventBridgeCommon)); + + internal const string IntegrationName = nameof(IntegrationId.AwsEventBridge); + private const IntegrationId IntegrationId = Configuration.IntegrationId.AwsEventBridge; + + public static Scope? CreateScope(Tracer tracer, string operation, string spanKind, out AwsEventBridgeTags? tags, ISpanContext? parentContext = null) + { + tags = null; + + if (!tracer.Settings.IsIntegrationEnabled(IntegrationId) || !tracer.Settings.IsIntegrationEnabled(AwsConstants.IntegrationId)) + { + // integration disabled, don't create a scope, skip this trace + return null; + } + + Scope? scope = null; + + try + { + tags = tracer.CurrentTraceSettings.Schema.Messaging.CreateAwsEventBridgeTags(spanKind); + var serviceName = tracer.CurrentTraceSettings.GetServiceName(tracer, DatadogAwsEventBridgeServiceName); + var operationName = GetOperationName(tracer); + scope = tracer.StartActiveInternal(operationName, parent: parentContext, tags: tags, serviceName: serviceName); + var span = scope.Span; + + span.Type = SpanTypes.Http; + span.ResourceName = $"{EventBridgeServiceName}.{operation}"; + + tags.Service = EventBridgeServiceName; + tags.Operation = operation; + tags.SetAnalyticsSampleRate(IntegrationId, tracer.Settings, enabledWithGlobalSetting: false); + tracer.TracerManager.Telemetry.IntegrationGeneratedSpan(IntegrationId); + } + catch (Exception ex) + { + Log.Error(ex, "Error creating or populating scope."); + } + + // always returns the scope, even if it's null because we couldn't create it, + // or we couldn't populate it completely (some tags is better than no tags) + return scope; + } + + // Finds the first entry that has a valid bus name, or null if not found. + public static string? GetBusName(IEnumerable? entries) + { + return entries? + .Cast() + .Select(entry => entry.DuckCast()) + .Where(duckEntry => duckEntry != null) + .Select(duckEntry => duckEntry!.EventBusName) + .FirstOrDefault(eventBusName => !string.IsNullOrEmpty(eventBusName)); + } + + internal static string GetOperationName(Tracer tracer) + { + return tracer.CurrentTraceSettings.Schema.Version == SchemaVersion.V0 + ? EventBridgeRequestOperationName + : tracer.CurrentTraceSettings.Schema.Messaging.GetOutboundOperationName(EventBridgeOperationName); + } + } +} diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs new file mode 100644 index 000000000000..4feb55b2972f --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs @@ -0,0 +1,88 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// + +#nullable enable + +using System; +using System.Text; +using Datadog.Trace.DuckTyping; +using Datadog.Trace.Propagators; + +namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge +{ + internal static class ContextPropagation + { + private const string DatadogKey = "_datadog"; + private const string StartTimeKey = "x-datadog-start-time"; + private const string ResourceNameKey = "x-datadog-resource-name"; + + public static void InjectTracingContext(TPutEventsRequest request, SpanContext context) + where TPutEventsRequest : IPutEventsRequest, IDuckType + { + var entries = request.Entries.Value; + if (entries == null) + { + return; + } + + foreach (var entry in entries) + { + var duckEntry = entry.DuckCast(); + if (duckEntry != null) + { + InjectHeadersIntoDetail(duckEntry, context, duckEntry.EventBusName); + } + } + } + + private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanContext context, string? eventBusName) + { + var detail = entry.Detail?.Trim() ?? "{}"; + if (!detail.EndsWith("}")) + { + // Unable to parse detail string, so just leave it unmodified. Don't inject trace context. + return; + } + + var detailBuilder = Util.StringBuilderCache.Acquire(Util.StringBuilderCache.MaxBuilderSize).Append(detail); + detailBuilder.Remove(detail.Length - 1, 1); // Remove last bracket + if (detail.Length > 2) + { + detailBuilder.Append(','); // Add comma if the original detail is not empty + } + + var traceContext = GetTraceContext(context, eventBusName); + detailBuilder.Append($"\"{DatadogKey}\":{traceContext}").Append('}'); + entry.Detail = Util.StringBuilderCache.GetStringAndRelease(detailBuilder); + } + + private static string GetTraceContext(SpanContext context, string? eventBusName) + { + // Inject trace context + var jsonBuilder = Util.StringBuilderCache.Acquire(Util.StringBuilderCache.MaxBuilderSize); + jsonBuilder.Append('{'); + SpanContextPropagator.Instance.Inject(context, jsonBuilder, new StringBuilderCarrierSetter()); + + // Inject start time and bus name + var startTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + jsonBuilder.Append($"\"{StartTimeKey}\":\"{startTime}\""); + if (eventBusName != null) + { + jsonBuilder.Append($",\"{ResourceNameKey}\":\"{eventBusName}\""); + } + + jsonBuilder.Append('}'); + return Util.StringBuilderCache.GetStringAndRelease(jsonBuilder); + } + + private struct StringBuilderCarrierSetter : ICarrierSetter + { + public void Set(StringBuilder carrier, string key, string value) + { + carrier.AppendFormat("\"{0}\":\"{1}\",", key, value); + } + } + } +} diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequest.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequest.cs new file mode 100644 index 000000000000..0da79d8c4147 --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequest.cs @@ -0,0 +1,21 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// + +#nullable enable + +using System.Collections; +using Datadog.Trace.DuckTyping; + +namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge +{ + /// + /// PutEventsRequest interface for ducktyping. + /// Mirrors Amazon.EventBridge.Model.PutEventsRequest. + /// + internal interface IPutEventsRequest : IDuckType + { + ValueWithType Entries { get; } + } +} diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequestEntry.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequestEntry.cs new file mode 100644 index 000000000000..2b7d539efb44 --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequestEntry.cs @@ -0,0 +1,23 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// + +#nullable enable + +using System; +using System.Collections.Generic; + +namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge +{ + /// + /// PutEventsRequestEntry interface for ducktyping. + /// Mirrors Amazon.EventBridge.Model.PutEventsRequestEntry, with unused properties removed. + /// + internal interface IPutEventsRequestEntry + { + string? Detail { get; set; } + + string? EventBusName { get; } + } +} diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs index e0bc335dfaf4..2e1c457fe95a 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs @@ -2,13 +2,14 @@ // Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. // + #nullable enable using System; using System.ComponentModel; using System.Threading; using Datadog.Trace.ClrProfiler.CallTarget; -using Datadog.Trace.Configuration; +using Datadog.Trace.DuckTyping; namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge; @@ -23,18 +24,52 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge; ParameterTypeNames = ["Amazon.EventBridge.Model.PutEventsRequest", ClrNames.CancellationToken], MinimumVersion = "3.3.0", MaximumVersion = "3.*.*", - IntegrationName = nameof(IntegrationId.AwsEventBridge))] + IntegrationName = AwsEventBridgeCommon.IntegrationName)] [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public class PutEventsAsyncIntegration { - internal static CallTargetState OnMethodBegin(TTarget instance, ref TRequest? request, ref CancellationToken cancellationToken) + private const string Operation = "PutEvents"; + private const string SpanKind = SpanKinds.Producer; + + /// + /// OnMethodBegin callback + /// + /// Type of the target + /// Type of the request object + /// Instance value, aka `this` of the instrumented method + /// The request for the SNS operation + /// CancellationToken value + /// CallTarget state value + internal static CallTargetState OnMethodBegin(TTarget instance, TPutEventsRequest request, CancellationToken cancellationToken) + where TPutEventsRequest : IPutEventsRequest, IDuckType { - return CallTargetState.GetDefault(); + if (request.Instance is null) + { + return CallTargetState.GetDefault(); + } + + var scope = AwsEventBridgeCommon.CreateScope(Tracer.Instance, Operation, SpanKind, out var tags); + if (tags is not null) + { + var busName = AwsEventBridgeCommon.GetBusName(request.Entries.Value); + if (busName is not null) + { + tags.EventBusName = busName; + } + } + + if (scope?.Span.Context is { } context) + { + ContextPropagation.InjectTracingContext(request, context); + } + + return new CallTargetState(scope); } - internal static TReturn? OnAsyncMethodEnd(TTarget instance, TReturn? returnValue, Exception exception, in CallTargetState state) + internal static TResponse OnAsyncMethodEnd(TTarget instance, TResponse response, Exception exception, in CallTargetState state) { - return returnValue; + state.Scope.DisposeWithException(exception); + return response; } } diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs index 838c4a454c3e..b58eab6ae8aa 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs @@ -7,7 +7,7 @@ using System; using System.ComponentModel; using Datadog.Trace.ClrProfiler.CallTarget; -using Datadog.Trace.Configuration; +using Datadog.Trace.DuckTyping; namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge; @@ -22,18 +22,51 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge; ParameterTypeNames = ["Amazon.EventBridge.Model.PutEventsRequest"], MinimumVersion = "3.3.0", MaximumVersion = "3.*.*", - IntegrationName = nameof(IntegrationId.AwsEventBridge))] + IntegrationName = AwsEventBridgeCommon.IntegrationName)] [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public class PutEventsIntegration { - internal static CallTargetState OnMethodBegin(TTarget instance, ref TRequest? request) + private const string Operation = "PutEvents"; + private const string SpanKind = SpanKinds.Producer; + + /// + /// OnMethodBegin callback + /// + /// Type of the target + /// Type of the request object + /// Instance value, aka `this` of the instrumented method + /// The request for the SNS operation + /// CallTarget state value + internal static CallTargetState OnMethodBegin(TTarget instance, TPutEventsRequest request) + where TPutEventsRequest : IPutEventsRequest, IDuckType { - return CallTargetState.GetDefault(); + if (request.Instance is null) + { + return CallTargetState.GetDefault(); + } + + var scope = AwsEventBridgeCommon.CreateScope(Tracer.Instance, Operation, SpanKind, out var tags); + if (tags is not null) + { + var busName = AwsEventBridgeCommon.GetBusName(request.Entries.Value); + if (busName is not null) + { + tags.EventBusName = busName; + } + } + + if (scope?.Span.Context is { } context) + { + ContextPropagation.InjectTracingContext(request, context); + } + + return new CallTargetState(scope); } - internal static CallTargetReturn OnMethodEnd(TTarget instance, TReturn? returnValue, Exception? exception, in CallTargetState state) + internal static CallTargetReturn OnMethodEnd(TTarget instance, TReturn returnValue, Exception exception, in CallTargetState state) { - return new CallTargetReturn(returnValue); + state.Scope.DisposeWithException(exception); + return new CallTargetReturn(returnValue); } } diff --git a/tracer/src/Datadog.Trace/Configuration/Schema/MessagingSchema.cs b/tracer/src/Datadog.Trace/Configuration/Schema/MessagingSchema.cs index 6a2e8d1e30bb..30d9c2ad83fc 100644 --- a/tracer/src/Datadog.Trace/Configuration/Schema/MessagingSchema.cs +++ b/tracer/src/Datadog.Trace/Configuration/Schema/MessagingSchema.cs @@ -90,6 +90,12 @@ public MsmqTags CreateMsmqTags(string spanKind) _ => new AwsSnsV1Tags(spanKind), }; + public AwsEventBridgeTags CreateAwsEventBridgeTags(string spanKind) => _version switch + { + SchemaVersion.V0 when !_peerServiceTagsEnabled => new AwsEventBridgeTags(), + _ => new AwsEventBridgeV1Tags(spanKind), + }; + public AwsKinesisTags CreateAwsKinesisTags(string spanKind) => _version switch { SchemaVersion.V0 when !_peerServiceTagsEnabled => new AwsKinesisTags(spanKind), diff --git a/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs b/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs new file mode 100644 index 000000000000..01dc3625be70 --- /dev/null +++ b/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs @@ -0,0 +1,85 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// + +using System; +using Datadog.Trace.SourceGenerators; + +#pragma warning disable SA1402 // File must contain single type +namespace Datadog.Trace.Tagging +{ + internal partial class AwsEventBridgeTags : AwsSdkTags + { + public AwsEventBridgeTags() + : this(SpanKinds.Client) + { + } + + public AwsEventBridgeTags(string spanKind) + { + SpanKind = spanKind; + } + + [Tag(Trace.Tags.EventBusName)] + public string EventBusName { get; set; } + + [Tag(Trace.Tags.SpanKind)] + public override string SpanKind { get; } + } + + internal partial class AwsEventBridgeV1Tags : AwsEventBridgeTags + { + private string _peerServiceOverride = null; + + // For the sake of unit tests, define a default constructor + // though the AWS EventBridge integration should use the constructor that takes a + // spanKind so the setter is only invoked once + [Obsolete("Use constructor that takes a SpanKind")] + public AwsEventBridgeV1Tags() + : this(SpanKinds.Client) + { + } + + public AwsEventBridgeV1Tags(string spanKind) + : base(spanKind) + { + } + + // Use a private setter for setting the "peer.service" tag so we avoid + // accidentally setting the value ourselves and instead calculate the + // value from predefined precursor attributes. + // However, this can still be set from ITags.SetTag so the user can + // customize the value if they wish. + [Tag(Trace.Tags.PeerService)] + public string PeerService + { + get + { + if (SpanKind == SpanKinds.Consumer) + { + return null; + } + + return _peerServiceOverride ?? EventBusName; + } + private set => _peerServiceOverride = value; + } + + [Tag(Trace.Tags.PeerServiceSource)] + public string PeerServiceSource + { + get + { + if (SpanKind == SpanKinds.Consumer) + { + return null; + } + + return _peerServiceOverride is not null + ? "peer.service" + : Trace.Tags.EventBusName; + } + } + } +} diff --git a/tracer/src/Datadog.Trace/Tags.cs b/tracer/src/Datadog.Trace/Tags.cs index 41cf31d53a1f..7f7b0a310336 100644 --- a/tracer/src/Datadog.Trace/Tags.cs +++ b/tracer/src/Datadog.Trace/Tags.cs @@ -430,6 +430,11 @@ public static partial class Tags /// internal const string AwsQueueUrl = "aws.queue.url"; + /// + /// The event bus name associated with the span. + /// + internal const string EventBusName = "eventbusname"; + /// /// The stream name associated with the AWS SDK Kinesis span. /// From d05eb4cd88dbfa00906a26b1b495868604a7032c Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Thu, 26 Sep 2024 17:00:29 -0400 Subject: [PATCH 03/15] Add unit tests --- .../build/Datadog.Trace.Trimming.xml | 4 + .../EventBridge/AwsEventBridgeCommonTests.cs | 66 +++++ .../EventBridge/ContextPropagationTests.cs | 230 ++++++++++++++++++ ...dog.Trace.ClrProfiler.Managed.Tests.csproj | 1 + .../Schema/MessagingSchemaTests.cs | 15 ++ 5 files changed, 316 insertions(+) create mode 100644 tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommonTests.cs create mode 100644 tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/ContextPropagationTests.cs diff --git a/tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml b/tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml index b4ea1f6bddfb..1aa3e3825183 100644 --- a/tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml +++ b/tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml @@ -4,6 +4,7 @@ + @@ -214,6 +215,7 @@ + @@ -546,6 +548,8 @@ + + diff --git a/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommonTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommonTests.cs new file mode 100644 index 000000000000..8a121af9f1ff --- /dev/null +++ b/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommonTests.cs @@ -0,0 +1,66 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// + +using System.Collections.Generic; +using System.Collections.Specialized; +using Amazon.EventBridge.Model; +using Datadog.Trace.Agent; +using Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge; +using Datadog.Trace.Configuration; +using Datadog.Trace.Sampling; +using FluentAssertions; +using Moq; +using Xunit; + +namespace Datadog.Trace.ClrProfiler.Managed.Tests.AutoInstrumentation.AWS.EventBridge; + +public class AwsEventBridgeCommonTests +{ + [Fact] + public void GetCorrectBusName() + { + var entries = new List + { + new() { EventBusName = "test-bus-1" }, + new() { EventBusName = "test-bus-2" }, + new() { EventBusName = string.Empty }, + new() { EventBusName = null } + }; + + var result = AwsEventBridgeCommon.GetBusName(entries); + result.Should().Be("test-bus-1"); + + AwsEventBridgeCommon.GetBusName(null).Should().BeNull(); + AwsEventBridgeCommon.GetBusName(new List()).Should().BeNull(); + + var emptyEntries = new List + { + new() { EventBusName = string.Empty }, + new() { EventBusName = null } + }; + AwsEventBridgeCommon.GetBusName(emptyEntries).Should().BeNull(); + } + + [Fact] + public void GetCorrectOperationName() + { + var tracerV0 = GetTracer("v0"); + AwsEventBridgeCommon.GetOperationName(tracerV0).Should().Be("eventbridge.request"); + + var tracerV1 = GetTracer("v1"); + AwsEventBridgeCommon.GetOperationName(tracerV1).Should().Be("aws.eventbridge.send"); + } + + private static Tracer GetTracer(string schemaVersion) + { + var collection = new NameValueCollection { { ConfigurationKeys.MetadataSchemaVersion, schemaVersion } }; + IConfigurationSource source = new NameValueConfigurationSource(collection); + var settings = new TracerSettings(source); + var writerMock = new Mock(); + var samplerMock = new Mock(); + + return new Tracer(settings, writerMock.Object, samplerMock.Object, scopeManager: null, statsd: null); + } +} diff --git a/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/ContextPropagationTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/ContextPropagationTests.cs new file mode 100644 index 000000000000..748c66a5f8a4 --- /dev/null +++ b/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/ContextPropagationTests.cs @@ -0,0 +1,230 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// + +#nullable enable + +using System.Collections; +using System.Collections.Generic; +using Amazon.EventBridge.Model; +using Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge; +using Datadog.Trace.DuckTyping; +using Datadog.Trace.Vendors.Newtonsoft.Json; +using FluentAssertions; +using Xunit; + +namespace Datadog.Trace.ClrProfiler.Managed.Tests.AutoInstrumentation.AWS.EventBridge; + +public class ContextPropagationTests +{ + private const string DatadogKey = "_datadog"; + private const string StartTimeKey = "x-datadog-start-time"; + private const string ResourceNameKey = "x-datadog-resource-name"; + private const string EventBusName = "test-event-bus"; + + private readonly SpanContext _spanContext; + + public ContextPropagationTests() + { + const long upper = 1234567890123456789; + const ulong lower = 9876543210987654321; + + var traceId = new TraceId(upper, lower); + const ulong spanId = 6766950223540265769; + _spanContext = new SpanContext(traceId, spanId, 1, "test-eventbridge", "serverless"); + } + + [Fact] + public void InjectTracingContext_EmptyDetail_AddsTraceContext() + { + var request = GeneratePutEventsRequest([ + new PutEventsRequestEntry { Detail = "{}", EventBusName = EventBusName } + ]); + + var proxy = request.DuckCast(); + + ContextPropagation.InjectTracingContext(proxy, _spanContext); + + var entries = (IList)proxy.Entries.Value!; + entries.Count.Should().Be(1); + var entry = (PutEventsRequestEntry)entries[0]!; + + var detail = JsonConvert.DeserializeObject>(entry.Detail); + detail.Should().NotBeNull(); + detail!.Count.Should().Be(1); + + var extracted = detail.TryGetValue(DatadogKey, out var datadogObject); + extracted.Should().BeTrue(); + datadogObject.Should().NotBeNull(); + + var jsonString = JsonConvert.SerializeObject(datadogObject); + var extractedTraceContext = JsonConvert.DeserializeObject>(jsonString); + + extractedTraceContext!["x-datadog-parent-id"].Should().Be(_spanContext.SpanId.ToString()); + extractedTraceContext["x-datadog-trace-id"].Should().Be(_spanContext.TraceId.ToString()); + extractedTraceContext[ResourceNameKey].Should().Be(EventBusName); + extractedTraceContext.Should().ContainKey(StartTimeKey); + extractedTraceContext[StartTimeKey].Should().NotBeNullOrEmpty(); + } + + [Fact] + public void InjectTracingContext_ExistingDetail_AddsTraceContext() + { + var request = GeneratePutEventsRequest([ + new PutEventsRequestEntry { Detail = "{\"foo\":\"bar\"}", EventBusName = EventBusName } + ]); + + var proxy = request.DuckCast(); + + ContextPropagation.InjectTracingContext(proxy, _spanContext); + + var entries = (IList)proxy.Entries.Value!; + entries.Count.Should().Be(1); + var entry = (PutEventsRequestEntry)entries[0]!; + + var detail = JsonConvert.DeserializeObject>(entry.Detail); + detail.Should().NotBeNull(); + detail!.Count.Should().Be(2); + detail["foo"].Should().Be("bar"); + + var extracted = detail.TryGetValue(DatadogKey, out var datadogObject); + extracted.Should().BeTrue(); + datadogObject.Should().NotBeNull(); + + var jsonString = JsonConvert.SerializeObject(datadogObject); + var extractedTraceContext = JsonConvert.DeserializeObject>(jsonString); + + extractedTraceContext!["x-datadog-parent-id"].Should().Be(_spanContext.SpanId.ToString()); + extractedTraceContext["x-datadog-trace-id"].Should().Be(_spanContext.TraceId.ToString()); + extractedTraceContext[ResourceNameKey].Should().Be(EventBusName); + extractedTraceContext.Should().ContainKey(StartTimeKey); + extractedTraceContext[StartTimeKey].Should().NotBeNullOrEmpty(); + } + + [Fact] + public void InjectTracingContext_NullDetail_AddsTraceContext() + { + var request = GeneratePutEventsRequest([ + new PutEventsRequestEntry { Detail = null, EventBusName = EventBusName } + ]); + + var proxy = request.DuckCast(); + + ContextPropagation.InjectTracingContext(proxy, _spanContext); + + var entries = (IList)proxy.Entries.Value!; + entries.Count.Should().Be(1); + var entry = (PutEventsRequestEntry)entries[0]!; + + var detail = JsonConvert.DeserializeObject>(entry.Detail); + detail.Should().NotBeNull(); + detail!.Count.Should().Be(1); + + var extracted = detail.TryGetValue(DatadogKey, out var datadogObject); + extracted.Should().BeTrue(); + datadogObject.Should().NotBeNull(); + + var jsonString = JsonConvert.SerializeObject(datadogObject); + var extractedTraceContext = JsonConvert.DeserializeObject>(jsonString); + + extractedTraceContext!["x-datadog-parent-id"].Should().Be(_spanContext.SpanId.ToString()); + extractedTraceContext["x-datadog-trace-id"].Should().Be(_spanContext.TraceId.ToString()); + extractedTraceContext[ResourceNameKey].Should().Be(EventBusName); + extractedTraceContext.Should().ContainKey(StartTimeKey); + extractedTraceContext[StartTimeKey].Should().NotBeNullOrEmpty(); + } + + [Fact] + public void InjectTracingContext_InvalidDetail_DoesNotAddTraceContext() + { + var request = GeneratePutEventsRequest([ + new PutEventsRequestEntry { Detail = "{invalid json", EventBusName = EventBusName } + ]); + + var proxy = request.DuckCast(); + + ContextPropagation.InjectTracingContext(proxy, _spanContext); + + var entries = (IList)proxy.Entries.Value!; + entries.Count.Should().Be(1); + var entry = (PutEventsRequestEntry)entries[0]!; + + entry.Detail.Should().Be("{invalid json"); + } + + [Fact] + public void InjectTracingContext_MultipleEntries_AddsTraceContextToAll() + { + var request = GeneratePutEventsRequest([ + new PutEventsRequestEntry { Detail = "{}", EventBusName = EventBusName }, + new PutEventsRequestEntry { Detail = "{\"foo\":\"bar\"}", EventBusName = EventBusName } + ]); + + var proxy = request.DuckCast(); + + ContextPropagation.InjectTracingContext(proxy, _spanContext); + + var entries = (IList)proxy.Entries.Value!; + entries.Count.Should().Be(2); + + foreach (var entry in entries) + { + var typedEntry = entry as PutEventsRequestEntry; + var detail = JsonConvert.DeserializeObject>(typedEntry!.Detail); + detail.Should().NotBeNull(); + detail!.Should().ContainKey(DatadogKey); + + var extracted = detail!.TryGetValue(DatadogKey, out var datadogObject); + extracted.Should().BeTrue(); + datadogObject.Should().NotBeNull(); + + var jsonString = JsonConvert.SerializeObject(datadogObject); + var extractedTraceContext = JsonConvert.DeserializeObject>(jsonString); + + extractedTraceContext!["x-datadog-parent-id"].Should().Be(_spanContext.SpanId.ToString()); + extractedTraceContext["x-datadog-trace-id"].Should().Be(_spanContext.TraceId.ToString()); + extractedTraceContext[ResourceNameKey].Should().Be(EventBusName); + extractedTraceContext.Should().ContainKey(StartTimeKey); + extractedTraceContext[StartTimeKey].Should().NotBeNullOrEmpty(); + } + } + + [Fact] + public void InjectTracingContext_NullEventBusName_OmitsResourceName() + { + var request = GeneratePutEventsRequest([ + new PutEventsRequestEntry { Detail = "{}", EventBusName = null } + ]); + + var proxy = request.DuckCast(); + + ContextPropagation.InjectTracingContext(proxy, _spanContext); + + var entries = (IList)proxy.Entries.Value!; + entries.Count.Should().Be(1); + var entry = (PutEventsRequestEntry)entries[0]!; + + var detail = JsonConvert.DeserializeObject>(entry.Detail); + detail.Should().NotBeNull(); + detail!.Count.Should().Be(1); + + var extracted = detail.TryGetValue(DatadogKey, out var datadogObject); + extracted.Should().BeTrue(); + datadogObject.Should().NotBeNull(); + + var jsonString = JsonConvert.SerializeObject(datadogObject); + var extractedTraceContext = JsonConvert.DeserializeObject>(jsonString); + + extractedTraceContext!["x-datadog-parent-id"].Should().Be(_spanContext.SpanId.ToString()); + extractedTraceContext["x-datadog-trace-id"].Should().Be(_spanContext.TraceId.ToString()); + extractedTraceContext.Should().NotContainKey(ResourceNameKey); + extractedTraceContext.Should().ContainKey(StartTimeKey); + extractedTraceContext[StartTimeKey].Should().NotBeNullOrEmpty(); + } + + private static PutEventsRequest GeneratePutEventsRequest(List entries) + { + return new PutEventsRequest { Entries = entries }; + } +} diff --git a/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/Datadog.Trace.ClrProfiler.Managed.Tests.csproj b/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/Datadog.Trace.ClrProfiler.Managed.Tests.csproj index 94471112ab19..b36cae25af51 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/Datadog.Trace.ClrProfiler.Managed.Tests.csproj +++ b/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/Datadog.Trace.ClrProfiler.Managed.Tests.csproj @@ -18,6 +18,7 @@ + diff --git a/tracer/test/Datadog.Trace.Tests/Configuration/Schema/MessagingSchemaTests.cs b/tracer/test/Datadog.Trace.Tests/Configuration/Schema/MessagingSchemaTests.cs index 1ab641a248c0..8be2e81ad044 100644 --- a/tracer/test/Datadog.Trace.Tests/Configuration/Schema/MessagingSchemaTests.cs +++ b/tracer/test/Datadog.Trace.Tests/Configuration/Schema/MessagingSchemaTests.cs @@ -153,5 +153,20 @@ public void CreateAwsSnsTagsReturnsCorrectImplementation(object schemaVersionObj var namingSchema = new NamingSchema(schemaVersion, peerServiceTagsEnabled, removeClientServiceNamesEnabled, DefaultServiceName, _mappings, new Dictionary()); namingSchema.Messaging.CreateAwsSnsTags("spanKind").Should().BeOfType(expectedType); } + + [Theory] + [MemberData(nameof(GetAllConfigs))] + public void CreateAwsEventBridgeTagsReturnsCorrectImplementation(object schemaVersionObject, bool peerServiceTagsEnabled, bool removeClientServiceNamesEnabled) + { + var schemaVersion = (SchemaVersion)schemaVersionObject; // Unbox SchemaVersion, which is only defined internally + var expectedType = schemaVersion switch + { + SchemaVersion.V0 when peerServiceTagsEnabled == false => typeof(AwsEventBridgeTags), + _ => typeof(AwsEventBridgeV1Tags), + }; + + var namingSchema = new NamingSchema(schemaVersion, peerServiceTagsEnabled, removeClientServiceNamesEnabled, DefaultServiceName, _mappings, new Dictionary()); + namingSchema.Messaging.CreateAwsEventBridgeTags("spanKind").Should().BeOfType(expectedType); + } } } From 5ccd8b772887c807eb643c6950d48a0b8ba2c16d Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Fri, 27 Sep 2024 14:04:46 -0400 Subject: [PATCH 04/15] Add integration tests --- Datadog.Trace.sln | 6 ++ .../Datadog.Dependabot.Integrations.csproj | 5 + tracer/missing-nullability-files.csv | 1 + .../AWS/AwsEventBridgeTests.cs | 93 +++++++++++++++++ .../SpanMetadataAPI.cs | 21 ++++ .../SpanMetadataV0Rules.cs | 20 ++++ .../SpanMetadataV1Rules.cs | 63 ++++++++++++ ...tBridgeTests.NetCore.SchemaV0.verified.txt | 99 +++++++++++++++++++ ...tBridgeTests.NetCore.SchemaV1.verified.txt | 90 +++++++++++++++++ .../Samples.AWS.EventBridge/AsyncHelpers.cs | 79 +++++++++++++++ .../Samples.AWS.EventBridge/Program.cs | 41 ++++++++ .../Properties/launchSettings.json | 21 ++++ .../Samples.AWS.EventBridge.csproj | 19 ++++ .../Samples.AWS.EventBridge/SyncHelpers.cs | 82 +++++++++++++++ 14 files changed, 640 insertions(+) create mode 100644 tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs create mode 100644 tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt create mode 100644 tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV1.verified.txt create mode 100644 tracer/test/test-applications/integrations/Samples.AWS.EventBridge/AsyncHelpers.cs create mode 100644 tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Program.cs create mode 100644 tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Properties/launchSettings.json create mode 100644 tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Samples.AWS.EventBridge.csproj create mode 100644 tracer/test/test-applications/integrations/Samples.AWS.EventBridge/SyncHelpers.cs diff --git a/Datadog.Trace.sln b/Datadog.Trace.sln index fca5c9a4b65a..9b1deb6736ba 100644 --- a/Datadog.Trace.sln +++ b/Datadog.Trace.sln @@ -589,6 +589,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Generated", "Generated", "{ tracer\build\PackageVersionsLatestSpecific.g.props = tracer\build\PackageVersionsLatestSpecific.g.props EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.AWS.EventBridge", "tracer\test\test-applications\integrations\Samples.AWS.EventBridge\Samples.AWS.EventBridge.csproj", "{D6155F26-8245-4B66-8944-79C3DF9F9DA3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1409,6 +1411,10 @@ Global {2CA0D70C-DFC1-458A-871B-328AB6E87E3A}.Debug|Any CPU.Build.0 = Debug|Any CPU {2CA0D70C-DFC1-458A-871B-328AB6E87E3A}.Release|Any CPU.ActiveCfg = Release|Any CPU {2CA0D70C-DFC1-458A-871B-328AB6E87E3A}.Release|Any CPU.Build.0 = Release|Any CPU + {D6155F26-8245-4B66-8944-79C3DF9F9DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D6155F26-8245-4B66-8944-79C3DF9F9DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6155F26-8245-4B66-8944-79C3DF9F9DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D6155F26-8245-4B66-8944-79C3DF9F9DA3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tracer/dependabot/Datadog.Dependabot.Integrations.csproj b/tracer/dependabot/Datadog.Dependabot.Integrations.csproj index 1fd3f50207f3..30bb6f348e06 100644 --- a/tracer/dependabot/Datadog.Dependabot.Integrations.csproj +++ b/tracer/dependabot/Datadog.Dependabot.Integrations.csproj @@ -26,6 +26,11 @@ + + + + + diff --git a/tracer/missing-nullability-files.csv b/tracer/missing-nullability-files.csv index a060ea59d9a9..d1dbb091a1c9 100644 --- a/tracer/missing-nullability-files.csv +++ b/tracer/missing-nullability-files.csv @@ -201,6 +201,7 @@ src/Datadog.Trace/Tagging/AspNetCoreMvcTags.cs src/Datadog.Trace/Tagging/AspNetCoreTags.cs src/Datadog.Trace/Tagging/AspNetTags.cs src/Datadog.Trace/Tagging/AwsDynamoDbTags.cs +src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs src/Datadog.Trace/Tagging/AwsKinesisTags.cs src/Datadog.Trace/Tagging/AwsSdkTags.cs src/Datadog.Trace/Tagging/AwsSnsTags.cs diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs new file mode 100644 index 000000000000..fc7f1c9666a5 --- /dev/null +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs @@ -0,0 +1,93 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Datadog.Trace.Configuration; +using Datadog.Trace.TestHelpers; +using FluentAssertions; +using VerifyXunit; +using Xunit; +using Xunit.Abstractions; + +namespace Datadog.Trace.ClrProfiler.IntegrationTests.AWS +{ + [Trait("RequiresDockerDependency", "true")] + [UsesVerify] + public class AwsEventBridgeTests : TracingIntegrationTest + { + public AwsEventBridgeTests(ITestOutputHelper output) + : base("AWS.EventBridge", output) + { + } + + public static IEnumerable GetEnabledConfig() + => from packageVersionArray in PackageVersions.AwsEventBridge + from metadataSchemaVersion in new[] { "v0", "v1" } + select new[] { packageVersionArray[0], metadataSchemaVersion }; + + public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.Tags["span.kind"] switch + { + SpanKinds.Consumer => span.IsAwsEventBridgeInbound(metadataSchemaVersion), + SpanKinds.Producer => span.IsAwsEventBridgeOutbound(metadataSchemaVersion), + SpanKinds.Client => span.IsAwsEventBridgeRequest(metadataSchemaVersion), + _ => throw new ArgumentException($"span.Tags[\"span.kind\"] is not a supported value for the AWS EventBridge integration: {span.Tags["span.kind"]}", nameof(span)), + }; + + [SkippableTheory] + [MemberData(nameof(GetEnabledConfig))] + [Trait("Category", "EndToEnd")] + public async Task SubmitsTraces(string packageVersion, string metadataSchemaVersion) + { + SetEnvironmentVariable("DD_TRACE_SPAN_ATTRIBUTE_SCHEMA", metadataSchemaVersion); + var isExternalSpan = metadataSchemaVersion == "v0"; + var clientSpanServiceName = isExternalSpan ? $"{EnvironmentHelper.FullSampleName}-aws-eventbridge" : EnvironmentHelper.FullSampleName; + + using var telemetry = this.ConfigureTelemetry(); + using (var agent = EnvironmentHelper.GetMockAgent()) + using (await RunSampleAndWaitForExit(agent, packageVersion: packageVersion)) + { +#if NETFRAMEWORK + var expectedCount = 8; + var frameworkName = "NetFramework"; +#else + var expectedCount = 4; + var frameworkName = "NetCore"; +#endif + var spans = agent.WaitForSpans(expectedCount); + var eventBridgeSpans = spans.Where(span => span.Tags.TryGetValue("component", out var component) && component == "aws-sdk"); + + eventBridgeSpans.Should().NotBeEmpty(); + ValidateIntegrationSpans(eventBridgeSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, isExternalSpan); + + var host = Environment.GetEnvironmentVariable("AWS_SDK_HOST"); + + var settings = VerifyHelper.GetSpanVerifierSettings(); + + settings.UseFileName($"{nameof(AwsEventBridgeTests)}.{frameworkName}.Schema{metadataSchemaVersion.ToUpper()}"); + settings.AddSimpleScrubber("out.host: localhost", "out.host: aws_eventbridge"); + settings.AddSimpleScrubber("out.host: localstack", "out.host: aws_eventbridge"); + settings.AddSimpleScrubber("out.host: localstack_arm64", "out.host: aws_eventbridge"); + settings.AddSimpleScrubber("peer.service: localhost", "peer.service: aws_eventbridge"); + settings.AddSimpleScrubber("peer.service: localstack", "peer.service: aws_eventbridge"); + settings.AddSimpleScrubber("peer.service: localstack_arm64", "peer.service: aws_eventbridge"); + if (!string.IsNullOrWhiteSpace(host)) + { + settings.AddSimpleScrubber(host, "localhost:00000"); + } + + settings.DisableRequireUniquePrefix(); + + // Note: http.request spans are expected for the EventBridge APIs that don't have explicit support + // (Only PutEvents and PutEventsAsync are supported right now) + await VerifyHelper.VerifySpans(spans, settings); + + telemetry.AssertIntegrationEnabled(IntegrationId.AwsEventBridge); + } + } + } +} diff --git a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataAPI.cs b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataAPI.cs index 9b64a9b73290..3578b2bdac5c 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataAPI.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataAPI.cs @@ -116,6 +116,27 @@ public static Result IsAwsSnsRequest(this MockSpan span, string metadataSchemaVe _ => span.IsAwsSnsRequestV0(), }; + public static Result IsAwsEventBridgeInbound(this MockSpan span, string metadataSchemaVersion) => + metadataSchemaVersion switch + { + "v1" => span.IsAwsEventBridgeInboundV1(), + _ => span.IsAwsEventBridgeRequestV0(), + }; + + public static Result IsAwsEventBridgeOutbound(this MockSpan span, string metadataSchemaVersion) => + metadataSchemaVersion switch + { + "v1" => span.IsAwsEventBridgeOutboundV1(), + _ => span.IsAwsEventBridgeRequestV0(), + }; + + public static Result IsAwsEventBridgeRequest(this MockSpan span, string metadataSchemaVersion) => + metadataSchemaVersion switch + { + "v1" => span.IsAwsEventBridgeRequestV1(), + _ => span.IsAwsEventBridgeRequestV0(), + }; + public static Result IsAzureServiceBusInbound(this MockSpan span, string metadataSchemaVersion, ISet excludeTags = null) => metadataSchemaVersion switch { diff --git a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs index f9fee104ec11..c8d3aa7c8766 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs @@ -216,6 +216,26 @@ public static Result IsAwsSnsRequestV0(this MockSpan span) => Result.FromSpan(sp .Matches("component", "aws-sdk") .Matches("span.kind", "client")); + public static Result IsAwsEventBridgeRequestV0(this MockSpan span) => Result.FromSpan(span) + .Properties(s => s + .Matches(Name, "eventbridge.request") + .Matches(Type, "http")) + .Tags(s => s + .Matches("aws.agent", "dotnet-aws-sdk") + .IsPresent("aws.operation") + .IsOptional("aws.region") + .IsOptional("region") + .IsPresent("aws.requestId") + .Matches("aws.service", "EventBridge") + .Matches("aws_service", "EventBridge") + .IsPresent("eventbusname") + .IsPresent("http.method") + .IsPresent("http.status_code") + .IsPresent("http.url") + .IsOptional("_dd.base_service") + .Matches("component", "aws-sdk") + .Matches("span.kind", "client")); + public static Result IsAzureServiceBusInboundV0(this MockSpan span, ISet excludeTags = null) => Result.FromSpan(span, excludeTags) .Properties(s => s .MatchesOneOf(Name, "servicebus.receive", "servicebus.process", "consumer") diff --git a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs index 00333d1121b6..161308c20063 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs @@ -324,6 +324,69 @@ public static Result IsAwsSnsRequestV1(this MockSpan span) => Result.FromSpan(sp .Matches("component", "aws-sdk") .Matches("span.kind", "client")); + public static Result IsAwsEventBridgeInboundV1(this MockSpan span) => Result.FromSpan(span) + .Properties(s => s + .Matches(Name, "aws.eventbridge.process") + .Matches(Type, "http")) + .Tags(s => s + .Matches("aws.agent", "dotnet-aws-sdk") + .IsPresent("aws.operation") + .IsOptional("aws.region") + .IsOptional("region") + .IsPresent("aws.requestId") + .Matches("aws.service", "EventBridge") + .Matches("aws_service", "EventBridge") + .IsPresent("eventbusname") + .IsPresent("http.method") + .IsPresent("http.status_code") + .IsPresent("http.url") + .IsOptional("_dd.base_service") + .Matches("component", "aws-sdk") + .Matches("span.kind", "consumer")); + + public static Result IsAwsEventBridgeOutboundV1(this MockSpan span) => Result.FromSpan(span) + .Properties(s => s + .Matches(Name, "aws.eventbridge.send") + .Matches(Type, "http")) + .Tags(s => s + .Matches("aws.agent", "dotnet-aws-sdk") + .IsPresent("aws.operation") + .IsOptional("aws.region") + .IsOptional("region") + .IsPresent("aws.requestId") + .Matches("aws.service", "EventBridge") + .Matches("aws_service", "EventBridge") + .IsPresent("eventbusname") + .IsPresent("http.method") + .IsPresent("http.status_code") + .IsPresent("http.url") + .IsPresent("peer.service") + .IsOptional("peer.service.remapped_from") + .MatchesOneOf("_dd.peer.service.source", "eventbusname", "peer.service") + .Matches("component", "aws-sdk") + .Matches("span.kind", "producer")); + + public static Result IsAwsEventBridgeRequestV1(this MockSpan span) => Result.FromSpan(span) + .Properties(s => s + .Matches(Name, "aws.eventbridge.request") + .Matches(Type, "http")) + .Tags(s => s + .Matches("aws.agent", "dotnet-aws-sdk") + .IsPresent("aws.operation") + .IsOptional("aws.region") + .IsOptional("region") + .IsPresent("aws.requestId") + .Matches("aws.service", "EventBridge") + .Matches("aws_service", "EventBridge") + .IsPresent("eventbusname") + .IsPresent("http.method") + .IsPresent("http.status_code") + .IsPresent("http.url") + .IsPresent("peer.service") + .IsOptional("peer.service.remapped_from") + .Matches("component", "aws-sdk") + .Matches("span.kind", "client")); + public static Result IsAzureServiceBusInboundV1(this MockSpan span, ISet excludeTags = null) => Result.FromSpan(span, excludeTags) .Properties(s => s .MatchesOneOf(Name, "servicebus.receive", "servicebus.process", "consumer") diff --git a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt new file mode 100644 index 000000000000..15ad1d449729 --- /dev/null +++ b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt @@ -0,0 +1,99 @@ +[ + { + TraceId: Id_1, + SpanId: Id_2, + Name: async-methods, + Resource: async-methods, + Service: Samples.AWS.EventBridge, + Tags: { + env: integration_tests, + language: dotnet, + runtime-id: Guid_1 + }, + Metrics: { + process_id: 0, + _dd.top_level: 1.0, + _dd.tracer_kr: 1.0, + _sampling_priority_v1: 1.0 + } + }, + { + TraceId: Id_1, + SpanId: Id_3, + Name: http.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge-http-client, + Type: http, + ParentId: Id_2, + Tags: { + component: HttpMessageHandler, + env: integration_tests, + http-client-handler-type: System.Net.Http.HttpClientHandler, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + runtime-id: Guid_1, + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge + }, + Metrics: { + _dd.top_level: 1.0 + } + }, + { + TraceId: Id_1, + SpanId: Id_4, + Name: eventbridge.request, + Resource: EventBridge.PutEvents, + Service: Samples.AWS.EventBridge-aws-eventbridge, + Type: http, + ParentId: Id_2, + Tags: { + aws.agent: dotnet-aws-sdk, + aws.operation: PutEvents, + aws.requestId: Guid_2, + aws.service: EventBridge, + aws_service: EventBridge, + component: aws-sdk, + env: integration_tests, + eventbusname: MyEventBus, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + runtime-id: Guid_1, + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge + }, + Metrics: { + _dd.top_level: 1.0 + } + }, + { + TraceId: Id_1, + SpanId: Id_5, + Name: http.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge-http-client, + Type: http, + ParentId: Id_2, + Tags: { + component: HttpMessageHandler, + env: integration_tests, + http-client-handler-type: System.Net.Http.HttpClientHandler, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + runtime-id: Guid_1, + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge + }, + Metrics: { + _dd.top_level: 1.0 + } + } +] \ No newline at end of file diff --git a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV1.verified.txt b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV1.verified.txt new file mode 100644 index 000000000000..6f7dc36e286e --- /dev/null +++ b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV1.verified.txt @@ -0,0 +1,90 @@ +[ + { + TraceId: Id_1, + SpanId: Id_2, + Name: async-methods, + Resource: async-methods, + Service: Samples.AWS.EventBridge, + Tags: { + env: integration_tests, + language: dotnet, + runtime-id: Guid_1 + }, + Metrics: { + process_id: 0, + _dd.top_level: 1.0, + _dd.tracer_kr: 1.0, + _sampling_priority_v1: 1.0 + } + }, + { + TraceId: Id_1, + SpanId: Id_3, + Name: http.client.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge, + Type: http, + ParentId: Id_2, + Tags: { + component: HttpMessageHandler, + env: integration_tests, + http-client-handler-type: System.Net.Http.HttpClientHandler, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + peer.service: aws_eventbridge, + span.kind: client, + _dd.peer.service.source: out.host + } + }, + { + TraceId: Id_1, + SpanId: Id_4, + Name: aws.eventbridge.send, + Resource: EventBridge.PutEvents, + Service: Samples.AWS.EventBridge, + Type: http, + ParentId: Id_2, + Tags: { + aws.agent: dotnet-aws-sdk, + aws.operation: PutEvents, + aws.requestId: Guid_2, + aws.service: EventBridge, + aws_service: EventBridge, + component: aws-sdk, + env: integration_tests, + eventbusname: MyEventBus, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + peer.service: MyEventBus, + span.kind: producer, + _dd.peer.service.source: eventbusname + } + }, + { + TraceId: Id_1, + SpanId: Id_5, + Name: http.client.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge, + Type: http, + ParentId: Id_2, + Tags: { + component: HttpMessageHandler, + env: integration_tests, + http-client-handler-type: System.Net.Http.HttpClientHandler, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + peer.service: aws_eventbridge, + span.kind: client, + _dd.peer.service.source: out.host + } + } +] \ No newline at end of file diff --git a/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/AsyncHelpers.cs b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/AsyncHelpers.cs new file mode 100644 index 000000000000..6b45cb08e631 --- /dev/null +++ b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/AsyncHelpers.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Amazon.EventBridge; +using Amazon.EventBridge.Model; + +namespace Samples.AWS.EventBridge +{ + static class AsyncHelpers + { + private const string EventBusName = "MyEventBus"; + private const string EventDetail = "{\"foo\":\"bar\"}"; + + public static async Task StartEventBridgeTasks(AmazonEventBridgeClient eventBridgeClient) + { + Console.WriteLine("Beginning Async methods"); + using (var scope = SampleHelpers.CreateScope("async-methods")) + { + await CreateEventBusAsync(eventBridgeClient, EventBusName); + + // Allow time for the resource to be ready + Thread.Sleep(1000); + + await PutEventsAsync(eventBridgeClient, EventBusName); + + await DeleteEventBusAsync(eventBridgeClient, EventBusName); + + // Allow time for the resource to be deleted + Thread.Sleep(1000); + } + } + + private static async Task PutEventsAsync(AmazonEventBridgeClient eventBridgeClient, string eventBusName) + { + var request = new PutEventsRequest + { + Entries = new List + { + new PutEventsRequestEntry + { + Source = "my.app", + DetailType = "appEvent", + Detail = EventDetail, + EventBusName = eventBusName + } + } + }; + + var response = await eventBridgeClient.PutEventsAsync(request); + + Console.WriteLine($"PutEventsAsync(PutEventsRequest) HTTP status code: {response.HttpStatusCode}"); + } + + private static async Task DeleteEventBusAsync(AmazonEventBridgeClient eventBridgeClient, string eventBusName) + { + var deleteEventBusRequest = new DeleteEventBusRequest + { + Name = eventBusName + }; + + var response = await eventBridgeClient.DeleteEventBusAsync(deleteEventBusRequest); + + Console.WriteLine($"DeleteEventBusAsync(DeleteEventBusRequest) HTTP status code: {response.HttpStatusCode}"); + } + + private static async Task CreateEventBusAsync(AmazonEventBridgeClient eventBridgeClient, string eventBusName) + { + var createEventBusRequest = new CreateEventBusRequest + { + Name = eventBusName + }; + + var response = await eventBridgeClient.CreateEventBusAsync(createEventBusRequest); + + Console.WriteLine($"CreateEventBusAsync(CreateEventBusRequest) HTTP status code: {response.HttpStatusCode}"); + } + } +} diff --git a/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Program.cs b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Program.cs new file mode 100644 index 000000000000..248324c875ac --- /dev/null +++ b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Program.cs @@ -0,0 +1,41 @@ +using System; +using System.Threading.Tasks; +using Amazon.Runtime; +using Amazon.EventBridge; + +namespace Samples.AWS.EventBridge +{ + public class Program + { + private static async Task Main(string[] args) + { + var eventBridgeClient = GetAmazonEventBridgeClient(); +#if NETFRAMEWORK + SyncHelpers.StartEventBridgeTasks(eventBridgeClient); +#endif + await AsyncHelpers.StartEventBridgeTasks(eventBridgeClient); + } + + private static AmazonEventBridgeClient GetAmazonEventBridgeClient() + { + if (Environment.GetEnvironmentVariable("AWS_ACCESSKEY") is string accessKey && + Environment.GetEnvironmentVariable("AWS_SECRETKEY") is string secretKey && + Environment.GetEnvironmentVariable("AWS_REGION") is string region) + { + var awsCredentials = new BasicAWSCredentials(accessKey, secretKey); + return new AmazonEventBridgeClient(awsCredentials, Amazon.RegionEndpoint.GetBySystemName(region)); + } + else + { + var awsCredentials = new BasicAWSCredentials("x", "x"); + var eventBridgeConfig = new AmazonEventBridgeConfig { ServiceURL = "http://" + Host() }; + return new AmazonEventBridgeClient(awsCredentials, eventBridgeConfig); + } + } + + private static string Host() + { + return Environment.GetEnvironmentVariable("AWS_SDK_HOST") ?? "localhost:4566"; + } + } +} diff --git a/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Properties/launchSettings.json b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Properties/launchSettings.json new file mode 100644 index 000000000000..098764909fce --- /dev/null +++ b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Properties/launchSettings.json @@ -0,0 +1,21 @@ +{ + "profiles": { + "Samples.AWS.EventBridge": { + "commandName": "Project", + "environmentVariables": { + "COR_ENABLE_PROFILING": "1", + "COR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}", + "COR_PROFILER_PATH": "$(SolutionDir)shared\\bin\\monitoring-home\\win-x64\\Datadog.Trace.ClrProfiler.Native.dll", + + "CORECLR_ENABLE_PROFILING": "1", + "CORECLR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}", + "CORECLR_PROFILER_PATH": "$(SolutionDir)shared\\bin\\monitoring-home\\win-x64\\Datadog.Trace.ClrProfiler.Native.dll", + + "DD_DOTNET_TRACER_HOME": "$(SolutionDir)shared\\bin\\monitoring-home", + "DD_VERSION": "1.0.0" + }, + + "nativeDebugging": false + } + } +} \ No newline at end of file diff --git a/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Samples.AWS.EventBridge.csproj b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Samples.AWS.EventBridge.csproj new file mode 100644 index 000000000000..50b5e8375490 --- /dev/null +++ b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Samples.AWS.EventBridge.csproj @@ -0,0 +1,19 @@ + + + + 3.3.100 + + + false + false + + true + + + + + + + + + \ No newline at end of file diff --git a/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/SyncHelpers.cs b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/SyncHelpers.cs new file mode 100644 index 000000000000..2b01a4f4a3ae --- /dev/null +++ b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/SyncHelpers.cs @@ -0,0 +1,82 @@ +#if NETFRAMEWORK + +using System; +using System.Collections.Generic; +using System.Threading; +using Amazon.EventBridge; +using Amazon.EventBridge.Model; + +namespace Samples.AWS.EventBridge +{ + static class SyncHelpers + { + private const string EventBusName = "MyEventBus"; + private const string EventDetail = "{\"foo\":\"bar\"}"; + + public static void StartEventBridgeTasks(AmazonEventBridgeClient eventBridgeClient) + { + Console.WriteLine("Beginning Sync methods"); + using (var scope = SampleHelpers.CreateScope("sync-methods")) + { + CreateEventBus(eventBridgeClient, EventBusName); + + // Allow time for the resource to be ready + Thread.Sleep(1000); + + PutEvents(eventBridgeClient, EventBusName); + + DeleteEventBus(eventBridgeClient, EventBusName); + + // Allow time for the resource to be deleted + Thread.Sleep(1000); + } + } + + private static void PutEvents(AmazonEventBridgeClient eventBridgeClient, string eventBusName) + { + var request = new PutEventsRequest + { + Entries = new List + { + new PutEventsRequestEntry + { + Source = "my.app", + DetailType = "appEvent", + Detail = EventDetail, + EventBusName = eventBusName + } + } + }; + + var response = eventBridgeClient.PutEvents(request); + + Console.WriteLine($"PutEvents(PutEventsRequest) HTTP status code: {response.HttpStatusCode}"); + } + + private static void DeleteEventBus(AmazonEventBridgeClient eventBridgeClient, string eventBusName) + { + var deleteEventBusRequest = new DeleteEventBusRequest + { + Name = eventBusName + }; + + var response = eventBridgeClient.DeleteEventBus(deleteEventBusRequest); + + Console.WriteLine($"DeleteEventBus(DeleteEventBusRequest) HTTP status code: {response.HttpStatusCode}"); + } + + private static void CreateEventBus(AmazonEventBridgeClient eventBridgeClient, string eventBusName) + { + var createEventBusRequest = new CreateEventBusRequest + { + Name = eventBusName + }; + + var response = eventBridgeClient.CreateEventBus(createEventBusRequest); + + Console.WriteLine($"CreateEventBus(CreateEventBusRequest) HTTP status code: {response.HttpStatusCode}"); + } + } +} + +#endif From 134d1dd374432bedfad708f88dadc5b703ac1ed5 Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Fri, 27 Sep 2024 14:04:57 -0400 Subject: [PATCH 05/15] Autogenerated files --- .../build/PackageVersionsLatestMajors.g.props | 42 +++++ .../build/PackageVersionsLatestMinors.g.props | 126 +++++++++++++ .../PackageVersionsLatestSpecific.g.props | 126 +++++++++++++ tracer/build/supported_versions.json | 17 ++ ...ntegrationIdExtensions_EnumExtensions.g.cs | 5 +- .../InstrumentationDefinitions.g.cs | 7 + .../TagListGenerator/AwsEventBridgeTags.g.cs | 82 +++++++++ .../AwsEventBridgeV1Tags.g.cs | 82 +++++++++ ...MetricsTelemetryCollector_CountShared.g.cs | 7 +- .../MetricsTelemetryCollector_Count.g.cs | 166 +++++++++--------- ...MetricsTelemetryCollector_CountShared.g.cs | 7 +- ...ntegrationIdExtensions_EnumExtensions.g.cs | 5 +- .../InstrumentationDefinitions.g.cs | 7 + .../TagListGenerator/AwsEventBridgeTags.g.cs | 82 +++++++++ .../AwsEventBridgeV1Tags.g.cs | 82 +++++++++ ...MetricsTelemetryCollector_CountShared.g.cs | 7 +- .../MetricsTelemetryCollector_Count.g.cs | 166 +++++++++--------- ...MetricsTelemetryCollector_CountShared.g.cs | 7 +- ...ntegrationIdExtensions_EnumExtensions.g.cs | 5 +- .../InstrumentationDefinitions.g.cs | 7 + .../TagListGenerator/AwsEventBridgeTags.g.cs | 82 +++++++++ .../AwsEventBridgeV1Tags.g.cs | 82 +++++++++ ...MetricsTelemetryCollector_CountShared.g.cs | 7 +- .../MetricsTelemetryCollector_Count.g.cs | 166 +++++++++--------- ...MetricsTelemetryCollector_CountShared.g.cs | 7 +- ...ntegrationIdExtensions_EnumExtensions.g.cs | 5 +- .../InstrumentationDefinitions.g.cs | 7 + .../TagListGenerator/AwsEventBridgeTags.g.cs | 82 +++++++++ .../AwsEventBridgeV1Tags.g.cs | 82 +++++++++ ...MetricsTelemetryCollector_CountShared.g.cs | 7 +- .../MetricsTelemetryCollector_Count.g.cs | 166 +++++++++--------- ...MetricsTelemetryCollector_CountShared.g.cs | 7 +- .../PackageVersions.g.cs | 2 + .../PackageVersionsLatestMajors.g.cs | 31 ++++ .../PackageVersionsLatestMinors.g.cs | 45 +++++ .../PackageVersionsLatestSpecific.g.cs | 45 +++++ 36 files changed, 1510 insertions(+), 348 deletions(-) create mode 100644 tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs create mode 100644 tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs create mode 100644 tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs create mode 100644 tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs create mode 100644 tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs create mode 100644 tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs create mode 100644 tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs create mode 100644 tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs diff --git a/tracer/build/PackageVersionsLatestMajors.g.props b/tracer/build/PackageVersionsLatestMajors.g.props index b6dd756550b7..aab1593f3ee3 100644 --- a/tracer/build/PackageVersionsLatestMajors.g.props +++ b/tracer/build/PackageVersionsLatestMajors.g.props @@ -222,6 +222,48 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely All Samples.AWS.SimpleNotificationService + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.AWS.EventBridge + ApiVersion=2.29.0;RestoreRecursive=false;BuildProjectReferences=false net462 diff --git a/tracer/build/PackageVersionsLatestMinors.g.props b/tracer/build/PackageVersionsLatestMinors.g.props index ce50e2ce3b6e..3ae2cdae43ee 100644 --- a/tracer/build/PackageVersionsLatestMinors.g.props +++ b/tracer/build/PackageVersionsLatestMinors.g.props @@ -756,6 +756,132 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely All Samples.AWS.SimpleNotificationService + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.AWS.EventBridge + ApiVersion=2.0.2;RestoreRecursive=false;BuildProjectReferences=false net462 diff --git a/tracer/build/PackageVersionsLatestSpecific.g.props b/tracer/build/PackageVersionsLatestSpecific.g.props index c8240c74244a..5f7f4e8abc39 100644 --- a/tracer/build/PackageVersionsLatestSpecific.g.props +++ b/tracer/build/PackageVersionsLatestSpecific.g.props @@ -438,6 +438,132 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely All Samples.AWS.SimpleNotificationService + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.AWS.EventBridge + ApiVersion=2.0.2;RestoreRecursive=false;BuildProjectReferences=false net462 diff --git a/tracer/build/supported_versions.json b/tracer/build/supported_versions.json index eb03d47ac679..6a70f5bbad44 100644 --- a/tracer/build/supported_versions.json +++ b/tracer/build/supported_versions.json @@ -248,6 +248,23 @@ } ] }, + { + "integrationName": "AwsEventBridge", + "assemblyName": "AWSSDK.EventBridge", + "minAssemblyVersionInclusive": "3.3.0", + "maxAssemblyVersionInclusive": "3.65535.65535", + "packages": [ + { + "name": "AWSSDK.EventBridge", + "minVersionAvailableInclusive": "3.3.100", + "minVersionSupportedInclusive": "3.3.100", + "minVersionTestedInclusive": "3.3.102.16", + "maxVersionSupportedInclusive": "3.7.401.23", + "maxVersionAvailableInclusive": "3.7.401.23", + "maxVersionTestedInclusive": "3.7.401.23" + } + ] + }, { "integrationName": "AwsKinesis", "assemblyName": "AWSSDK.Kinesis", diff --git a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs index e8fde1e18cb0..aea373327f95 100644 --- a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs @@ -17,7 +17,7 @@ internal static partial class IntegrationIdExtensions /// The number of members in the enum. /// This is a non-distinct count of defined names. /// - public const int Length = 71; + public const int Length = 72; /// /// Returns the string representation of the value. @@ -58,6 +58,7 @@ public static string ToStringFast(this Datadog.Trace.Configuration.IntegrationId Datadog.Trace.Configuration.IntegrationId.AwsSdk => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSdk), Datadog.Trace.Configuration.IntegrationId.AwsSqs => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSqs), Datadog.Trace.Configuration.IntegrationId.AwsSns => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSns), + Datadog.Trace.Configuration.IntegrationId.AwsEventBridge => nameof(Datadog.Trace.Configuration.IntegrationId.AwsEventBridge), Datadog.Trace.Configuration.IntegrationId.AwsLambda => nameof(Datadog.Trace.Configuration.IntegrationId.AwsLambda), Datadog.Trace.Configuration.IntegrationId.ILogger => nameof(Datadog.Trace.Configuration.IntegrationId.ILogger), Datadog.Trace.Configuration.IntegrationId.Aerospike => nameof(Datadog.Trace.Configuration.IntegrationId.Aerospike), @@ -142,6 +143,7 @@ public static Datadog.Trace.Configuration.IntegrationId[] GetValues() Datadog.Trace.Configuration.IntegrationId.AwsSdk, Datadog.Trace.Configuration.IntegrationId.AwsSqs, Datadog.Trace.Configuration.IntegrationId.AwsSns, + Datadog.Trace.Configuration.IntegrationId.AwsEventBridge, Datadog.Trace.Configuration.IntegrationId.AwsLambda, Datadog.Trace.Configuration.IntegrationId.ILogger, Datadog.Trace.Configuration.IntegrationId.Aerospike, @@ -226,6 +228,7 @@ public static string[] GetNames() nameof(Datadog.Trace.Configuration.IntegrationId.AwsSdk), nameof(Datadog.Trace.Configuration.IntegrationId.AwsSqs), nameof(Datadog.Trace.Configuration.IntegrationId.AwsSns), + nameof(Datadog.Trace.Configuration.IntegrationId.AwsEventBridge), nameof(Datadog.Trace.Configuration.IntegrationId.AwsLambda), nameof(Datadog.Trace.Configuration.IntegrationId.ILogger), nameof(Datadog.Trace.Configuration.IntegrationId.Aerospike), diff --git a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs index 3503dc627f97..e2cc166171bb 100644 --- a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs @@ -100,6 +100,10 @@ static InstrumentationDefinitions() new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.DynamoDBv2"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.DynamoDBv2.AmazonDynamoDBClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("UpdateItem"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.DynamoDBv2.Model.UpdateItemResponse", "Amazon.DynamoDBv2.Model.UpdateItemRequest"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemIntegration"), 0, 1), new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.DynamoDBv2"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.DynamoDBv2.AmazonDynamoDBClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("UpdateItemAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.DynamoDBv2.Model.UpdateItemResponse]", "Amazon.DynamoDBv2.Model.UpdateItemRequest", "System.Threading.CancellationToken"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemAsyncIntegration"), 0, 1), + // AwsEventBridge + new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.EventBridge"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.EventBridge.AmazonEventBridgeClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutEvents"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.EventBridge.Model.PutEventsResponse", "Amazon.EventBridge.Model.PutEventsRequest"), 2, 3, 3, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsIntegration"), 0, 1), + new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.EventBridge"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.EventBridge.AmazonEventBridgeClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutEventsAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.EventBridge.Model.PutEventsResponse]", "Amazon.EventBridge.Model.PutEventsRequest", "System.Threading.CancellationToken"), 3, 3, 3, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsAsyncIntegration"), 0, 1), + // AwsKinesis new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.Kinesis"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.Kinesis.AmazonKinesisClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutRecord"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.Kinesis.Model.PutRecordResponse", "Amazon.Kinesis.Model.PutRecordRequest"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordIntegration"), 0, 1), new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.Kinesis"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.Kinesis.AmazonKinesisClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutRecordAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.Kinesis.Model.PutRecordResponse]", "Amazon.Kinesis.Model.PutRecordRequest", "System.Threading.CancellationToken"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordAsyncIntegration"), 0, 1), @@ -760,6 +764,9 @@ internal static bool IsInstrumentedAssembly(string assemblyName) or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemAsyncIntegration" => Datadog.Trace.Configuration.IntegrationId.AwsDynamoDb, + "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsIntegration" + or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsAsyncIntegration" + => Datadog.Trace.Configuration.IntegrationId.AwsEventBridge, "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordAsyncIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordsIntegration" diff --git a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs new file mode 100644 index 000000000000..0a9265e6afae --- /dev/null +++ b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs @@ -0,0 +1,82 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +// + +#nullable enable + +using Datadog.Trace.Processors; +using Datadog.Trace.Tagging; +using System; + +namespace Datadog.Trace.Tagging +{ + partial class AwsEventBridgeTags + { + // EventBusNameBytes = MessagePack.Serialize("eventbusname"); + private static ReadOnlySpan EventBusNameBytes => new byte[] { 172, 101, 118, 101, 110, 116, 98, 117, 115, 110, 97, 109, 101 }; + // SpanKindBytes = MessagePack.Serialize("span.kind"); + private static ReadOnlySpan SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 }; + + public override string? GetTag(string key) + { + return key switch + { + "eventbusname" => EventBusName, + "span.kind" => SpanKind, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "eventbusname": + EventBusName = value; + break; + case "span.kind": + Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeTags)); + break; + default: + base.SetTag(key, value); + break; + } + } + + public override void EnumerateTags(ref TProcessor processor) + { + if (EventBusName is not null) + { + processor.Process(new TagItem("eventbusname", EventBusName, EventBusNameBytes)); + } + + if (SpanKind is not null) + { + processor.Process(new TagItem("span.kind", SpanKind, SpanKindBytes)); + } + + base.EnumerateTags(ref processor); + } + + protected override void WriteAdditionalTags(System.Text.StringBuilder sb) + { + if (EventBusName is not null) + { + sb.Append("eventbusname (tag):") + .Append(EventBusName) + .Append(','); + } + + if (SpanKind is not null) + { + sb.Append("span.kind (tag):") + .Append(SpanKind) + .Append(','); + } + + base.WriteAdditionalTags(sb); + } + } +} diff --git a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs new file mode 100644 index 000000000000..b8ce8ca7a3fe --- /dev/null +++ b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs @@ -0,0 +1,82 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +// + +#nullable enable + +using Datadog.Trace.Processors; +using Datadog.Trace.Tagging; +using System; + +namespace Datadog.Trace.Tagging +{ + partial class AwsEventBridgeV1Tags + { + // PeerServiceBytes = MessagePack.Serialize("peer.service"); + private static ReadOnlySpan PeerServiceBytes => new byte[] { 172, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101 }; + // PeerServiceSourceBytes = MessagePack.Serialize("_dd.peer.service.source"); + private static ReadOnlySpan PeerServiceSourceBytes => new byte[] { 183, 95, 100, 100, 46, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101, 46, 115, 111, 117, 114, 99, 101 }; + + public override string? GetTag(string key) + { + return key switch + { + "peer.service" => PeerService, + "_dd.peer.service.source" => PeerServiceSource, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "peer.service": + PeerService = value; + break; + case "_dd.peer.service.source": + Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeV1Tags)); + break; + default: + base.SetTag(key, value); + break; + } + } + + public override void EnumerateTags(ref TProcessor processor) + { + if (PeerService is not null) + { + processor.Process(new TagItem("peer.service", PeerService, PeerServiceBytes)); + } + + if (PeerServiceSource is not null) + { + processor.Process(new TagItem("_dd.peer.service.source", PeerServiceSource, PeerServiceSourceBytes)); + } + + base.EnumerateTags(ref processor); + } + + protected override void WriteAdditionalTags(System.Text.StringBuilder sb) + { + if (PeerService is not null) + { + sb.Append("peer.service (tag):") + .Append(PeerService) + .Append(','); + } + + if (PeerServiceSource is not null) + { + sb.Append("_dd.peer.service.source (tag):") + .Append(PeerServiceSource) + .Append(','); + } + + base.WriteAdditionalTags(sb); + } + } +} diff --git a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs index 197dec868600..fcfd1e38ed4a 100644 --- a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class CiVisibilityMetricsTelemetryCollector { - private const int CountSharedLength = 228; + private const int CountSharedLength = 231; /// /// Creates the buffer for the values. @@ -122,6 +122,9 @@ private static AggregatedMetric[] GetCountSharedBuffer() new(new[] { "integration_name:awssns", "error_type:duck_typing" }), new(new[] { "integration_name:awssns", "error_type:invoker" }), new(new[] { "integration_name:awssns", "error_type:execution" }), + new(new[] { "integration_name:awseventbridge", "error_type:duck_typing" }), + new(new[] { "integration_name:awseventbridge", "error_type:invoker" }), + new(new[] { "integration_name:awseventbridge", "error_type:execution" }), new(new[] { "integration_name:ilogger", "error_type:duck_typing" }), new(new[] { "integration_name:ilogger", "error_type:invoker" }), new(new[] { "integration_name:ilogger", "error_type:execution" }), @@ -256,7 +259,7 @@ private static AggregatedMetric[] GetCountSharedBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountSharedEntryCounts { get; } - = new int[]{ 228, }; + = new int[]{ 231, }; public void RecordCountSharedIntegrationsError(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.InstrumentationError tag2, int increment = 1) { diff --git a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs index 3fe602d3854f..a19ce8c06dff 100644 --- a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class MetricsTelemetryCollector { - private const int CountLength = 563; + private const int CountLength = 565; /// /// Creates the buffer for the values. @@ -59,6 +59,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:awssdk" }), new(new[] { "integration_name:awssqs" }), new(new[] { "integration_name:awssns" }), + new(new[] { "integration_name:awseventbridge" }), new(new[] { "integration_name:ilogger" }), new(new[] { "integration_name:aerospike" }), new(new[] { "integration_name:azurefunctions" }), @@ -101,35 +102,35 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:sessiontimeout" }), new(new[] { "integration_name:datadogtracemanual" }), new(new[] { "integration_name:emailhtmlinjection" }), - // spans_finished, index = 80 + // spans_finished, index = 81 new(null), - // spans_enqueued_for_serialization, index = 81 + // spans_enqueued_for_serialization, index = 82 new(new[] { "reason:p0_keep" }), new(new[] { "reason:single_span_sampling" }), new(new[] { "reason:default" }), - // spans_dropped, index = 84 + // spans_dropped, index = 85 new(new[] { "reason:p0_drop" }), new(new[] { "reason:overfull_buffer" }), new(new[] { "reason:serialization_error" }), new(new[] { "reason:api_error" }), - // trace_segments_created, index = 88 + // trace_segments_created, index = 89 new(new[] { "new_continued:new" }), new(new[] { "new_continued:continued" }), - // trace_chunks_enqueued_for_serialization, index = 90 + // trace_chunks_enqueued_for_serialization, index = 91 new(new[] { "reason:p0_keep" }), new(new[] { "reason:default" }), - // trace_chunks_dropped, index = 92 + // trace_chunks_dropped, index = 93 new(new[] { "reason:p0_drop" }), new(new[] { "reason:overfull_buffer" }), new(new[] { "reason:serialization_error" }), new(new[] { "reason:api_error" }), - // trace_chunks_sent, index = 96 + // trace_chunks_sent, index = 97 new(null), - // trace_segments_closed, index = 97 + // trace_segments_closed, index = 98 new(null), - // trace_api.requests, index = 98 + // trace_api.requests, index = 99 new(null), - // trace_api.responses, index = 99 + // trace_api.responses, index = 100 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -152,26 +153,26 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // trace_api.errors, index = 121 + // trace_api.errors, index = 122 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // trace_partial_flush.count, index = 124 + // trace_partial_flush.count, index = 125 new(new[] { "reason:large_trace" }), new(new[] { "reason:single_span_ingestion" }), - // context_header_style.injected, index = 126 + // context_header_style.injected, index = 127 new(new[] { "header_style:tracecontext" }), new(new[] { "header_style:datadog" }), new(new[] { "header_style:b3multi" }), new(new[] { "header_style:b3single" }), - // context_header_style.extracted, index = 130 + // context_header_style.extracted, index = 131 new(new[] { "header_style:tracecontext" }), new(new[] { "header_style:datadog" }), new(new[] { "header_style:b3multi" }), new(new[] { "header_style:b3single" }), - // stats_api.requests, index = 134 + // stats_api.requests, index = 135 new(null), - // stats_api.responses, index = 135 + // stats_api.responses, index = 136 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -194,11 +195,11 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // stats_api.errors, index = 157 + // stats_api.errors, index = 158 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // otel.env.hiding, index = 160 + // otel.env.hiding, index = 161 new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_log_level" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_metrics_exporter" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_propagators" }), @@ -289,7 +290,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler_arg" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:unknown" }), - // otel.env.invalid, index = 250 + // otel.env.invalid, index = 251 new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_log_level" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_metrics_exporter" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_propagators" }), @@ -380,10 +381,10 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler_arg" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:unknown" }), - // telemetry_api.requests, index = 340 + // telemetry_api.requests, index = 341 new(new[] { "endpoint:agent" }), new(new[] { "endpoint:agentless" }), - // telemetry_api.responses, index = 342 + // telemetry_api.responses, index = 343 new(new[] { "endpoint:agent", "status_code:200" }), new(new[] { "endpoint:agent", "status_code:201" }), new(new[] { "endpoint:agent", "status_code:202" }), @@ -428,18 +429,18 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "endpoint:agentless", "status_code:503" }), new(new[] { "endpoint:agentless", "status_code:504" }), new(new[] { "endpoint:agentless", "status_code:5xx" }), - // telemetry_api.errors, index = 386 + // telemetry_api.errors, index = 387 new(new[] { "endpoint:agent", "type:timeout" }), new(new[] { "endpoint:agent", "type:network" }), new(new[] { "endpoint:agent", "type:status_code" }), new(new[] { "endpoint:agentless", "type:timeout" }), new(new[] { "endpoint:agentless", "type:network" }), new(new[] { "endpoint:agentless", "type:status_code" }), - // version_conflict_tracers_created, index = 392 + // version_conflict_tracers_created, index = 393 new(null), - // unsupported_custom_instrumentation_services, index = 393 + // unsupported_custom_instrumentation_services, index = 394 new(null), - // direct_log_logs, index = 394 + // direct_log_logs, index = 395 new(new[] { "integration_name:datadog" }), new(new[] { "integration_name:opentracing" }), new(new[] { "integration_name:ciapp" }), @@ -474,6 +475,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:awssdk" }), new(new[] { "integration_name:awssqs" }), new(new[] { "integration_name:awssns" }), + new(new[] { "integration_name:awseventbridge" }), new(new[] { "integration_name:ilogger" }), new(new[] { "integration_name:aerospike" }), new(new[] { "integration_name:azurefunctions" }), @@ -516,9 +518,9 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:sessiontimeout" }), new(new[] { "integration_name:datadogtracemanual" }), new(new[] { "integration_name:emailhtmlinjection" }), - // direct_log_api.requests, index = 470 + // direct_log_api.requests, index = 472 new(null), - // direct_log_api.responses, index = 471 + // direct_log_api.responses, index = 473 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -541,43 +543,43 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // direct_log_api.errors, index = 493 + // direct_log_api.errors, index = 495 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // waf.init, index = 496 + // waf.init, index = 498 new(null), - // waf.updates, index = 497 + // waf.updates, index = 499 new(null), - // waf.requests, index = 498 + // waf.requests, index = 500 new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:true", "request_blocked:false", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:true", "request_blocked:true", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:true", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:false", "request_excluded:true" }), - // waf.input_truncated, index = 503 + // waf.input_truncated, index = 505 new(new[] { "truncation_reason:string_too_long" }), new(new[] { "truncation_reason:list_or_map_too_large" }), new(new[] { "truncation_reason:object_too_deep" }), - // rasp.rule.eval, index = 506 + // rasp.rule.eval, index = 508 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // rasp.rule.match, index = 510 + // rasp.rule.match, index = 512 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // rasp.timeout, index = 514 + // rasp.timeout, index = 516 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // instrum.user_auth.missing_user_id, index = 518 + // instrum.user_auth.missing_user_id, index = 520 new(new[] { "framework:aspnetcore_identity" }), new(new[] { "framework:unknown" }), - // executed.source, index = 520 + // executed.source, index = 522 new(new[] { "source_type:http.request.body" }), new(new[] { "source_type:http.request.path" }), new(new[] { "source_type:http.request.parameter.name" }), @@ -592,9 +594,9 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "source_type:http.request.uri" }), new(new[] { "source_type:grpc.request.body" }), new(new[] { "source_type:sql.row.value" }), - // executed.propagation, index = 534 + // executed.propagation, index = 536 new(null), - // executed.sink, index = 535 + // executed.sink, index = 537 new(new[] { "vulnerability_type:none" }), new(new[] { "vulnerability_type:weak_cipher" }), new(new[] { "vulnerability_type:weak_hash" }), @@ -622,7 +624,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "vulnerability_type:directory_listing_leak" }), new(new[] { "vulnerability_type:session_timeout" }), new(new[] { "vulnerability_type:email_html_injection" }), - // request.tainted, index = 562 + // request.tainted, index = 564 new(null), }; @@ -632,7 +634,7 @@ private static AggregatedMetric[] GetCountBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountEntryCounts { get; } - = new int[]{ 4, 76, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 90, 90, 2, 44, 6, 1, 1, 76, 1, 22, 3, 1, 1, 5, 3, 4, 4, 4, 2, 14, 1, 27, 1, }; + = new int[]{ 4, 77, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 90, 90, 2, 44, 6, 1, 1, 77, 1, 22, 3, 1, 1, 5, 3, 4, 4, 4, 2, 14, 1, 27, 1, }; public void RecordCountLogCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.LogLevel tag, int increment = 1) { @@ -648,229 +650,229 @@ public void RecordCountSpanCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.In public void RecordCountSpanFinished(int increment = 1) { - Interlocked.Add(ref _buffer.Count[80], increment); + Interlocked.Add(ref _buffer.Count[81], increment); } public void RecordCountSpanEnqueuedForSerialization(Datadog.Trace.Telemetry.Metrics.MetricTags.SpanEnqueueReason tag, int increment = 1) { - var index = 81 + (int)tag; + var index = 82 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountSpanDropped(Datadog.Trace.Telemetry.Metrics.MetricTags.DropReason tag, int increment = 1) { - var index = 84 + (int)tag; + var index = 85 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceSegmentCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.TraceContinuation tag, int increment = 1) { - var index = 88 + (int)tag; + var index = 89 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkEnqueued(Datadog.Trace.Telemetry.Metrics.MetricTags.TraceChunkEnqueueReason tag, int increment = 1) { - var index = 90 + (int)tag; + var index = 91 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkDropped(Datadog.Trace.Telemetry.Metrics.MetricTags.DropReason tag, int increment = 1) { - var index = 92 + (int)tag; + var index = 93 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkSent(int increment = 1) { - Interlocked.Add(ref _buffer.Count[96], increment); + Interlocked.Add(ref _buffer.Count[97], increment); } public void RecordCountTraceSegmentsClosed(int increment = 1) { - Interlocked.Add(ref _buffer.Count[97], increment); + Interlocked.Add(ref _buffer.Count[98], increment); } public void RecordCountTraceApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[98], increment); + Interlocked.Add(ref _buffer.Count[99], increment); } public void RecordCountTraceApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 99 + (int)tag; + var index = 100 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 121 + (int)tag; + var index = 122 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTracePartialFlush(Datadog.Trace.Telemetry.Metrics.MetricTags.PartialFlushReason tag, int increment = 1) { - var index = 124 + (int)tag; + var index = 125 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountContextHeaderStyleInjected(Datadog.Trace.Telemetry.Metrics.MetricTags.ContextHeaderStyle tag, int increment = 1) { - var index = 126 + (int)tag; + var index = 127 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountContextHeaderStyleExtracted(Datadog.Trace.Telemetry.Metrics.MetricTags.ContextHeaderStyle tag, int increment = 1) { - var index = 130 + (int)tag; + var index = 131 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountStatsApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[134], increment); + Interlocked.Add(ref _buffer.Count[135], increment); } public void RecordCountStatsApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 135 + (int)tag; + var index = 136 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountStatsApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 157 + (int)tag; + var index = 158 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountOpenTelemetryConfigHiddenByDatadogConfig(Datadog.Trace.Telemetry.Metrics.MetricTags.DatadogConfiguration tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.OpenTelemetryConfiguration tag2, int increment = 1) { - var index = 160 + ((int)tag1 * 10) + (int)tag2; + var index = 161 + ((int)tag1 * 10) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountOpenTelemetryConfigInvalid(Datadog.Trace.Telemetry.Metrics.MetricTags.DatadogConfiguration tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.OpenTelemetryConfiguration tag2, int increment = 1) { - var index = 250 + ((int)tag1 * 10) + (int)tag2; + var index = 251 + ((int)tag1 * 10) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiRequests(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag, int increment = 1) { - var index = 340 + (int)tag; + var index = 341 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag2, int increment = 1) { - var index = 342 + ((int)tag1 * 22) + (int)tag2; + var index = 343 + ((int)tag1 * 22) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag2, int increment = 1) { - var index = 386 + ((int)tag1 * 3) + (int)tag2; + var index = 387 + ((int)tag1 * 3) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountVersionConflictTracerCreated(int increment = 1) { - Interlocked.Add(ref _buffer.Count[392], increment); + Interlocked.Add(ref _buffer.Count[393], increment); } public void RecordCountUnsupportedCustomInstrumentationServices(int increment = 1) { - Interlocked.Add(ref _buffer.Count[393], increment); + Interlocked.Add(ref _buffer.Count[394], increment); } public void RecordCountDirectLogLogs(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag, int increment = 1) { - var index = 394 + (int)tag; + var index = 395 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountDirectLogApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[470], increment); + Interlocked.Add(ref _buffer.Count[472], increment); } public void RecordCountDirectLogApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 471 + (int)tag; + var index = 473 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountDirectLogApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 493 + (int)tag; + var index = 495 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountWafInit(int increment = 1) { - Interlocked.Add(ref _buffer.Count[496], increment); + Interlocked.Add(ref _buffer.Count[498], increment); } public void RecordCountWafUpdates(int increment = 1) { - Interlocked.Add(ref _buffer.Count[497], increment); + Interlocked.Add(ref _buffer.Count[499], increment); } public void RecordCountWafRequests(Datadog.Trace.Telemetry.Metrics.MetricTags.WafAnalysis tag, int increment = 1) { - var index = 498 + (int)tag; + var index = 500 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountInputTruncated(Datadog.Trace.Telemetry.Metrics.MetricTags.TruncationReason tag, int increment = 1) { - var index = 503 + (int)tag; + var index = 505 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspRuleEval(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 506 + (int)tag; + var index = 508 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspRuleMatch(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 510 + (int)tag; + var index = 512 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspTimeout(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 514 + (int)tag; + var index = 516 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountMissingUserId(Datadog.Trace.Telemetry.Metrics.MetricTags.AuthenticationFramework tag, int increment = 1) { - var index = 518 + (int)tag; + var index = 520 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastExecutedSources(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSources tag, int increment = 1) { - var index = 520 + (int)tag; + var index = 522 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastExecutedPropagations(int increment = 1) { - Interlocked.Add(ref _buffer.Count[534], increment); + Interlocked.Add(ref _buffer.Count[536], increment); } public void RecordCountIastExecutedSinks(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks tag, int increment = 1) { - var index = 535 + (int)tag; + var index = 537 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastRequestTainted(int increment = 1) { - Interlocked.Add(ref _buffer.Count[562], increment); + Interlocked.Add(ref _buffer.Count[564], increment); } } \ No newline at end of file diff --git a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs index 92deade1cce5..2a54bea2390a 100644 --- a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class MetricsTelemetryCollector { - private const int CountSharedLength = 228; + private const int CountSharedLength = 231; /// /// Creates the buffer for the values. @@ -122,6 +122,9 @@ private static AggregatedMetric[] GetCountSharedBuffer() new(new[] { "integration_name:awssns", "error_type:duck_typing" }), new(new[] { "integration_name:awssns", "error_type:invoker" }), new(new[] { "integration_name:awssns", "error_type:execution" }), + new(new[] { "integration_name:awseventbridge", "error_type:duck_typing" }), + new(new[] { "integration_name:awseventbridge", "error_type:invoker" }), + new(new[] { "integration_name:awseventbridge", "error_type:execution" }), new(new[] { "integration_name:ilogger", "error_type:duck_typing" }), new(new[] { "integration_name:ilogger", "error_type:invoker" }), new(new[] { "integration_name:ilogger", "error_type:execution" }), @@ -256,7 +259,7 @@ private static AggregatedMetric[] GetCountSharedBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountSharedEntryCounts { get; } - = new int[]{ 228, }; + = new int[]{ 231, }; public void RecordCountSharedIntegrationsError(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.InstrumentationError tag2, int increment = 1) { diff --git a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs index e8fde1e18cb0..aea373327f95 100644 --- a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs @@ -17,7 +17,7 @@ internal static partial class IntegrationIdExtensions /// The number of members in the enum. /// This is a non-distinct count of defined names. /// - public const int Length = 71; + public const int Length = 72; /// /// Returns the string representation of the value. @@ -58,6 +58,7 @@ public static string ToStringFast(this Datadog.Trace.Configuration.IntegrationId Datadog.Trace.Configuration.IntegrationId.AwsSdk => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSdk), Datadog.Trace.Configuration.IntegrationId.AwsSqs => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSqs), Datadog.Trace.Configuration.IntegrationId.AwsSns => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSns), + Datadog.Trace.Configuration.IntegrationId.AwsEventBridge => nameof(Datadog.Trace.Configuration.IntegrationId.AwsEventBridge), Datadog.Trace.Configuration.IntegrationId.AwsLambda => nameof(Datadog.Trace.Configuration.IntegrationId.AwsLambda), Datadog.Trace.Configuration.IntegrationId.ILogger => nameof(Datadog.Trace.Configuration.IntegrationId.ILogger), Datadog.Trace.Configuration.IntegrationId.Aerospike => nameof(Datadog.Trace.Configuration.IntegrationId.Aerospike), @@ -142,6 +143,7 @@ public static Datadog.Trace.Configuration.IntegrationId[] GetValues() Datadog.Trace.Configuration.IntegrationId.AwsSdk, Datadog.Trace.Configuration.IntegrationId.AwsSqs, Datadog.Trace.Configuration.IntegrationId.AwsSns, + Datadog.Trace.Configuration.IntegrationId.AwsEventBridge, Datadog.Trace.Configuration.IntegrationId.AwsLambda, Datadog.Trace.Configuration.IntegrationId.ILogger, Datadog.Trace.Configuration.IntegrationId.Aerospike, @@ -226,6 +228,7 @@ public static string[] GetNames() nameof(Datadog.Trace.Configuration.IntegrationId.AwsSdk), nameof(Datadog.Trace.Configuration.IntegrationId.AwsSqs), nameof(Datadog.Trace.Configuration.IntegrationId.AwsSns), + nameof(Datadog.Trace.Configuration.IntegrationId.AwsEventBridge), nameof(Datadog.Trace.Configuration.IntegrationId.AwsLambda), nameof(Datadog.Trace.Configuration.IntegrationId.ILogger), nameof(Datadog.Trace.Configuration.IntegrationId.Aerospike), diff --git a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs index fd94b1c317b8..2fd5872fe642 100644 --- a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs @@ -99,6 +99,10 @@ static InstrumentationDefinitions() new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.DynamoDBv2"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.DynamoDBv2.AmazonDynamoDBClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("UpdateItem"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.DynamoDBv2.Model.UpdateItemResponse", "Amazon.DynamoDBv2.Model.UpdateItemRequest"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemIntegration"), 0, 1), new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.DynamoDBv2"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.DynamoDBv2.AmazonDynamoDBClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("UpdateItemAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.DynamoDBv2.Model.UpdateItemResponse]", "Amazon.DynamoDBv2.Model.UpdateItemRequest", "System.Threading.CancellationToken"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemAsyncIntegration"), 0, 1), + // AwsEventBridge + new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.EventBridge"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.EventBridge.AmazonEventBridgeClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutEvents"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.EventBridge.Model.PutEventsResponse", "Amazon.EventBridge.Model.PutEventsRequest"), 2, 3, 3, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsIntegration"), 0, 1), + new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.EventBridge"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.EventBridge.AmazonEventBridgeClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutEventsAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.EventBridge.Model.PutEventsResponse]", "Amazon.EventBridge.Model.PutEventsRequest", "System.Threading.CancellationToken"), 3, 3, 3, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsAsyncIntegration"), 0, 1), + // AwsKinesis new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.Kinesis"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.Kinesis.AmazonKinesisClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutRecord"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.Kinesis.Model.PutRecordResponse", "Amazon.Kinesis.Model.PutRecordRequest"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordIntegration"), 0, 1), new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.Kinesis"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.Kinesis.AmazonKinesisClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutRecordAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.Kinesis.Model.PutRecordResponse]", "Amazon.Kinesis.Model.PutRecordRequest", "System.Threading.CancellationToken"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordAsyncIntegration"), 0, 1), @@ -774,6 +778,9 @@ internal static bool IsInstrumentedAssembly(string assemblyName) or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemAsyncIntegration" => Datadog.Trace.Configuration.IntegrationId.AwsDynamoDb, + "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsIntegration" + or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsAsyncIntegration" + => Datadog.Trace.Configuration.IntegrationId.AwsEventBridge, "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordAsyncIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordsIntegration" diff --git a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs new file mode 100644 index 000000000000..0a9265e6afae --- /dev/null +++ b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs @@ -0,0 +1,82 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +// + +#nullable enable + +using Datadog.Trace.Processors; +using Datadog.Trace.Tagging; +using System; + +namespace Datadog.Trace.Tagging +{ + partial class AwsEventBridgeTags + { + // EventBusNameBytes = MessagePack.Serialize("eventbusname"); + private static ReadOnlySpan EventBusNameBytes => new byte[] { 172, 101, 118, 101, 110, 116, 98, 117, 115, 110, 97, 109, 101 }; + // SpanKindBytes = MessagePack.Serialize("span.kind"); + private static ReadOnlySpan SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 }; + + public override string? GetTag(string key) + { + return key switch + { + "eventbusname" => EventBusName, + "span.kind" => SpanKind, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "eventbusname": + EventBusName = value; + break; + case "span.kind": + Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeTags)); + break; + default: + base.SetTag(key, value); + break; + } + } + + public override void EnumerateTags(ref TProcessor processor) + { + if (EventBusName is not null) + { + processor.Process(new TagItem("eventbusname", EventBusName, EventBusNameBytes)); + } + + if (SpanKind is not null) + { + processor.Process(new TagItem("span.kind", SpanKind, SpanKindBytes)); + } + + base.EnumerateTags(ref processor); + } + + protected override void WriteAdditionalTags(System.Text.StringBuilder sb) + { + if (EventBusName is not null) + { + sb.Append("eventbusname (tag):") + .Append(EventBusName) + .Append(','); + } + + if (SpanKind is not null) + { + sb.Append("span.kind (tag):") + .Append(SpanKind) + .Append(','); + } + + base.WriteAdditionalTags(sb); + } + } +} diff --git a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs new file mode 100644 index 000000000000..b8ce8ca7a3fe --- /dev/null +++ b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs @@ -0,0 +1,82 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +// + +#nullable enable + +using Datadog.Trace.Processors; +using Datadog.Trace.Tagging; +using System; + +namespace Datadog.Trace.Tagging +{ + partial class AwsEventBridgeV1Tags + { + // PeerServiceBytes = MessagePack.Serialize("peer.service"); + private static ReadOnlySpan PeerServiceBytes => new byte[] { 172, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101 }; + // PeerServiceSourceBytes = MessagePack.Serialize("_dd.peer.service.source"); + private static ReadOnlySpan PeerServiceSourceBytes => new byte[] { 183, 95, 100, 100, 46, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101, 46, 115, 111, 117, 114, 99, 101 }; + + public override string? GetTag(string key) + { + return key switch + { + "peer.service" => PeerService, + "_dd.peer.service.source" => PeerServiceSource, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "peer.service": + PeerService = value; + break; + case "_dd.peer.service.source": + Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeV1Tags)); + break; + default: + base.SetTag(key, value); + break; + } + } + + public override void EnumerateTags(ref TProcessor processor) + { + if (PeerService is not null) + { + processor.Process(new TagItem("peer.service", PeerService, PeerServiceBytes)); + } + + if (PeerServiceSource is not null) + { + processor.Process(new TagItem("_dd.peer.service.source", PeerServiceSource, PeerServiceSourceBytes)); + } + + base.EnumerateTags(ref processor); + } + + protected override void WriteAdditionalTags(System.Text.StringBuilder sb) + { + if (PeerService is not null) + { + sb.Append("peer.service (tag):") + .Append(PeerService) + .Append(','); + } + + if (PeerServiceSource is not null) + { + sb.Append("_dd.peer.service.source (tag):") + .Append(PeerServiceSource) + .Append(','); + } + + base.WriteAdditionalTags(sb); + } + } +} diff --git a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs index 197dec868600..fcfd1e38ed4a 100644 --- a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class CiVisibilityMetricsTelemetryCollector { - private const int CountSharedLength = 228; + private const int CountSharedLength = 231; /// /// Creates the buffer for the values. @@ -122,6 +122,9 @@ private static AggregatedMetric[] GetCountSharedBuffer() new(new[] { "integration_name:awssns", "error_type:duck_typing" }), new(new[] { "integration_name:awssns", "error_type:invoker" }), new(new[] { "integration_name:awssns", "error_type:execution" }), + new(new[] { "integration_name:awseventbridge", "error_type:duck_typing" }), + new(new[] { "integration_name:awseventbridge", "error_type:invoker" }), + new(new[] { "integration_name:awseventbridge", "error_type:execution" }), new(new[] { "integration_name:ilogger", "error_type:duck_typing" }), new(new[] { "integration_name:ilogger", "error_type:invoker" }), new(new[] { "integration_name:ilogger", "error_type:execution" }), @@ -256,7 +259,7 @@ private static AggregatedMetric[] GetCountSharedBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountSharedEntryCounts { get; } - = new int[]{ 228, }; + = new int[]{ 231, }; public void RecordCountSharedIntegrationsError(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.InstrumentationError tag2, int increment = 1) { diff --git a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs index 3fe602d3854f..a19ce8c06dff 100644 --- a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class MetricsTelemetryCollector { - private const int CountLength = 563; + private const int CountLength = 565; /// /// Creates the buffer for the values. @@ -59,6 +59,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:awssdk" }), new(new[] { "integration_name:awssqs" }), new(new[] { "integration_name:awssns" }), + new(new[] { "integration_name:awseventbridge" }), new(new[] { "integration_name:ilogger" }), new(new[] { "integration_name:aerospike" }), new(new[] { "integration_name:azurefunctions" }), @@ -101,35 +102,35 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:sessiontimeout" }), new(new[] { "integration_name:datadogtracemanual" }), new(new[] { "integration_name:emailhtmlinjection" }), - // spans_finished, index = 80 + // spans_finished, index = 81 new(null), - // spans_enqueued_for_serialization, index = 81 + // spans_enqueued_for_serialization, index = 82 new(new[] { "reason:p0_keep" }), new(new[] { "reason:single_span_sampling" }), new(new[] { "reason:default" }), - // spans_dropped, index = 84 + // spans_dropped, index = 85 new(new[] { "reason:p0_drop" }), new(new[] { "reason:overfull_buffer" }), new(new[] { "reason:serialization_error" }), new(new[] { "reason:api_error" }), - // trace_segments_created, index = 88 + // trace_segments_created, index = 89 new(new[] { "new_continued:new" }), new(new[] { "new_continued:continued" }), - // trace_chunks_enqueued_for_serialization, index = 90 + // trace_chunks_enqueued_for_serialization, index = 91 new(new[] { "reason:p0_keep" }), new(new[] { "reason:default" }), - // trace_chunks_dropped, index = 92 + // trace_chunks_dropped, index = 93 new(new[] { "reason:p0_drop" }), new(new[] { "reason:overfull_buffer" }), new(new[] { "reason:serialization_error" }), new(new[] { "reason:api_error" }), - // trace_chunks_sent, index = 96 + // trace_chunks_sent, index = 97 new(null), - // trace_segments_closed, index = 97 + // trace_segments_closed, index = 98 new(null), - // trace_api.requests, index = 98 + // trace_api.requests, index = 99 new(null), - // trace_api.responses, index = 99 + // trace_api.responses, index = 100 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -152,26 +153,26 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // trace_api.errors, index = 121 + // trace_api.errors, index = 122 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // trace_partial_flush.count, index = 124 + // trace_partial_flush.count, index = 125 new(new[] { "reason:large_trace" }), new(new[] { "reason:single_span_ingestion" }), - // context_header_style.injected, index = 126 + // context_header_style.injected, index = 127 new(new[] { "header_style:tracecontext" }), new(new[] { "header_style:datadog" }), new(new[] { "header_style:b3multi" }), new(new[] { "header_style:b3single" }), - // context_header_style.extracted, index = 130 + // context_header_style.extracted, index = 131 new(new[] { "header_style:tracecontext" }), new(new[] { "header_style:datadog" }), new(new[] { "header_style:b3multi" }), new(new[] { "header_style:b3single" }), - // stats_api.requests, index = 134 + // stats_api.requests, index = 135 new(null), - // stats_api.responses, index = 135 + // stats_api.responses, index = 136 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -194,11 +195,11 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // stats_api.errors, index = 157 + // stats_api.errors, index = 158 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // otel.env.hiding, index = 160 + // otel.env.hiding, index = 161 new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_log_level" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_metrics_exporter" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_propagators" }), @@ -289,7 +290,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler_arg" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:unknown" }), - // otel.env.invalid, index = 250 + // otel.env.invalid, index = 251 new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_log_level" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_metrics_exporter" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_propagators" }), @@ -380,10 +381,10 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler_arg" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:unknown" }), - // telemetry_api.requests, index = 340 + // telemetry_api.requests, index = 341 new(new[] { "endpoint:agent" }), new(new[] { "endpoint:agentless" }), - // telemetry_api.responses, index = 342 + // telemetry_api.responses, index = 343 new(new[] { "endpoint:agent", "status_code:200" }), new(new[] { "endpoint:agent", "status_code:201" }), new(new[] { "endpoint:agent", "status_code:202" }), @@ -428,18 +429,18 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "endpoint:agentless", "status_code:503" }), new(new[] { "endpoint:agentless", "status_code:504" }), new(new[] { "endpoint:agentless", "status_code:5xx" }), - // telemetry_api.errors, index = 386 + // telemetry_api.errors, index = 387 new(new[] { "endpoint:agent", "type:timeout" }), new(new[] { "endpoint:agent", "type:network" }), new(new[] { "endpoint:agent", "type:status_code" }), new(new[] { "endpoint:agentless", "type:timeout" }), new(new[] { "endpoint:agentless", "type:network" }), new(new[] { "endpoint:agentless", "type:status_code" }), - // version_conflict_tracers_created, index = 392 + // version_conflict_tracers_created, index = 393 new(null), - // unsupported_custom_instrumentation_services, index = 393 + // unsupported_custom_instrumentation_services, index = 394 new(null), - // direct_log_logs, index = 394 + // direct_log_logs, index = 395 new(new[] { "integration_name:datadog" }), new(new[] { "integration_name:opentracing" }), new(new[] { "integration_name:ciapp" }), @@ -474,6 +475,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:awssdk" }), new(new[] { "integration_name:awssqs" }), new(new[] { "integration_name:awssns" }), + new(new[] { "integration_name:awseventbridge" }), new(new[] { "integration_name:ilogger" }), new(new[] { "integration_name:aerospike" }), new(new[] { "integration_name:azurefunctions" }), @@ -516,9 +518,9 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:sessiontimeout" }), new(new[] { "integration_name:datadogtracemanual" }), new(new[] { "integration_name:emailhtmlinjection" }), - // direct_log_api.requests, index = 470 + // direct_log_api.requests, index = 472 new(null), - // direct_log_api.responses, index = 471 + // direct_log_api.responses, index = 473 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -541,43 +543,43 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // direct_log_api.errors, index = 493 + // direct_log_api.errors, index = 495 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // waf.init, index = 496 + // waf.init, index = 498 new(null), - // waf.updates, index = 497 + // waf.updates, index = 499 new(null), - // waf.requests, index = 498 + // waf.requests, index = 500 new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:true", "request_blocked:false", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:true", "request_blocked:true", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:true", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:false", "request_excluded:true" }), - // waf.input_truncated, index = 503 + // waf.input_truncated, index = 505 new(new[] { "truncation_reason:string_too_long" }), new(new[] { "truncation_reason:list_or_map_too_large" }), new(new[] { "truncation_reason:object_too_deep" }), - // rasp.rule.eval, index = 506 + // rasp.rule.eval, index = 508 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // rasp.rule.match, index = 510 + // rasp.rule.match, index = 512 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // rasp.timeout, index = 514 + // rasp.timeout, index = 516 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // instrum.user_auth.missing_user_id, index = 518 + // instrum.user_auth.missing_user_id, index = 520 new(new[] { "framework:aspnetcore_identity" }), new(new[] { "framework:unknown" }), - // executed.source, index = 520 + // executed.source, index = 522 new(new[] { "source_type:http.request.body" }), new(new[] { "source_type:http.request.path" }), new(new[] { "source_type:http.request.parameter.name" }), @@ -592,9 +594,9 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "source_type:http.request.uri" }), new(new[] { "source_type:grpc.request.body" }), new(new[] { "source_type:sql.row.value" }), - // executed.propagation, index = 534 + // executed.propagation, index = 536 new(null), - // executed.sink, index = 535 + // executed.sink, index = 537 new(new[] { "vulnerability_type:none" }), new(new[] { "vulnerability_type:weak_cipher" }), new(new[] { "vulnerability_type:weak_hash" }), @@ -622,7 +624,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "vulnerability_type:directory_listing_leak" }), new(new[] { "vulnerability_type:session_timeout" }), new(new[] { "vulnerability_type:email_html_injection" }), - // request.tainted, index = 562 + // request.tainted, index = 564 new(null), }; @@ -632,7 +634,7 @@ private static AggregatedMetric[] GetCountBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountEntryCounts { get; } - = new int[]{ 4, 76, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 90, 90, 2, 44, 6, 1, 1, 76, 1, 22, 3, 1, 1, 5, 3, 4, 4, 4, 2, 14, 1, 27, 1, }; + = new int[]{ 4, 77, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 90, 90, 2, 44, 6, 1, 1, 77, 1, 22, 3, 1, 1, 5, 3, 4, 4, 4, 2, 14, 1, 27, 1, }; public void RecordCountLogCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.LogLevel tag, int increment = 1) { @@ -648,229 +650,229 @@ public void RecordCountSpanCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.In public void RecordCountSpanFinished(int increment = 1) { - Interlocked.Add(ref _buffer.Count[80], increment); + Interlocked.Add(ref _buffer.Count[81], increment); } public void RecordCountSpanEnqueuedForSerialization(Datadog.Trace.Telemetry.Metrics.MetricTags.SpanEnqueueReason tag, int increment = 1) { - var index = 81 + (int)tag; + var index = 82 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountSpanDropped(Datadog.Trace.Telemetry.Metrics.MetricTags.DropReason tag, int increment = 1) { - var index = 84 + (int)tag; + var index = 85 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceSegmentCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.TraceContinuation tag, int increment = 1) { - var index = 88 + (int)tag; + var index = 89 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkEnqueued(Datadog.Trace.Telemetry.Metrics.MetricTags.TraceChunkEnqueueReason tag, int increment = 1) { - var index = 90 + (int)tag; + var index = 91 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkDropped(Datadog.Trace.Telemetry.Metrics.MetricTags.DropReason tag, int increment = 1) { - var index = 92 + (int)tag; + var index = 93 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkSent(int increment = 1) { - Interlocked.Add(ref _buffer.Count[96], increment); + Interlocked.Add(ref _buffer.Count[97], increment); } public void RecordCountTraceSegmentsClosed(int increment = 1) { - Interlocked.Add(ref _buffer.Count[97], increment); + Interlocked.Add(ref _buffer.Count[98], increment); } public void RecordCountTraceApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[98], increment); + Interlocked.Add(ref _buffer.Count[99], increment); } public void RecordCountTraceApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 99 + (int)tag; + var index = 100 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 121 + (int)tag; + var index = 122 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTracePartialFlush(Datadog.Trace.Telemetry.Metrics.MetricTags.PartialFlushReason tag, int increment = 1) { - var index = 124 + (int)tag; + var index = 125 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountContextHeaderStyleInjected(Datadog.Trace.Telemetry.Metrics.MetricTags.ContextHeaderStyle tag, int increment = 1) { - var index = 126 + (int)tag; + var index = 127 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountContextHeaderStyleExtracted(Datadog.Trace.Telemetry.Metrics.MetricTags.ContextHeaderStyle tag, int increment = 1) { - var index = 130 + (int)tag; + var index = 131 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountStatsApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[134], increment); + Interlocked.Add(ref _buffer.Count[135], increment); } public void RecordCountStatsApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 135 + (int)tag; + var index = 136 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountStatsApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 157 + (int)tag; + var index = 158 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountOpenTelemetryConfigHiddenByDatadogConfig(Datadog.Trace.Telemetry.Metrics.MetricTags.DatadogConfiguration tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.OpenTelemetryConfiguration tag2, int increment = 1) { - var index = 160 + ((int)tag1 * 10) + (int)tag2; + var index = 161 + ((int)tag1 * 10) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountOpenTelemetryConfigInvalid(Datadog.Trace.Telemetry.Metrics.MetricTags.DatadogConfiguration tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.OpenTelemetryConfiguration tag2, int increment = 1) { - var index = 250 + ((int)tag1 * 10) + (int)tag2; + var index = 251 + ((int)tag1 * 10) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiRequests(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag, int increment = 1) { - var index = 340 + (int)tag; + var index = 341 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag2, int increment = 1) { - var index = 342 + ((int)tag1 * 22) + (int)tag2; + var index = 343 + ((int)tag1 * 22) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag2, int increment = 1) { - var index = 386 + ((int)tag1 * 3) + (int)tag2; + var index = 387 + ((int)tag1 * 3) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountVersionConflictTracerCreated(int increment = 1) { - Interlocked.Add(ref _buffer.Count[392], increment); + Interlocked.Add(ref _buffer.Count[393], increment); } public void RecordCountUnsupportedCustomInstrumentationServices(int increment = 1) { - Interlocked.Add(ref _buffer.Count[393], increment); + Interlocked.Add(ref _buffer.Count[394], increment); } public void RecordCountDirectLogLogs(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag, int increment = 1) { - var index = 394 + (int)tag; + var index = 395 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountDirectLogApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[470], increment); + Interlocked.Add(ref _buffer.Count[472], increment); } public void RecordCountDirectLogApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 471 + (int)tag; + var index = 473 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountDirectLogApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 493 + (int)tag; + var index = 495 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountWafInit(int increment = 1) { - Interlocked.Add(ref _buffer.Count[496], increment); + Interlocked.Add(ref _buffer.Count[498], increment); } public void RecordCountWafUpdates(int increment = 1) { - Interlocked.Add(ref _buffer.Count[497], increment); + Interlocked.Add(ref _buffer.Count[499], increment); } public void RecordCountWafRequests(Datadog.Trace.Telemetry.Metrics.MetricTags.WafAnalysis tag, int increment = 1) { - var index = 498 + (int)tag; + var index = 500 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountInputTruncated(Datadog.Trace.Telemetry.Metrics.MetricTags.TruncationReason tag, int increment = 1) { - var index = 503 + (int)tag; + var index = 505 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspRuleEval(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 506 + (int)tag; + var index = 508 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspRuleMatch(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 510 + (int)tag; + var index = 512 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspTimeout(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 514 + (int)tag; + var index = 516 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountMissingUserId(Datadog.Trace.Telemetry.Metrics.MetricTags.AuthenticationFramework tag, int increment = 1) { - var index = 518 + (int)tag; + var index = 520 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastExecutedSources(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSources tag, int increment = 1) { - var index = 520 + (int)tag; + var index = 522 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastExecutedPropagations(int increment = 1) { - Interlocked.Add(ref _buffer.Count[534], increment); + Interlocked.Add(ref _buffer.Count[536], increment); } public void RecordCountIastExecutedSinks(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks tag, int increment = 1) { - var index = 535 + (int)tag; + var index = 537 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastRequestTainted(int increment = 1) { - Interlocked.Add(ref _buffer.Count[562], increment); + Interlocked.Add(ref _buffer.Count[564], increment); } } \ No newline at end of file diff --git a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs index 92deade1cce5..2a54bea2390a 100644 --- a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class MetricsTelemetryCollector { - private const int CountSharedLength = 228; + private const int CountSharedLength = 231; /// /// Creates the buffer for the values. @@ -122,6 +122,9 @@ private static AggregatedMetric[] GetCountSharedBuffer() new(new[] { "integration_name:awssns", "error_type:duck_typing" }), new(new[] { "integration_name:awssns", "error_type:invoker" }), new(new[] { "integration_name:awssns", "error_type:execution" }), + new(new[] { "integration_name:awseventbridge", "error_type:duck_typing" }), + new(new[] { "integration_name:awseventbridge", "error_type:invoker" }), + new(new[] { "integration_name:awseventbridge", "error_type:execution" }), new(new[] { "integration_name:ilogger", "error_type:duck_typing" }), new(new[] { "integration_name:ilogger", "error_type:invoker" }), new(new[] { "integration_name:ilogger", "error_type:execution" }), @@ -256,7 +259,7 @@ private static AggregatedMetric[] GetCountSharedBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountSharedEntryCounts { get; } - = new int[]{ 228, }; + = new int[]{ 231, }; public void RecordCountSharedIntegrationsError(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.InstrumentationError tag2, int increment = 1) { diff --git a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs index e8fde1e18cb0..aea373327f95 100644 --- a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs @@ -17,7 +17,7 @@ internal static partial class IntegrationIdExtensions /// The number of members in the enum. /// This is a non-distinct count of defined names. /// - public const int Length = 71; + public const int Length = 72; /// /// Returns the string representation of the value. @@ -58,6 +58,7 @@ public static string ToStringFast(this Datadog.Trace.Configuration.IntegrationId Datadog.Trace.Configuration.IntegrationId.AwsSdk => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSdk), Datadog.Trace.Configuration.IntegrationId.AwsSqs => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSqs), Datadog.Trace.Configuration.IntegrationId.AwsSns => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSns), + Datadog.Trace.Configuration.IntegrationId.AwsEventBridge => nameof(Datadog.Trace.Configuration.IntegrationId.AwsEventBridge), Datadog.Trace.Configuration.IntegrationId.AwsLambda => nameof(Datadog.Trace.Configuration.IntegrationId.AwsLambda), Datadog.Trace.Configuration.IntegrationId.ILogger => nameof(Datadog.Trace.Configuration.IntegrationId.ILogger), Datadog.Trace.Configuration.IntegrationId.Aerospike => nameof(Datadog.Trace.Configuration.IntegrationId.Aerospike), @@ -142,6 +143,7 @@ public static Datadog.Trace.Configuration.IntegrationId[] GetValues() Datadog.Trace.Configuration.IntegrationId.AwsSdk, Datadog.Trace.Configuration.IntegrationId.AwsSqs, Datadog.Trace.Configuration.IntegrationId.AwsSns, + Datadog.Trace.Configuration.IntegrationId.AwsEventBridge, Datadog.Trace.Configuration.IntegrationId.AwsLambda, Datadog.Trace.Configuration.IntegrationId.ILogger, Datadog.Trace.Configuration.IntegrationId.Aerospike, @@ -226,6 +228,7 @@ public static string[] GetNames() nameof(Datadog.Trace.Configuration.IntegrationId.AwsSdk), nameof(Datadog.Trace.Configuration.IntegrationId.AwsSqs), nameof(Datadog.Trace.Configuration.IntegrationId.AwsSns), + nameof(Datadog.Trace.Configuration.IntegrationId.AwsEventBridge), nameof(Datadog.Trace.Configuration.IntegrationId.AwsLambda), nameof(Datadog.Trace.Configuration.IntegrationId.ILogger), nameof(Datadog.Trace.Configuration.IntegrationId.Aerospike), diff --git a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs index 50bec2f96cca..a9e3c61fc3a6 100644 --- a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs @@ -99,6 +99,10 @@ static InstrumentationDefinitions() new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.DynamoDBv2"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.DynamoDBv2.AmazonDynamoDBClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("UpdateItem"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.DynamoDBv2.Model.UpdateItemResponse", "Amazon.DynamoDBv2.Model.UpdateItemRequest"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemIntegration"), 0, 1), new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.DynamoDBv2"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.DynamoDBv2.AmazonDynamoDBClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("UpdateItemAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.DynamoDBv2.Model.UpdateItemResponse]", "Amazon.DynamoDBv2.Model.UpdateItemRequest", "System.Threading.CancellationToken"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemAsyncIntegration"), 0, 1), + // AwsEventBridge + new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.EventBridge"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.EventBridge.AmazonEventBridgeClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutEvents"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.EventBridge.Model.PutEventsResponse", "Amazon.EventBridge.Model.PutEventsRequest"), 2, 3, 3, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsIntegration"), 0, 1), + new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.EventBridge"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.EventBridge.AmazonEventBridgeClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutEventsAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.EventBridge.Model.PutEventsResponse]", "Amazon.EventBridge.Model.PutEventsRequest", "System.Threading.CancellationToken"), 3, 3, 3, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsAsyncIntegration"), 0, 1), + // AwsKinesis new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.Kinesis"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.Kinesis.AmazonKinesisClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutRecord"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.Kinesis.Model.PutRecordResponse", "Amazon.Kinesis.Model.PutRecordRequest"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordIntegration"), 0, 1), new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.Kinesis"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.Kinesis.AmazonKinesisClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutRecordAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.Kinesis.Model.PutRecordResponse]", "Amazon.Kinesis.Model.PutRecordRequest", "System.Threading.CancellationToken"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordAsyncIntegration"), 0, 1), @@ -768,6 +772,9 @@ internal static bool IsInstrumentedAssembly(string assemblyName) or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemAsyncIntegration" => Datadog.Trace.Configuration.IntegrationId.AwsDynamoDb, + "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsIntegration" + or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsAsyncIntegration" + => Datadog.Trace.Configuration.IntegrationId.AwsEventBridge, "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordAsyncIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordsIntegration" diff --git a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs new file mode 100644 index 000000000000..0a9265e6afae --- /dev/null +++ b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs @@ -0,0 +1,82 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +// + +#nullable enable + +using Datadog.Trace.Processors; +using Datadog.Trace.Tagging; +using System; + +namespace Datadog.Trace.Tagging +{ + partial class AwsEventBridgeTags + { + // EventBusNameBytes = MessagePack.Serialize("eventbusname"); + private static ReadOnlySpan EventBusNameBytes => new byte[] { 172, 101, 118, 101, 110, 116, 98, 117, 115, 110, 97, 109, 101 }; + // SpanKindBytes = MessagePack.Serialize("span.kind"); + private static ReadOnlySpan SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 }; + + public override string? GetTag(string key) + { + return key switch + { + "eventbusname" => EventBusName, + "span.kind" => SpanKind, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "eventbusname": + EventBusName = value; + break; + case "span.kind": + Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeTags)); + break; + default: + base.SetTag(key, value); + break; + } + } + + public override void EnumerateTags(ref TProcessor processor) + { + if (EventBusName is not null) + { + processor.Process(new TagItem("eventbusname", EventBusName, EventBusNameBytes)); + } + + if (SpanKind is not null) + { + processor.Process(new TagItem("span.kind", SpanKind, SpanKindBytes)); + } + + base.EnumerateTags(ref processor); + } + + protected override void WriteAdditionalTags(System.Text.StringBuilder sb) + { + if (EventBusName is not null) + { + sb.Append("eventbusname (tag):") + .Append(EventBusName) + .Append(','); + } + + if (SpanKind is not null) + { + sb.Append("span.kind (tag):") + .Append(SpanKind) + .Append(','); + } + + base.WriteAdditionalTags(sb); + } + } +} diff --git a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs new file mode 100644 index 000000000000..b8ce8ca7a3fe --- /dev/null +++ b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs @@ -0,0 +1,82 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +// + +#nullable enable + +using Datadog.Trace.Processors; +using Datadog.Trace.Tagging; +using System; + +namespace Datadog.Trace.Tagging +{ + partial class AwsEventBridgeV1Tags + { + // PeerServiceBytes = MessagePack.Serialize("peer.service"); + private static ReadOnlySpan PeerServiceBytes => new byte[] { 172, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101 }; + // PeerServiceSourceBytes = MessagePack.Serialize("_dd.peer.service.source"); + private static ReadOnlySpan PeerServiceSourceBytes => new byte[] { 183, 95, 100, 100, 46, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101, 46, 115, 111, 117, 114, 99, 101 }; + + public override string? GetTag(string key) + { + return key switch + { + "peer.service" => PeerService, + "_dd.peer.service.source" => PeerServiceSource, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "peer.service": + PeerService = value; + break; + case "_dd.peer.service.source": + Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeV1Tags)); + break; + default: + base.SetTag(key, value); + break; + } + } + + public override void EnumerateTags(ref TProcessor processor) + { + if (PeerService is not null) + { + processor.Process(new TagItem("peer.service", PeerService, PeerServiceBytes)); + } + + if (PeerServiceSource is not null) + { + processor.Process(new TagItem("_dd.peer.service.source", PeerServiceSource, PeerServiceSourceBytes)); + } + + base.EnumerateTags(ref processor); + } + + protected override void WriteAdditionalTags(System.Text.StringBuilder sb) + { + if (PeerService is not null) + { + sb.Append("peer.service (tag):") + .Append(PeerService) + .Append(','); + } + + if (PeerServiceSource is not null) + { + sb.Append("_dd.peer.service.source (tag):") + .Append(PeerServiceSource) + .Append(','); + } + + base.WriteAdditionalTags(sb); + } + } +} diff --git a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs index 197dec868600..fcfd1e38ed4a 100644 --- a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class CiVisibilityMetricsTelemetryCollector { - private const int CountSharedLength = 228; + private const int CountSharedLength = 231; /// /// Creates the buffer for the values. @@ -122,6 +122,9 @@ private static AggregatedMetric[] GetCountSharedBuffer() new(new[] { "integration_name:awssns", "error_type:duck_typing" }), new(new[] { "integration_name:awssns", "error_type:invoker" }), new(new[] { "integration_name:awssns", "error_type:execution" }), + new(new[] { "integration_name:awseventbridge", "error_type:duck_typing" }), + new(new[] { "integration_name:awseventbridge", "error_type:invoker" }), + new(new[] { "integration_name:awseventbridge", "error_type:execution" }), new(new[] { "integration_name:ilogger", "error_type:duck_typing" }), new(new[] { "integration_name:ilogger", "error_type:invoker" }), new(new[] { "integration_name:ilogger", "error_type:execution" }), @@ -256,7 +259,7 @@ private static AggregatedMetric[] GetCountSharedBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountSharedEntryCounts { get; } - = new int[]{ 228, }; + = new int[]{ 231, }; public void RecordCountSharedIntegrationsError(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.InstrumentationError tag2, int increment = 1) { diff --git a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs index 3fe602d3854f..a19ce8c06dff 100644 --- a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class MetricsTelemetryCollector { - private const int CountLength = 563; + private const int CountLength = 565; /// /// Creates the buffer for the values. @@ -59,6 +59,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:awssdk" }), new(new[] { "integration_name:awssqs" }), new(new[] { "integration_name:awssns" }), + new(new[] { "integration_name:awseventbridge" }), new(new[] { "integration_name:ilogger" }), new(new[] { "integration_name:aerospike" }), new(new[] { "integration_name:azurefunctions" }), @@ -101,35 +102,35 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:sessiontimeout" }), new(new[] { "integration_name:datadogtracemanual" }), new(new[] { "integration_name:emailhtmlinjection" }), - // spans_finished, index = 80 + // spans_finished, index = 81 new(null), - // spans_enqueued_for_serialization, index = 81 + // spans_enqueued_for_serialization, index = 82 new(new[] { "reason:p0_keep" }), new(new[] { "reason:single_span_sampling" }), new(new[] { "reason:default" }), - // spans_dropped, index = 84 + // spans_dropped, index = 85 new(new[] { "reason:p0_drop" }), new(new[] { "reason:overfull_buffer" }), new(new[] { "reason:serialization_error" }), new(new[] { "reason:api_error" }), - // trace_segments_created, index = 88 + // trace_segments_created, index = 89 new(new[] { "new_continued:new" }), new(new[] { "new_continued:continued" }), - // trace_chunks_enqueued_for_serialization, index = 90 + // trace_chunks_enqueued_for_serialization, index = 91 new(new[] { "reason:p0_keep" }), new(new[] { "reason:default" }), - // trace_chunks_dropped, index = 92 + // trace_chunks_dropped, index = 93 new(new[] { "reason:p0_drop" }), new(new[] { "reason:overfull_buffer" }), new(new[] { "reason:serialization_error" }), new(new[] { "reason:api_error" }), - // trace_chunks_sent, index = 96 + // trace_chunks_sent, index = 97 new(null), - // trace_segments_closed, index = 97 + // trace_segments_closed, index = 98 new(null), - // trace_api.requests, index = 98 + // trace_api.requests, index = 99 new(null), - // trace_api.responses, index = 99 + // trace_api.responses, index = 100 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -152,26 +153,26 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // trace_api.errors, index = 121 + // trace_api.errors, index = 122 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // trace_partial_flush.count, index = 124 + // trace_partial_flush.count, index = 125 new(new[] { "reason:large_trace" }), new(new[] { "reason:single_span_ingestion" }), - // context_header_style.injected, index = 126 + // context_header_style.injected, index = 127 new(new[] { "header_style:tracecontext" }), new(new[] { "header_style:datadog" }), new(new[] { "header_style:b3multi" }), new(new[] { "header_style:b3single" }), - // context_header_style.extracted, index = 130 + // context_header_style.extracted, index = 131 new(new[] { "header_style:tracecontext" }), new(new[] { "header_style:datadog" }), new(new[] { "header_style:b3multi" }), new(new[] { "header_style:b3single" }), - // stats_api.requests, index = 134 + // stats_api.requests, index = 135 new(null), - // stats_api.responses, index = 135 + // stats_api.responses, index = 136 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -194,11 +195,11 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // stats_api.errors, index = 157 + // stats_api.errors, index = 158 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // otel.env.hiding, index = 160 + // otel.env.hiding, index = 161 new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_log_level" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_metrics_exporter" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_propagators" }), @@ -289,7 +290,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler_arg" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:unknown" }), - // otel.env.invalid, index = 250 + // otel.env.invalid, index = 251 new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_log_level" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_metrics_exporter" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_propagators" }), @@ -380,10 +381,10 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler_arg" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:unknown" }), - // telemetry_api.requests, index = 340 + // telemetry_api.requests, index = 341 new(new[] { "endpoint:agent" }), new(new[] { "endpoint:agentless" }), - // telemetry_api.responses, index = 342 + // telemetry_api.responses, index = 343 new(new[] { "endpoint:agent", "status_code:200" }), new(new[] { "endpoint:agent", "status_code:201" }), new(new[] { "endpoint:agent", "status_code:202" }), @@ -428,18 +429,18 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "endpoint:agentless", "status_code:503" }), new(new[] { "endpoint:agentless", "status_code:504" }), new(new[] { "endpoint:agentless", "status_code:5xx" }), - // telemetry_api.errors, index = 386 + // telemetry_api.errors, index = 387 new(new[] { "endpoint:agent", "type:timeout" }), new(new[] { "endpoint:agent", "type:network" }), new(new[] { "endpoint:agent", "type:status_code" }), new(new[] { "endpoint:agentless", "type:timeout" }), new(new[] { "endpoint:agentless", "type:network" }), new(new[] { "endpoint:agentless", "type:status_code" }), - // version_conflict_tracers_created, index = 392 + // version_conflict_tracers_created, index = 393 new(null), - // unsupported_custom_instrumentation_services, index = 393 + // unsupported_custom_instrumentation_services, index = 394 new(null), - // direct_log_logs, index = 394 + // direct_log_logs, index = 395 new(new[] { "integration_name:datadog" }), new(new[] { "integration_name:opentracing" }), new(new[] { "integration_name:ciapp" }), @@ -474,6 +475,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:awssdk" }), new(new[] { "integration_name:awssqs" }), new(new[] { "integration_name:awssns" }), + new(new[] { "integration_name:awseventbridge" }), new(new[] { "integration_name:ilogger" }), new(new[] { "integration_name:aerospike" }), new(new[] { "integration_name:azurefunctions" }), @@ -516,9 +518,9 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:sessiontimeout" }), new(new[] { "integration_name:datadogtracemanual" }), new(new[] { "integration_name:emailhtmlinjection" }), - // direct_log_api.requests, index = 470 + // direct_log_api.requests, index = 472 new(null), - // direct_log_api.responses, index = 471 + // direct_log_api.responses, index = 473 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -541,43 +543,43 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // direct_log_api.errors, index = 493 + // direct_log_api.errors, index = 495 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // waf.init, index = 496 + // waf.init, index = 498 new(null), - // waf.updates, index = 497 + // waf.updates, index = 499 new(null), - // waf.requests, index = 498 + // waf.requests, index = 500 new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:true", "request_blocked:false", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:true", "request_blocked:true", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:true", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:false", "request_excluded:true" }), - // waf.input_truncated, index = 503 + // waf.input_truncated, index = 505 new(new[] { "truncation_reason:string_too_long" }), new(new[] { "truncation_reason:list_or_map_too_large" }), new(new[] { "truncation_reason:object_too_deep" }), - // rasp.rule.eval, index = 506 + // rasp.rule.eval, index = 508 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // rasp.rule.match, index = 510 + // rasp.rule.match, index = 512 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // rasp.timeout, index = 514 + // rasp.timeout, index = 516 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // instrum.user_auth.missing_user_id, index = 518 + // instrum.user_auth.missing_user_id, index = 520 new(new[] { "framework:aspnetcore_identity" }), new(new[] { "framework:unknown" }), - // executed.source, index = 520 + // executed.source, index = 522 new(new[] { "source_type:http.request.body" }), new(new[] { "source_type:http.request.path" }), new(new[] { "source_type:http.request.parameter.name" }), @@ -592,9 +594,9 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "source_type:http.request.uri" }), new(new[] { "source_type:grpc.request.body" }), new(new[] { "source_type:sql.row.value" }), - // executed.propagation, index = 534 + // executed.propagation, index = 536 new(null), - // executed.sink, index = 535 + // executed.sink, index = 537 new(new[] { "vulnerability_type:none" }), new(new[] { "vulnerability_type:weak_cipher" }), new(new[] { "vulnerability_type:weak_hash" }), @@ -622,7 +624,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "vulnerability_type:directory_listing_leak" }), new(new[] { "vulnerability_type:session_timeout" }), new(new[] { "vulnerability_type:email_html_injection" }), - // request.tainted, index = 562 + // request.tainted, index = 564 new(null), }; @@ -632,7 +634,7 @@ private static AggregatedMetric[] GetCountBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountEntryCounts { get; } - = new int[]{ 4, 76, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 90, 90, 2, 44, 6, 1, 1, 76, 1, 22, 3, 1, 1, 5, 3, 4, 4, 4, 2, 14, 1, 27, 1, }; + = new int[]{ 4, 77, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 90, 90, 2, 44, 6, 1, 1, 77, 1, 22, 3, 1, 1, 5, 3, 4, 4, 4, 2, 14, 1, 27, 1, }; public void RecordCountLogCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.LogLevel tag, int increment = 1) { @@ -648,229 +650,229 @@ public void RecordCountSpanCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.In public void RecordCountSpanFinished(int increment = 1) { - Interlocked.Add(ref _buffer.Count[80], increment); + Interlocked.Add(ref _buffer.Count[81], increment); } public void RecordCountSpanEnqueuedForSerialization(Datadog.Trace.Telemetry.Metrics.MetricTags.SpanEnqueueReason tag, int increment = 1) { - var index = 81 + (int)tag; + var index = 82 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountSpanDropped(Datadog.Trace.Telemetry.Metrics.MetricTags.DropReason tag, int increment = 1) { - var index = 84 + (int)tag; + var index = 85 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceSegmentCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.TraceContinuation tag, int increment = 1) { - var index = 88 + (int)tag; + var index = 89 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkEnqueued(Datadog.Trace.Telemetry.Metrics.MetricTags.TraceChunkEnqueueReason tag, int increment = 1) { - var index = 90 + (int)tag; + var index = 91 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkDropped(Datadog.Trace.Telemetry.Metrics.MetricTags.DropReason tag, int increment = 1) { - var index = 92 + (int)tag; + var index = 93 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkSent(int increment = 1) { - Interlocked.Add(ref _buffer.Count[96], increment); + Interlocked.Add(ref _buffer.Count[97], increment); } public void RecordCountTraceSegmentsClosed(int increment = 1) { - Interlocked.Add(ref _buffer.Count[97], increment); + Interlocked.Add(ref _buffer.Count[98], increment); } public void RecordCountTraceApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[98], increment); + Interlocked.Add(ref _buffer.Count[99], increment); } public void RecordCountTraceApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 99 + (int)tag; + var index = 100 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 121 + (int)tag; + var index = 122 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTracePartialFlush(Datadog.Trace.Telemetry.Metrics.MetricTags.PartialFlushReason tag, int increment = 1) { - var index = 124 + (int)tag; + var index = 125 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountContextHeaderStyleInjected(Datadog.Trace.Telemetry.Metrics.MetricTags.ContextHeaderStyle tag, int increment = 1) { - var index = 126 + (int)tag; + var index = 127 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountContextHeaderStyleExtracted(Datadog.Trace.Telemetry.Metrics.MetricTags.ContextHeaderStyle tag, int increment = 1) { - var index = 130 + (int)tag; + var index = 131 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountStatsApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[134], increment); + Interlocked.Add(ref _buffer.Count[135], increment); } public void RecordCountStatsApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 135 + (int)tag; + var index = 136 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountStatsApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 157 + (int)tag; + var index = 158 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountOpenTelemetryConfigHiddenByDatadogConfig(Datadog.Trace.Telemetry.Metrics.MetricTags.DatadogConfiguration tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.OpenTelemetryConfiguration tag2, int increment = 1) { - var index = 160 + ((int)tag1 * 10) + (int)tag2; + var index = 161 + ((int)tag1 * 10) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountOpenTelemetryConfigInvalid(Datadog.Trace.Telemetry.Metrics.MetricTags.DatadogConfiguration tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.OpenTelemetryConfiguration tag2, int increment = 1) { - var index = 250 + ((int)tag1 * 10) + (int)tag2; + var index = 251 + ((int)tag1 * 10) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiRequests(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag, int increment = 1) { - var index = 340 + (int)tag; + var index = 341 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag2, int increment = 1) { - var index = 342 + ((int)tag1 * 22) + (int)tag2; + var index = 343 + ((int)tag1 * 22) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag2, int increment = 1) { - var index = 386 + ((int)tag1 * 3) + (int)tag2; + var index = 387 + ((int)tag1 * 3) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountVersionConflictTracerCreated(int increment = 1) { - Interlocked.Add(ref _buffer.Count[392], increment); + Interlocked.Add(ref _buffer.Count[393], increment); } public void RecordCountUnsupportedCustomInstrumentationServices(int increment = 1) { - Interlocked.Add(ref _buffer.Count[393], increment); + Interlocked.Add(ref _buffer.Count[394], increment); } public void RecordCountDirectLogLogs(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag, int increment = 1) { - var index = 394 + (int)tag; + var index = 395 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountDirectLogApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[470], increment); + Interlocked.Add(ref _buffer.Count[472], increment); } public void RecordCountDirectLogApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 471 + (int)tag; + var index = 473 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountDirectLogApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 493 + (int)tag; + var index = 495 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountWafInit(int increment = 1) { - Interlocked.Add(ref _buffer.Count[496], increment); + Interlocked.Add(ref _buffer.Count[498], increment); } public void RecordCountWafUpdates(int increment = 1) { - Interlocked.Add(ref _buffer.Count[497], increment); + Interlocked.Add(ref _buffer.Count[499], increment); } public void RecordCountWafRequests(Datadog.Trace.Telemetry.Metrics.MetricTags.WafAnalysis tag, int increment = 1) { - var index = 498 + (int)tag; + var index = 500 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountInputTruncated(Datadog.Trace.Telemetry.Metrics.MetricTags.TruncationReason tag, int increment = 1) { - var index = 503 + (int)tag; + var index = 505 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspRuleEval(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 506 + (int)tag; + var index = 508 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspRuleMatch(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 510 + (int)tag; + var index = 512 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspTimeout(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 514 + (int)tag; + var index = 516 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountMissingUserId(Datadog.Trace.Telemetry.Metrics.MetricTags.AuthenticationFramework tag, int increment = 1) { - var index = 518 + (int)tag; + var index = 520 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastExecutedSources(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSources tag, int increment = 1) { - var index = 520 + (int)tag; + var index = 522 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastExecutedPropagations(int increment = 1) { - Interlocked.Add(ref _buffer.Count[534], increment); + Interlocked.Add(ref _buffer.Count[536], increment); } public void RecordCountIastExecutedSinks(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks tag, int increment = 1) { - var index = 535 + (int)tag; + var index = 537 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastRequestTainted(int increment = 1) { - Interlocked.Add(ref _buffer.Count[562], increment); + Interlocked.Add(ref _buffer.Count[564], increment); } } \ No newline at end of file diff --git a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs index 92deade1cce5..2a54bea2390a 100644 --- a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class MetricsTelemetryCollector { - private const int CountSharedLength = 228; + private const int CountSharedLength = 231; /// /// Creates the buffer for the values. @@ -122,6 +122,9 @@ private static AggregatedMetric[] GetCountSharedBuffer() new(new[] { "integration_name:awssns", "error_type:duck_typing" }), new(new[] { "integration_name:awssns", "error_type:invoker" }), new(new[] { "integration_name:awssns", "error_type:execution" }), + new(new[] { "integration_name:awseventbridge", "error_type:duck_typing" }), + new(new[] { "integration_name:awseventbridge", "error_type:invoker" }), + new(new[] { "integration_name:awseventbridge", "error_type:execution" }), new(new[] { "integration_name:ilogger", "error_type:duck_typing" }), new(new[] { "integration_name:ilogger", "error_type:invoker" }), new(new[] { "integration_name:ilogger", "error_type:execution" }), @@ -256,7 +259,7 @@ private static AggregatedMetric[] GetCountSharedBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountSharedEntryCounts { get; } - = new int[]{ 228, }; + = new int[]{ 231, }; public void RecordCountSharedIntegrationsError(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.InstrumentationError tag2, int increment = 1) { diff --git a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs index e8fde1e18cb0..aea373327f95 100644 --- a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/EnumExtensionsGenerator/IntegrationIdExtensions_EnumExtensions.g.cs @@ -17,7 +17,7 @@ internal static partial class IntegrationIdExtensions /// The number of members in the enum. /// This is a non-distinct count of defined names. /// - public const int Length = 71; + public const int Length = 72; /// /// Returns the string representation of the value. @@ -58,6 +58,7 @@ public static string ToStringFast(this Datadog.Trace.Configuration.IntegrationId Datadog.Trace.Configuration.IntegrationId.AwsSdk => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSdk), Datadog.Trace.Configuration.IntegrationId.AwsSqs => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSqs), Datadog.Trace.Configuration.IntegrationId.AwsSns => nameof(Datadog.Trace.Configuration.IntegrationId.AwsSns), + Datadog.Trace.Configuration.IntegrationId.AwsEventBridge => nameof(Datadog.Trace.Configuration.IntegrationId.AwsEventBridge), Datadog.Trace.Configuration.IntegrationId.AwsLambda => nameof(Datadog.Trace.Configuration.IntegrationId.AwsLambda), Datadog.Trace.Configuration.IntegrationId.ILogger => nameof(Datadog.Trace.Configuration.IntegrationId.ILogger), Datadog.Trace.Configuration.IntegrationId.Aerospike => nameof(Datadog.Trace.Configuration.IntegrationId.Aerospike), @@ -142,6 +143,7 @@ public static Datadog.Trace.Configuration.IntegrationId[] GetValues() Datadog.Trace.Configuration.IntegrationId.AwsSdk, Datadog.Trace.Configuration.IntegrationId.AwsSqs, Datadog.Trace.Configuration.IntegrationId.AwsSns, + Datadog.Trace.Configuration.IntegrationId.AwsEventBridge, Datadog.Trace.Configuration.IntegrationId.AwsLambda, Datadog.Trace.Configuration.IntegrationId.ILogger, Datadog.Trace.Configuration.IntegrationId.Aerospike, @@ -226,6 +228,7 @@ public static string[] GetNames() nameof(Datadog.Trace.Configuration.IntegrationId.AwsSdk), nameof(Datadog.Trace.Configuration.IntegrationId.AwsSqs), nameof(Datadog.Trace.Configuration.IntegrationId.AwsSns), + nameof(Datadog.Trace.Configuration.IntegrationId.AwsEventBridge), nameof(Datadog.Trace.Configuration.IntegrationId.AwsLambda), nameof(Datadog.Trace.Configuration.IntegrationId.ILogger), nameof(Datadog.Trace.Configuration.IntegrationId.Aerospike), diff --git a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs index 50bec2f96cca..a9e3c61fc3a6 100644 --- a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs @@ -99,6 +99,10 @@ static InstrumentationDefinitions() new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.DynamoDBv2"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.DynamoDBv2.AmazonDynamoDBClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("UpdateItem"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.DynamoDBv2.Model.UpdateItemResponse", "Amazon.DynamoDBv2.Model.UpdateItemRequest"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemIntegration"), 0, 1), new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.DynamoDBv2"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.DynamoDBv2.AmazonDynamoDBClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("UpdateItemAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.DynamoDBv2.Model.UpdateItemResponse]", "Amazon.DynamoDBv2.Model.UpdateItemRequest", "System.Threading.CancellationToken"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemAsyncIntegration"), 0, 1), + // AwsEventBridge + new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.EventBridge"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.EventBridge.AmazonEventBridgeClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutEvents"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.EventBridge.Model.PutEventsResponse", "Amazon.EventBridge.Model.PutEventsRequest"), 2, 3, 3, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsIntegration"), 0, 1), + new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.EventBridge"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.EventBridge.AmazonEventBridgeClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutEventsAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.EventBridge.Model.PutEventsResponse]", "Amazon.EventBridge.Model.PutEventsRequest", "System.Threading.CancellationToken"), 3, 3, 3, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsAsyncIntegration"), 0, 1), + // AwsKinesis new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.Kinesis"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.Kinesis.AmazonKinesisClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutRecord"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Amazon.Kinesis.Model.PutRecordResponse", "Amazon.Kinesis.Model.PutRecordRequest"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordIntegration"), 0, 1), new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AWSSDK.Kinesis"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Amazon.Kinesis.AmazonKinesisClient"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PutRecordAsync"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Threading.Tasks.Task`1[Amazon.Kinesis.Model.PutRecordResponse]", "Amazon.Kinesis.Model.PutRecordRequest", "System.Threading.CancellationToken"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordAsyncIntegration"), 0, 1), @@ -768,6 +772,9 @@ internal static bool IsInstrumentedAssembly(string assemblyName) or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.DynamoDb.UpdateItemAsyncIntegration" => Datadog.Trace.Configuration.IntegrationId.AwsDynamoDb, + "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsIntegration" + or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge.PutEventsAsyncIntegration" + => Datadog.Trace.Configuration.IntegrationId.AwsEventBridge, "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordAsyncIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.Kinesis.PutRecordsIntegration" diff --git a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs new file mode 100644 index 000000000000..0a9265e6afae --- /dev/null +++ b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs @@ -0,0 +1,82 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +// + +#nullable enable + +using Datadog.Trace.Processors; +using Datadog.Trace.Tagging; +using System; + +namespace Datadog.Trace.Tagging +{ + partial class AwsEventBridgeTags + { + // EventBusNameBytes = MessagePack.Serialize("eventbusname"); + private static ReadOnlySpan EventBusNameBytes => new byte[] { 172, 101, 118, 101, 110, 116, 98, 117, 115, 110, 97, 109, 101 }; + // SpanKindBytes = MessagePack.Serialize("span.kind"); + private static ReadOnlySpan SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 }; + + public override string? GetTag(string key) + { + return key switch + { + "eventbusname" => EventBusName, + "span.kind" => SpanKind, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "eventbusname": + EventBusName = value; + break; + case "span.kind": + Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeTags)); + break; + default: + base.SetTag(key, value); + break; + } + } + + public override void EnumerateTags(ref TProcessor processor) + { + if (EventBusName is not null) + { + processor.Process(new TagItem("eventbusname", EventBusName, EventBusNameBytes)); + } + + if (SpanKind is not null) + { + processor.Process(new TagItem("span.kind", SpanKind, SpanKindBytes)); + } + + base.EnumerateTags(ref processor); + } + + protected override void WriteAdditionalTags(System.Text.StringBuilder sb) + { + if (EventBusName is not null) + { + sb.Append("eventbusname (tag):") + .Append(EventBusName) + .Append(','); + } + + if (SpanKind is not null) + { + sb.Append("span.kind (tag):") + .Append(SpanKind) + .Append(','); + } + + base.WriteAdditionalTags(sb); + } + } +} diff --git a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs new file mode 100644 index 000000000000..b8ce8ca7a3fe --- /dev/null +++ b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeV1Tags.g.cs @@ -0,0 +1,82 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// +// + +#nullable enable + +using Datadog.Trace.Processors; +using Datadog.Trace.Tagging; +using System; + +namespace Datadog.Trace.Tagging +{ + partial class AwsEventBridgeV1Tags + { + // PeerServiceBytes = MessagePack.Serialize("peer.service"); + private static ReadOnlySpan PeerServiceBytes => new byte[] { 172, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101 }; + // PeerServiceSourceBytes = MessagePack.Serialize("_dd.peer.service.source"); + private static ReadOnlySpan PeerServiceSourceBytes => new byte[] { 183, 95, 100, 100, 46, 112, 101, 101, 114, 46, 115, 101, 114, 118, 105, 99, 101, 46, 115, 111, 117, 114, 99, 101 }; + + public override string? GetTag(string key) + { + return key switch + { + "peer.service" => PeerService, + "_dd.peer.service.source" => PeerServiceSource, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "peer.service": + PeerService = value; + break; + case "_dd.peer.service.source": + Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeV1Tags)); + break; + default: + base.SetTag(key, value); + break; + } + } + + public override void EnumerateTags(ref TProcessor processor) + { + if (PeerService is not null) + { + processor.Process(new TagItem("peer.service", PeerService, PeerServiceBytes)); + } + + if (PeerServiceSource is not null) + { + processor.Process(new TagItem("_dd.peer.service.source", PeerServiceSource, PeerServiceSourceBytes)); + } + + base.EnumerateTags(ref processor); + } + + protected override void WriteAdditionalTags(System.Text.StringBuilder sb) + { + if (PeerService is not null) + { + sb.Append("peer.service (tag):") + .Append(PeerService) + .Append(','); + } + + if (PeerServiceSource is not null) + { + sb.Append("_dd.peer.service.source (tag):") + .Append(PeerServiceSource) + .Append(','); + } + + base.WriteAdditionalTags(sb); + } + } +} diff --git a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs index 197dec868600..fcfd1e38ed4a 100644 --- a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/CiVisibilityMetricsTelemetryCollector_CountShared.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class CiVisibilityMetricsTelemetryCollector { - private const int CountSharedLength = 228; + private const int CountSharedLength = 231; /// /// Creates the buffer for the values. @@ -122,6 +122,9 @@ private static AggregatedMetric[] GetCountSharedBuffer() new(new[] { "integration_name:awssns", "error_type:duck_typing" }), new(new[] { "integration_name:awssns", "error_type:invoker" }), new(new[] { "integration_name:awssns", "error_type:execution" }), + new(new[] { "integration_name:awseventbridge", "error_type:duck_typing" }), + new(new[] { "integration_name:awseventbridge", "error_type:invoker" }), + new(new[] { "integration_name:awseventbridge", "error_type:execution" }), new(new[] { "integration_name:ilogger", "error_type:duck_typing" }), new(new[] { "integration_name:ilogger", "error_type:invoker" }), new(new[] { "integration_name:ilogger", "error_type:execution" }), @@ -256,7 +259,7 @@ private static AggregatedMetric[] GetCountSharedBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountSharedEntryCounts { get; } - = new int[]{ 228, }; + = new int[]{ 231, }; public void RecordCountSharedIntegrationsError(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.InstrumentationError tag2, int increment = 1) { diff --git a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs index 3fe602d3854f..a19ce8c06dff 100644 --- a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_Count.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class MetricsTelemetryCollector { - private const int CountLength = 563; + private const int CountLength = 565; /// /// Creates the buffer for the values. @@ -59,6 +59,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:awssdk" }), new(new[] { "integration_name:awssqs" }), new(new[] { "integration_name:awssns" }), + new(new[] { "integration_name:awseventbridge" }), new(new[] { "integration_name:ilogger" }), new(new[] { "integration_name:aerospike" }), new(new[] { "integration_name:azurefunctions" }), @@ -101,35 +102,35 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:sessiontimeout" }), new(new[] { "integration_name:datadogtracemanual" }), new(new[] { "integration_name:emailhtmlinjection" }), - // spans_finished, index = 80 + // spans_finished, index = 81 new(null), - // spans_enqueued_for_serialization, index = 81 + // spans_enqueued_for_serialization, index = 82 new(new[] { "reason:p0_keep" }), new(new[] { "reason:single_span_sampling" }), new(new[] { "reason:default" }), - // spans_dropped, index = 84 + // spans_dropped, index = 85 new(new[] { "reason:p0_drop" }), new(new[] { "reason:overfull_buffer" }), new(new[] { "reason:serialization_error" }), new(new[] { "reason:api_error" }), - // trace_segments_created, index = 88 + // trace_segments_created, index = 89 new(new[] { "new_continued:new" }), new(new[] { "new_continued:continued" }), - // trace_chunks_enqueued_for_serialization, index = 90 + // trace_chunks_enqueued_for_serialization, index = 91 new(new[] { "reason:p0_keep" }), new(new[] { "reason:default" }), - // trace_chunks_dropped, index = 92 + // trace_chunks_dropped, index = 93 new(new[] { "reason:p0_drop" }), new(new[] { "reason:overfull_buffer" }), new(new[] { "reason:serialization_error" }), new(new[] { "reason:api_error" }), - // trace_chunks_sent, index = 96 + // trace_chunks_sent, index = 97 new(null), - // trace_segments_closed, index = 97 + // trace_segments_closed, index = 98 new(null), - // trace_api.requests, index = 98 + // trace_api.requests, index = 99 new(null), - // trace_api.responses, index = 99 + // trace_api.responses, index = 100 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -152,26 +153,26 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // trace_api.errors, index = 121 + // trace_api.errors, index = 122 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // trace_partial_flush.count, index = 124 + // trace_partial_flush.count, index = 125 new(new[] { "reason:large_trace" }), new(new[] { "reason:single_span_ingestion" }), - // context_header_style.injected, index = 126 + // context_header_style.injected, index = 127 new(new[] { "header_style:tracecontext" }), new(new[] { "header_style:datadog" }), new(new[] { "header_style:b3multi" }), new(new[] { "header_style:b3single" }), - // context_header_style.extracted, index = 130 + // context_header_style.extracted, index = 131 new(new[] { "header_style:tracecontext" }), new(new[] { "header_style:datadog" }), new(new[] { "header_style:b3multi" }), new(new[] { "header_style:b3single" }), - // stats_api.requests, index = 134 + // stats_api.requests, index = 135 new(null), - // stats_api.responses, index = 135 + // stats_api.responses, index = 136 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -194,11 +195,11 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // stats_api.errors, index = 157 + // stats_api.errors, index = 158 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // otel.env.hiding, index = 160 + // otel.env.hiding, index = 161 new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_log_level" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_metrics_exporter" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_propagators" }), @@ -289,7 +290,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler_arg" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:unknown" }), - // otel.env.invalid, index = 250 + // otel.env.invalid, index = 251 new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_log_level" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_metrics_exporter" }), new(new[] { "config_datadog:dd_trace_debug", "config_opentelemetry:otel_propagators" }), @@ -380,10 +381,10 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:otel_traces_sampler_arg" }), new(new[] { "config_datadog:unknown", "config_opentelemetry:unknown" }), - // telemetry_api.requests, index = 340 + // telemetry_api.requests, index = 341 new(new[] { "endpoint:agent" }), new(new[] { "endpoint:agentless" }), - // telemetry_api.responses, index = 342 + // telemetry_api.responses, index = 343 new(new[] { "endpoint:agent", "status_code:200" }), new(new[] { "endpoint:agent", "status_code:201" }), new(new[] { "endpoint:agent", "status_code:202" }), @@ -428,18 +429,18 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "endpoint:agentless", "status_code:503" }), new(new[] { "endpoint:agentless", "status_code:504" }), new(new[] { "endpoint:agentless", "status_code:5xx" }), - // telemetry_api.errors, index = 386 + // telemetry_api.errors, index = 387 new(new[] { "endpoint:agent", "type:timeout" }), new(new[] { "endpoint:agent", "type:network" }), new(new[] { "endpoint:agent", "type:status_code" }), new(new[] { "endpoint:agentless", "type:timeout" }), new(new[] { "endpoint:agentless", "type:network" }), new(new[] { "endpoint:agentless", "type:status_code" }), - // version_conflict_tracers_created, index = 392 + // version_conflict_tracers_created, index = 393 new(null), - // unsupported_custom_instrumentation_services, index = 393 + // unsupported_custom_instrumentation_services, index = 394 new(null), - // direct_log_logs, index = 394 + // direct_log_logs, index = 395 new(new[] { "integration_name:datadog" }), new(new[] { "integration_name:opentracing" }), new(new[] { "integration_name:ciapp" }), @@ -474,6 +475,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:awssdk" }), new(new[] { "integration_name:awssqs" }), new(new[] { "integration_name:awssns" }), + new(new[] { "integration_name:awseventbridge" }), new(new[] { "integration_name:ilogger" }), new(new[] { "integration_name:aerospike" }), new(new[] { "integration_name:azurefunctions" }), @@ -516,9 +518,9 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "integration_name:sessiontimeout" }), new(new[] { "integration_name:datadogtracemanual" }), new(new[] { "integration_name:emailhtmlinjection" }), - // direct_log_api.requests, index = 470 + // direct_log_api.requests, index = 472 new(null), - // direct_log_api.responses, index = 471 + // direct_log_api.responses, index = 473 new(new[] { "status_code:200" }), new(new[] { "status_code:201" }), new(new[] { "status_code:202" }), @@ -541,43 +543,43 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "status_code:503" }), new(new[] { "status_code:504" }), new(new[] { "status_code:5xx" }), - // direct_log_api.errors, index = 493 + // direct_log_api.errors, index = 495 new(new[] { "type:timeout" }), new(new[] { "type:network" }), new(new[] { "type:status_code" }), - // waf.init, index = 496 + // waf.init, index = 498 new(null), - // waf.updates, index = 497 + // waf.updates, index = 499 new(null), - // waf.requests, index = 498 + // waf.requests, index = 500 new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:true", "request_blocked:false", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:true", "request_blocked:true", "waf_timeout:false", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:true", "request_excluded:false" }), new(new[] { "waf_version", "rule_triggered:false", "request_blocked:false", "waf_timeout:false", "request_excluded:true" }), - // waf.input_truncated, index = 503 + // waf.input_truncated, index = 505 new(new[] { "truncation_reason:string_too_long" }), new(new[] { "truncation_reason:list_or_map_too_large" }), new(new[] { "truncation_reason:object_too_deep" }), - // rasp.rule.eval, index = 506 + // rasp.rule.eval, index = 508 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // rasp.rule.match, index = 510 + // rasp.rule.match, index = 512 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // rasp.timeout, index = 514 + // rasp.timeout, index = 516 new(new[] { "waf_version", "rule_type:lfi" }), new(new[] { "waf_version", "rule_type:ssrf" }), new(new[] { "waf_version", "rule_type:sql_injection" }), new(new[] { "waf_version", "rule_type:command_injection" }), - // instrum.user_auth.missing_user_id, index = 518 + // instrum.user_auth.missing_user_id, index = 520 new(new[] { "framework:aspnetcore_identity" }), new(new[] { "framework:unknown" }), - // executed.source, index = 520 + // executed.source, index = 522 new(new[] { "source_type:http.request.body" }), new(new[] { "source_type:http.request.path" }), new(new[] { "source_type:http.request.parameter.name" }), @@ -592,9 +594,9 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "source_type:http.request.uri" }), new(new[] { "source_type:grpc.request.body" }), new(new[] { "source_type:sql.row.value" }), - // executed.propagation, index = 534 + // executed.propagation, index = 536 new(null), - // executed.sink, index = 535 + // executed.sink, index = 537 new(new[] { "vulnerability_type:none" }), new(new[] { "vulnerability_type:weak_cipher" }), new(new[] { "vulnerability_type:weak_hash" }), @@ -622,7 +624,7 @@ private static AggregatedMetric[] GetCountBuffer() new(new[] { "vulnerability_type:directory_listing_leak" }), new(new[] { "vulnerability_type:session_timeout" }), new(new[] { "vulnerability_type:email_html_injection" }), - // request.tainted, index = 562 + // request.tainted, index = 564 new(null), }; @@ -632,7 +634,7 @@ private static AggregatedMetric[] GetCountBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountEntryCounts { get; } - = new int[]{ 4, 76, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 90, 90, 2, 44, 6, 1, 1, 76, 1, 22, 3, 1, 1, 5, 3, 4, 4, 4, 2, 14, 1, 27, 1, }; + = new int[]{ 4, 77, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 90, 90, 2, 44, 6, 1, 1, 77, 1, 22, 3, 1, 1, 5, 3, 4, 4, 4, 2, 14, 1, 27, 1, }; public void RecordCountLogCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.LogLevel tag, int increment = 1) { @@ -648,229 +650,229 @@ public void RecordCountSpanCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.In public void RecordCountSpanFinished(int increment = 1) { - Interlocked.Add(ref _buffer.Count[80], increment); + Interlocked.Add(ref _buffer.Count[81], increment); } public void RecordCountSpanEnqueuedForSerialization(Datadog.Trace.Telemetry.Metrics.MetricTags.SpanEnqueueReason tag, int increment = 1) { - var index = 81 + (int)tag; + var index = 82 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountSpanDropped(Datadog.Trace.Telemetry.Metrics.MetricTags.DropReason tag, int increment = 1) { - var index = 84 + (int)tag; + var index = 85 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceSegmentCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.TraceContinuation tag, int increment = 1) { - var index = 88 + (int)tag; + var index = 89 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkEnqueued(Datadog.Trace.Telemetry.Metrics.MetricTags.TraceChunkEnqueueReason tag, int increment = 1) { - var index = 90 + (int)tag; + var index = 91 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkDropped(Datadog.Trace.Telemetry.Metrics.MetricTags.DropReason tag, int increment = 1) { - var index = 92 + (int)tag; + var index = 93 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceChunkSent(int increment = 1) { - Interlocked.Add(ref _buffer.Count[96], increment); + Interlocked.Add(ref _buffer.Count[97], increment); } public void RecordCountTraceSegmentsClosed(int increment = 1) { - Interlocked.Add(ref _buffer.Count[97], increment); + Interlocked.Add(ref _buffer.Count[98], increment); } public void RecordCountTraceApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[98], increment); + Interlocked.Add(ref _buffer.Count[99], increment); } public void RecordCountTraceApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 99 + (int)tag; + var index = 100 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTraceApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 121 + (int)tag; + var index = 122 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTracePartialFlush(Datadog.Trace.Telemetry.Metrics.MetricTags.PartialFlushReason tag, int increment = 1) { - var index = 124 + (int)tag; + var index = 125 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountContextHeaderStyleInjected(Datadog.Trace.Telemetry.Metrics.MetricTags.ContextHeaderStyle tag, int increment = 1) { - var index = 126 + (int)tag; + var index = 127 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountContextHeaderStyleExtracted(Datadog.Trace.Telemetry.Metrics.MetricTags.ContextHeaderStyle tag, int increment = 1) { - var index = 130 + (int)tag; + var index = 131 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountStatsApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[134], increment); + Interlocked.Add(ref _buffer.Count[135], increment); } public void RecordCountStatsApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 135 + (int)tag; + var index = 136 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountStatsApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 157 + (int)tag; + var index = 158 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountOpenTelemetryConfigHiddenByDatadogConfig(Datadog.Trace.Telemetry.Metrics.MetricTags.DatadogConfiguration tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.OpenTelemetryConfiguration tag2, int increment = 1) { - var index = 160 + ((int)tag1 * 10) + (int)tag2; + var index = 161 + ((int)tag1 * 10) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountOpenTelemetryConfigInvalid(Datadog.Trace.Telemetry.Metrics.MetricTags.DatadogConfiguration tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.OpenTelemetryConfiguration tag2, int increment = 1) { - var index = 250 + ((int)tag1 * 10) + (int)tag2; + var index = 251 + ((int)tag1 * 10) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiRequests(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag, int increment = 1) { - var index = 340 + (int)tag; + var index = 341 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag2, int increment = 1) { - var index = 342 + ((int)tag1 * 22) + (int)tag2; + var index = 343 + ((int)tag1 * 22) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountTelemetryApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.TelemetryEndpoint tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag2, int increment = 1) { - var index = 386 + ((int)tag1 * 3) + (int)tag2; + var index = 387 + ((int)tag1 * 3) + (int)tag2; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountVersionConflictTracerCreated(int increment = 1) { - Interlocked.Add(ref _buffer.Count[392], increment); + Interlocked.Add(ref _buffer.Count[393], increment); } public void RecordCountUnsupportedCustomInstrumentationServices(int increment = 1) { - Interlocked.Add(ref _buffer.Count[393], increment); + Interlocked.Add(ref _buffer.Count[394], increment); } public void RecordCountDirectLogLogs(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag, int increment = 1) { - var index = 394 + (int)tag; + var index = 395 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountDirectLogApiRequests(int increment = 1) { - Interlocked.Add(ref _buffer.Count[470], increment); + Interlocked.Add(ref _buffer.Count[472], increment); } public void RecordCountDirectLogApiResponses(Datadog.Trace.Telemetry.Metrics.MetricTags.StatusCode tag, int increment = 1) { - var index = 471 + (int)tag; + var index = 473 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountDirectLogApiErrors(Datadog.Trace.Telemetry.Metrics.MetricTags.ApiError tag, int increment = 1) { - var index = 493 + (int)tag; + var index = 495 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountWafInit(int increment = 1) { - Interlocked.Add(ref _buffer.Count[496], increment); + Interlocked.Add(ref _buffer.Count[498], increment); } public void RecordCountWafUpdates(int increment = 1) { - Interlocked.Add(ref _buffer.Count[497], increment); + Interlocked.Add(ref _buffer.Count[499], increment); } public void RecordCountWafRequests(Datadog.Trace.Telemetry.Metrics.MetricTags.WafAnalysis tag, int increment = 1) { - var index = 498 + (int)tag; + var index = 500 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountInputTruncated(Datadog.Trace.Telemetry.Metrics.MetricTags.TruncationReason tag, int increment = 1) { - var index = 503 + (int)tag; + var index = 505 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspRuleEval(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 506 + (int)tag; + var index = 508 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspRuleMatch(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 510 + (int)tag; + var index = 512 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountRaspTimeout(Datadog.Trace.Telemetry.Metrics.MetricTags.RaspRuleType tag, int increment = 1) { - var index = 514 + (int)tag; + var index = 516 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountMissingUserId(Datadog.Trace.Telemetry.Metrics.MetricTags.AuthenticationFramework tag, int increment = 1) { - var index = 518 + (int)tag; + var index = 520 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastExecutedSources(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSources tag, int increment = 1) { - var index = 520 + (int)tag; + var index = 522 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastExecutedPropagations(int increment = 1) { - Interlocked.Add(ref _buffer.Count[534], increment); + Interlocked.Add(ref _buffer.Count[536], increment); } public void RecordCountIastExecutedSinks(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks tag, int increment = 1) { - var index = 535 + (int)tag; + var index = 537 + (int)tag; Interlocked.Add(ref _buffer.Count[index], increment); } public void RecordCountIastRequestTainted(int increment = 1) { - Interlocked.Add(ref _buffer.Count[562], increment); + Interlocked.Add(ref _buffer.Count[564], increment); } } \ No newline at end of file diff --git a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs index 92deade1cce5..2a54bea2390a 100644 --- a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TelemetryMetricGenerator/MetricsTelemetryCollector_CountShared.g.cs @@ -11,7 +11,7 @@ namespace Datadog.Trace.Telemetry; internal partial class MetricsTelemetryCollector { - private const int CountSharedLength = 228; + private const int CountSharedLength = 231; /// /// Creates the buffer for the values. @@ -122,6 +122,9 @@ private static AggregatedMetric[] GetCountSharedBuffer() new(new[] { "integration_name:awssns", "error_type:duck_typing" }), new(new[] { "integration_name:awssns", "error_type:invoker" }), new(new[] { "integration_name:awssns", "error_type:execution" }), + new(new[] { "integration_name:awseventbridge", "error_type:duck_typing" }), + new(new[] { "integration_name:awseventbridge", "error_type:invoker" }), + new(new[] { "integration_name:awseventbridge", "error_type:execution" }), new(new[] { "integration_name:ilogger", "error_type:duck_typing" }), new(new[] { "integration_name:ilogger", "error_type:invoker" }), new(new[] { "integration_name:ilogger", "error_type:execution" }), @@ -256,7 +259,7 @@ private static AggregatedMetric[] GetCountSharedBuffer() /// It is equal to the cardinality of the tag combinations (or 1 if there are no tags) /// private static int[] CountSharedEntryCounts { get; } - = new int[]{ 228, }; + = new int[]{ 231, }; public void RecordCountSharedIntegrationsError(Datadog.Trace.Telemetry.Metrics.MetricTags.IntegrationName tag1, Datadog.Trace.Telemetry.Metrics.MetricTags.InstrumentationError tag2, int increment = 1) { diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersions.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersions.g.cs index 851756e46d78..d600825b9b25 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersions.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersions.g.cs @@ -36,6 +36,8 @@ public class PackageVersions public static IEnumerable AwsSns => IsAllMinorPackageVersions ? PackageVersionsLatestMinors.AwsSns : PackageVersionsLatestSpecific.AwsSns; + public static IEnumerable AwsEventBridge => IsAllMinorPackageVersions ? PackageVersionsLatestMinors.AwsEventBridge : PackageVersionsLatestSpecific.AwsEventBridge; + public static IEnumerable MongoDB => IsAllMinorPackageVersions ? PackageVersionsLatestMinors.MongoDB : PackageVersionsLatestSpecific.MongoDB; public static IEnumerable ElasticSearch7 => IsAllMinorPackageVersions ? PackageVersionsLatestMinors.ElasticSearch7 : PackageVersionsLatestSpecific.ElasticSearch7; diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs index cd7ff333a6b7..65a595685333 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs @@ -171,6 +171,37 @@ public class PackageVersionsLatestMajors #if NET8_0 new object[] { "3.7.400.22" }, #endif +#endif + }; + + public static IEnumerable AwsEventBridge => + + new List + { +#if DEFAULT_SAMPLES + new object[] { string.Empty }, +#else +#if NETCOREAPP2_1 + new object[] { "3.7.401.23" }, +#endif +#if NETCOREAPP3_0 + new object[] { "3.7.401.23" }, +#endif +#if NETCOREAPP3_1 + new object[] { "3.7.401.23" }, +#endif +#if NET5_0 + new object[] { "3.7.401.23" }, +#endif +#if NET6_0 + new object[] { "3.7.401.23" }, +#endif +#if NET7_0 + new object[] { "3.7.401.23" }, +#endif +#if NET8_0 + new object[] { "3.7.401.23" }, +#endif #endif }; diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs index 00c9f344cdbc..e6dc36ff6d8c 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs @@ -260,6 +260,51 @@ public class PackageVersionsLatestMinors new object[] { "3.5.1.51" }, new object[] { "3.7.400.22" }, #endif +#endif + }; + + public static IEnumerable AwsEventBridge => + + new List + { +#if DEFAULT_SAMPLES + new object[] { string.Empty }, +#else +#if NETCOREAPP2_1 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NETCOREAPP3_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NETCOREAPP3_1 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NET5_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NET6_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NET7_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NET8_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif #endif }; diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs index 00addd74cee3..779a53eb0a83 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs @@ -207,6 +207,51 @@ public class PackageVersionsLatestSpecific new object[] { "3.3.102.17" }, new object[] { "3.7.400.22" }, #endif +#endif + }; + + public static IEnumerable AwsEventBridge => + + new List + { +#if DEFAULT_SAMPLES + new object[] { string.Empty }, +#else +#if NETCOREAPP2_1 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NETCOREAPP3_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NETCOREAPP3_1 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NET5_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NET6_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NET7_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif +#if NET8_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + new object[] { "3.7.401.23" }, +#endif #endif }; From 23112750eaaff77b81aa1a736d1c5e98bbe86342 Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Tue, 1 Oct 2024 09:49:29 -0400 Subject: [PATCH 06/15] Update snapshot; code review changes. --- .nuke/build.schema.json | 2 ++ .../build/Datadog.Trace.Trimming.xml | 3 --- .../AwsEventBridgeTests.NetCore.SchemaV0.verified.txt | 9 +++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 85905d23b996..5bbe488f0e55 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -330,6 +330,7 @@ "CheckTestResultForProfilerWithSanitizer", "Clean", "CleanObjFiles", + "CleanTestLogs", "CloseMilestone", "CompareBenchmarksResults", "CompareCodeCoverageReports", @@ -552,6 +553,7 @@ "CheckTestResultForProfilerWithSanitizer", "Clean", "CleanObjFiles", + "CleanTestLogs", "CloseMilestone", "CompareBenchmarksResults", "CompareCodeCoverageReports", diff --git a/tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml b/tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml index 1aa3e3825183..b8fd04046b8a 100644 --- a/tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml +++ b/tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml @@ -215,7 +215,6 @@ - @@ -548,8 +547,6 @@ - - diff --git a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt index 15ad1d449729..4561e2de0d0a 100644 --- a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt +++ b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt @@ -35,8 +35,7 @@ language: dotnet, out.host: aws_eventbridge, runtime-id: Guid_1, - span.kind: client, - _dd.base_service: Samples.AWS.EventBridge + span.kind: client }, Metrics: { _dd.top_level: 1.0 @@ -64,8 +63,7 @@ http.url: http://localhost:00000/, language: dotnet, runtime-id: Guid_1, - span.kind: client, - _dd.base_service: Samples.AWS.EventBridge + span.kind: client }, Metrics: { _dd.top_level: 1.0 @@ -89,8 +87,7 @@ language: dotnet, out.host: aws_eventbridge, runtime-id: Guid_1, - span.kind: client, - _dd.base_service: Samples.AWS.EventBridge + span.kind: client }, Metrics: { _dd.top_level: 1.0 From e77b7c783116af1a93ec3fd7817c84be37c121ad Mon Sep 17 00:00:00 2001 From: Steven Bouwkamp Date: Tue, 1 Oct 2024 16:25:46 -0400 Subject: [PATCH 07/15] Update docker-compose for `events` on localstack --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index c169b3b1e65b..0fdf4708dc71 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -93,7 +93,7 @@ services: localstack: image: localstack/localstack environment: - - SERVICES=sns,sqs,kinesis,dynamodb + - SERVICES=sns,sqs,kinesis,dynamodb,events - DEBUG=1 - DATA_DIR=/tmp/localstack/data - DEFAULT_REGION=us-east-1 From e11059506613d461c75455ee66a5820eb1fd84da Mon Sep 17 00:00:00 2001 From: Steven Bouwkamp Date: Tue, 1 Oct 2024 16:26:22 -0400 Subject: [PATCH 08/15] Add NetFramework snapshots --- ...geTests.NetFramework.SchemaV0.verified.txt | 192 ++++++++++++++++++ ...geTests.NetFramework.SchemaV1.verified.txt | 174 ++++++++++++++++ 2 files changed, 366 insertions(+) create mode 100644 tracer/test/snapshots/AwsEventBridgeTests.NetFramework.SchemaV0.verified.txt create mode 100644 tracer/test/snapshots/AwsEventBridgeTests.NetFramework.SchemaV1.verified.txt diff --git a/tracer/test/snapshots/AwsEventBridgeTests.NetFramework.SchemaV0.verified.txt b/tracer/test/snapshots/AwsEventBridgeTests.NetFramework.SchemaV0.verified.txt new file mode 100644 index 000000000000..86bb8d529712 --- /dev/null +++ b/tracer/test/snapshots/AwsEventBridgeTests.NetFramework.SchemaV0.verified.txt @@ -0,0 +1,192 @@ +[ + { + TraceId: Id_1, + SpanId: Id_2, + Name: async-methods, + Resource: async-methods, + Service: Samples.AWS.EventBridge, + Tags: { + env: integration_tests, + language: dotnet, + runtime-id: Guid_1 + }, + Metrics: { + process_id: 0, + _dd.top_level: 1.0, + _dd.tracer_kr: 1.0, + _sampling_priority_v1: 1.0 + } + }, + { + TraceId: Id_1, + SpanId: Id_3, + Name: http.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge-http-client, + Type: http, + ParentId: Id_2, + Tags: { + component: WebRequest, + env: integration_tests, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + runtime-id: Guid_1, + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge + }, + Metrics: { + _dd.top_level: 1.0 + } + }, + { + TraceId: Id_1, + SpanId: Id_4, + Name: eventbridge.request, + Resource: EventBridge.PutEvents, + Service: Samples.AWS.EventBridge-aws-eventbridge, + Type: http, + ParentId: Id_2, + Tags: { + aws.agent: dotnet-aws-sdk, + aws.operation: PutEvents, + aws.requestId: Guid_2, + aws.service: EventBridge, + aws_service: EventBridge, + component: aws-sdk, + env: integration_tests, + eventbusname: MyEventBus, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + runtime-id: Guid_1, + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge + }, + Metrics: { + _dd.top_level: 1.0 + } + }, + { + TraceId: Id_1, + SpanId: Id_5, + Name: http.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge-http-client, + Type: http, + ParentId: Id_2, + Tags: { + component: WebRequest, + env: integration_tests, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + runtime-id: Guid_1, + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge + }, + Metrics: { + _dd.top_level: 1.0 + } + }, + { + TraceId: Id_6, + SpanId: Id_7, + Name: sync-methods, + Resource: sync-methods, + Service: Samples.AWS.EventBridge, + Tags: { + env: integration_tests, + language: dotnet, + runtime-id: Guid_1 + }, + Metrics: { + process_id: 0, + _dd.top_level: 1.0, + _dd.tracer_kr: 1.0, + _sampling_priority_v1: 1.0 + } + }, + { + TraceId: Id_6, + SpanId: Id_8, + Name: http.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge-http-client, + Type: http, + ParentId: Id_7, + Tags: { + component: WebRequest, + env: integration_tests, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + runtime-id: Guid_1, + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge + }, + Metrics: { + _dd.top_level: 1.0 + } + }, + { + TraceId: Id_6, + SpanId: Id_9, + Name: eventbridge.request, + Resource: EventBridge.PutEvents, + Service: Samples.AWS.EventBridge-aws-eventbridge, + Type: http, + ParentId: Id_7, + Tags: { + aws.agent: dotnet-aws-sdk, + aws.operation: PutEvents, + aws.requestId: Guid_3, + aws.service: EventBridge, + aws_service: EventBridge, + component: aws-sdk, + env: integration_tests, + eventbusname: MyEventBus, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + runtime-id: Guid_1, + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge + }, + Metrics: { + _dd.top_level: 1.0 + } + }, + { + TraceId: Id_6, + SpanId: Id_10, + Name: http.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge-http-client, + Type: http, + ParentId: Id_7, + Tags: { + component: WebRequest, + env: integration_tests, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + runtime-id: Guid_1, + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge + }, + Metrics: { + _dd.top_level: 1.0 + } + } +] \ No newline at end of file diff --git a/tracer/test/snapshots/AwsEventBridgeTests.NetFramework.SchemaV1.verified.txt b/tracer/test/snapshots/AwsEventBridgeTests.NetFramework.SchemaV1.verified.txt new file mode 100644 index 000000000000..8aadeb4cf804 --- /dev/null +++ b/tracer/test/snapshots/AwsEventBridgeTests.NetFramework.SchemaV1.verified.txt @@ -0,0 +1,174 @@ +[ + { + TraceId: Id_1, + SpanId: Id_2, + Name: async-methods, + Resource: async-methods, + Service: Samples.AWS.EventBridge, + Tags: { + env: integration_tests, + language: dotnet, + runtime-id: Guid_1 + }, + Metrics: { + process_id: 0, + _dd.top_level: 1.0, + _dd.tracer_kr: 1.0, + _sampling_priority_v1: 1.0 + } + }, + { + TraceId: Id_1, + SpanId: Id_3, + Name: http.client.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge, + Type: http, + ParentId: Id_2, + Tags: { + component: WebRequest, + env: integration_tests, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + peer.service: aws_eventbridge, + span.kind: client, + _dd.peer.service.source: out.host + } + }, + { + TraceId: Id_1, + SpanId: Id_4, + Name: aws.eventbridge.send, + Resource: EventBridge.PutEvents, + Service: Samples.AWS.EventBridge, + Type: http, + ParentId: Id_2, + Tags: { + aws.agent: dotnet-aws-sdk, + aws.operation: PutEvents, + aws.requestId: Guid_2, + aws.service: EventBridge, + aws_service: EventBridge, + component: aws-sdk, + env: integration_tests, + eventbusname: MyEventBus, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + peer.service: MyEventBus, + span.kind: producer, + _dd.peer.service.source: eventbusname + } + }, + { + TraceId: Id_1, + SpanId: Id_5, + Name: http.client.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge, + Type: http, + ParentId: Id_2, + Tags: { + component: WebRequest, + env: integration_tests, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + peer.service: aws_eventbridge, + span.kind: client, + _dd.peer.service.source: out.host + } + }, + { + TraceId: Id_6, + SpanId: Id_7, + Name: sync-methods, + Resource: sync-methods, + Service: Samples.AWS.EventBridge, + Tags: { + env: integration_tests, + language: dotnet, + runtime-id: Guid_1 + }, + Metrics: { + process_id: 0, + _dd.top_level: 1.0, + _dd.tracer_kr: 1.0, + _sampling_priority_v1: 1.0 + } + }, + { + TraceId: Id_6, + SpanId: Id_8, + Name: http.client.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge, + Type: http, + ParentId: Id_7, + Tags: { + component: WebRequest, + env: integration_tests, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + peer.service: aws_eventbridge, + span.kind: client, + _dd.peer.service.source: out.host + } + }, + { + TraceId: Id_6, + SpanId: Id_9, + Name: aws.eventbridge.send, + Resource: EventBridge.PutEvents, + Service: Samples.AWS.EventBridge, + Type: http, + ParentId: Id_7, + Tags: { + aws.agent: dotnet-aws-sdk, + aws.operation: PutEvents, + aws.requestId: Guid_3, + aws.service: EventBridge, + aws_service: EventBridge, + component: aws-sdk, + env: integration_tests, + eventbusname: MyEventBus, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + peer.service: MyEventBus, + span.kind: producer, + _dd.peer.service.source: eventbusname + } + }, + { + TraceId: Id_6, + SpanId: Id_10, + Name: http.client.request, + Resource: POST localhost:00000/, + Service: Samples.AWS.EventBridge, + Type: http, + ParentId: Id_7, + Tags: { + component: WebRequest, + env: integration_tests, + http.method: POST, + http.status_code: 200, + http.url: http://localhost:00000/, + language: dotnet, + out.host: aws_eventbridge, + peer.service: aws_eventbridge, + span.kind: client, + _dd.peer.service.source: out.host + } + } +] \ No newline at end of file From 8ad4b1d719664added8159a803ef23367635793a Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Wed, 2 Oct 2024 11:26:20 -0400 Subject: [PATCH 09/15] Code review changes --- .../PackageVersionsGeneratorDefinitions.json | 2 +- .../build/PackageVersionsLatestMajors.g.props | 28 +++++----- .../build/PackageVersionsLatestMinors.g.props | 56 +++++++++---------- .../PackageVersionsLatestSpecific.g.props | 56 +++++++++---------- tracer/build/supported_versions.json | 6 +- .../Datadog.Dependabot.Integrations.csproj | 4 +- .../AWS/EventBridge/AwsEventBridgeCommon.cs | 21 +++++-- .../AWS/EventBridge/ContextPropagation.cs | 8 ++- .../AWS/AwsEventBridgeTests.cs | 21 +++++++ .../PackageVersionsLatestMajors.g.cs | 14 ++--- .../PackageVersionsLatestMinors.g.cs | 16 +++--- .../PackageVersionsLatestSpecific.g.cs | 14 ++--- ...tBridgeTests.NetCore.SchemaV0.verified.txt | 9 ++- .../Samples.AWS.EventBridge.csproj | 2 +- 14 files changed, 147 insertions(+), 110 deletions(-) diff --git a/tracer/build/PackageVersionsGeneratorDefinitions.json b/tracer/build/PackageVersionsGeneratorDefinitions.json index 1ac8f201c368..d30fd8a2d247 100644 --- a/tracer/build/PackageVersionsGeneratorDefinitions.json +++ b/tracer/build/PackageVersionsGeneratorDefinitions.json @@ -84,7 +84,7 @@ "SampleProjectName": "Samples.AWS.EventBridge", "NugetPackageSearchName": "AWSSDK.EventBridge", "MinVersion": "3.3.100", - "MaxVersionExclusive": "3.8.0", + "MaxVersionExclusive": "4.0.0", "SpecificVersions": [ "3.3.*", "3.5.*", diff --git a/tracer/build/PackageVersionsLatestMajors.g.props b/tracer/build/PackageVersionsLatestMajors.g.props index bb07694b1789..d68851c1d16d 100644 --- a/tracer/build/PackageVersionsLatestMajors.g.props +++ b/tracer/build/PackageVersionsLatestMajors.g.props @@ -223,45 +223,45 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely Samples.AWS.SimpleNotificationService - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false netcoreapp2.1 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net5.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net6.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net7.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net8.0 - None + All Samples.AWS.EventBridge diff --git a/tracer/build/PackageVersionsLatestMinors.g.props b/tracer/build/PackageVersionsLatestMinors.g.props index efd2aacaa06d..c86e4cf85a7a 100644 --- a/tracer/build/PackageVersionsLatestMinors.g.props +++ b/tracer/build/PackageVersionsLatestMinors.g.props @@ -759,127 +759,127 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false netcoreapp2.1 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false netcoreapp2.1 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false netcoreapp2.1 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.0 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false net5.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false net5.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net5.0 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false net6.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false net6.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net6.0 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false net7.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false net7.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net7.0 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false net8.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false net8.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net8.0 - None + All Samples.AWS.EventBridge diff --git a/tracer/build/PackageVersionsLatestSpecific.g.props b/tracer/build/PackageVersionsLatestSpecific.g.props index df923886a06a..a80616bd99db 100644 --- a/tracer/build/PackageVersionsLatestSpecific.g.props +++ b/tracer/build/PackageVersionsLatestSpecific.g.props @@ -441,127 +441,127 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false netcoreapp2.1 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false netcoreapp2.1 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false netcoreapp2.1 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.0 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false net5.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false net5.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net5.0 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false net6.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false net6.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net6.0 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false net7.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false net7.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net7.0 - None + All Samples.AWS.EventBridge ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false net8.0 - None + All Samples.AWS.EventBridge ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false net8.0 - None + All Samples.AWS.EventBridge - ApiVersion=3.7.401.23;RestoreRecursive=false;BuildProjectReferences=false + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false net8.0 - None + All Samples.AWS.EventBridge diff --git a/tracer/build/supported_versions.json b/tracer/build/supported_versions.json index 5b9efba00a7a..3650e3b3b2a4 100644 --- a/tracer/build/supported_versions.json +++ b/tracer/build/supported_versions.json @@ -259,9 +259,9 @@ "minVersionAvailableInclusive": "3.3.100", "minVersionSupportedInclusive": "3.3.100", "minVersionTestedInclusive": "3.3.102.16", - "maxVersionSupportedInclusive": "3.7.401.23", - "maxVersionAvailableInclusive": "3.7.401.23", - "maxVersionTestedInclusive": "3.7.401.23" + "maxVersionSupportedInclusive": "3.7.401.25", + "maxVersionAvailableInclusive": "3.7.401.25", + "maxVersionTestedInclusive": "3.7.401.25" } ] }, diff --git a/tracer/dependabot/Datadog.Dependabot.Integrations.csproj b/tracer/dependabot/Datadog.Dependabot.Integrations.csproj index 1cd3adb349d1..f0a6fe274c76 100644 --- a/tracer/dependabot/Datadog.Dependabot.Integrations.csproj +++ b/tracer/dependabot/Datadog.Dependabot.Integrations.csproj @@ -28,8 +28,8 @@ - - + + diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs index 1f72575d41ae..f94da596c7e4 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs @@ -67,12 +67,21 @@ internal static class AwsEventBridgeCommon // Finds the first entry that has a valid bus name, or null if not found. public static string? GetBusName(IEnumerable? entries) { - return entries? - .Cast() - .Select(entry => entry.DuckCast()) - .Where(duckEntry => duckEntry != null) - .Select(duckEntry => duckEntry!.EventBusName) - .FirstOrDefault(eventBusName => !string.IsNullOrEmpty(eventBusName)); + if (entries is null) + { + return null; + } + + foreach (var entry in entries) + { + var duckEntry = entry.DuckCast(); + if (duckEntry is not null && !string.IsNullOrEmpty(duckEntry.EventBusName)) + { + return duckEntry.EventBusName; + } + } + + return null; } internal static string GetOperationName(Tracer tracer) diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs index 4feb55b2972f..08a30a167343 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs @@ -18,6 +18,7 @@ internal static class ContextPropagation private const string StartTimeKey = "x-datadog-start-time"; private const string ResourceNameKey = "x-datadog-resource-name"; + // Loops through all entries of the EventBridge event and tries to inject Datadog context into each. public static void InjectTracingContext(TPutEventsRequest request, SpanContext context) where TPutEventsRequest : IPutEventsRequest, IDuckType { @@ -37,6 +38,8 @@ public static void InjectTracingContext(TPutEventsRequest req } } + // Tries to add Datadog trace context under the `_datadog` key at the top level of the `detail` field. + // `detail` is a string, so we have to manually modify it using a StringBuilder. private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanContext context, string? eventBusName) { var detail = entry.Detail?.Trim() ?? "{}"; @@ -53,12 +56,13 @@ private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanCo detailBuilder.Append(','); // Add comma if the original detail is not empty } - var traceContext = GetTraceContext(context, eventBusName); + var traceContext = BuildTraceContextJson(context, eventBusName); detailBuilder.Append($"\"{DatadogKey}\":{traceContext}").Append('}'); entry.Detail = Util.StringBuilderCache.GetStringAndRelease(detailBuilder); } - private static string GetTraceContext(SpanContext context, string? eventBusName) + // Builds a JSON string containing Datadog trace context + private static string BuildTraceContextJson(SpanContext context, string? eventBusName) { // Inject trace context var jsonBuilder = Util.StringBuilderCache.Acquire(Util.StringBuilderCache.MaxBuilderSize); diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs index fc7f1c9666a5..7479abbf0bf5 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs @@ -89,5 +89,26 @@ public async Task SubmitsTraces(string packageVersion, string metadataSchemaVers telemetry.AssertIntegrationEnabled(IntegrationId.AwsEventBridge); } } + + [SkippableFact] + [Trait("Category", "EndToEnd")] + public async Task IntegrationDisabled() + { + const string expectedOperationName = "aws.eventbridge.request"; + + SetEnvironmentVariable($"DD_TRACE_{nameof(IntegrationId.AwsEventBridge)}_ENABLED", "false"); + + using var telemetry = this.ConfigureTelemetry(); + string packageVersion = PackageVersions.AwsEventBridge.First()[0] as string; + using var agent = EnvironmentHelper.GetMockAgent(); + using (await RunSampleAndWaitForExit(agent, packageVersion: packageVersion)) + { + var spans = agent.WaitForSpans(1, returnAllOperations: true); + + Assert.NotEmpty(spans); + Assert.Empty(spans.Where(s => s.Name.Equals(expectedOperationName))); + telemetry.AssertIntegrationDisabled(IntegrationId.AwsEventBridge); + } + } } } diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs index 5333d81b2e80..01ff6a46845c 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs @@ -182,25 +182,25 @@ public class PackageVersionsLatestMajors new object[] { string.Empty }, #else #if NETCOREAPP2_1 - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NETCOREAPP3_0 - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NETCOREAPP3_1 - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET5_0 - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET6_0 - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET7_0 - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET8_0 - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #endif }; diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs index 6bdb33bf751a..b15fb4dfa4f4 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs @@ -265,7 +265,7 @@ public class PackageVersionsLatestMinors public static IEnumerable AwsEventBridge => - new List + new List { #if DEFAULT_SAMPLES new object[] { string.Empty }, @@ -273,37 +273,37 @@ public class PackageVersionsLatestMinors #if NETCOREAPP2_1 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NETCOREAPP3_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NETCOREAPP3_1 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET5_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET6_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET7_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET8_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #endif }; diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs index d160fa82a90c..36a34c2a31e0 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs @@ -220,37 +220,37 @@ public class PackageVersionsLatestSpecific #if NETCOREAPP2_1 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NETCOREAPP3_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NETCOREAPP3_1 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET5_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET6_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET7_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #if NET8_0 new object[] { "3.3.102.16" }, new object[] { "3.5.6.5" }, - new object[] { "3.7.401.23" }, + new object[] { "3.7.401.25" }, #endif #endif }; diff --git a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt index 4561e2de0d0a..15ad1d449729 100644 --- a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt +++ b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt @@ -35,7 +35,8 @@ language: dotnet, out.host: aws_eventbridge, runtime-id: Guid_1, - span.kind: client + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge }, Metrics: { _dd.top_level: 1.0 @@ -63,7 +64,8 @@ http.url: http://localhost:00000/, language: dotnet, runtime-id: Guid_1, - span.kind: client + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge }, Metrics: { _dd.top_level: 1.0 @@ -87,7 +89,8 @@ language: dotnet, out.host: aws_eventbridge, runtime-id: Guid_1, - span.kind: client + span.kind: client, + _dd.base_service: Samples.AWS.EventBridge }, Metrics: { _dd.top_level: 1.0 diff --git a/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Samples.AWS.EventBridge.csproj b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Samples.AWS.EventBridge.csproj index 50b5e8375490..d9a1bb0635af 100644 --- a/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Samples.AWS.EventBridge.csproj +++ b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Samples.AWS.EventBridge.csproj @@ -7,7 +7,7 @@ false false - true + All From a2d0cd757ccbeae9be2e1678c71fe34851c200e8 Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Thu, 3 Oct 2024 10:21:34 -0400 Subject: [PATCH 10/15] Add log --- .../AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs index 08a30a167343..bf800b350e44 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs @@ -46,6 +46,7 @@ private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanCo if (!detail.EndsWith("}")) { // Unable to parse detail string, so just leave it unmodified. Don't inject trace context. + Console.WriteLine("Unable to parse detail string. Not injecting trace context."); return; } From 286c1e75e356231a51ad51f86d9f599ded6d19be Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Thu, 3 Oct 2024 11:10:20 -0400 Subject: [PATCH 11/15] Update `docker-compose` for `events` for localstack for arm64 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0fdf4708dc71..f2f49b1c0da4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: localstack_arm64: image: localstack/localstack environment: - - SERVICES=sns,sqs,kinesis,dynamodb + - SERVICES=sns,sqs,kinesis,dynamodb,events - DEBUG=1 - DATA_DIR=/tmp/localstack/data - DEFAULT_REGION=us-east-1 @@ -1112,7 +1112,7 @@ services: localstack_osx_arm64: image: localstack/localstack environment: - - SERVICES=sns,sqs,kinesis,dynamodb + - SERVICES=sns,sqs,kinesis,dynamodb,events - DEBUG=1 - DATA_DIR=/tmp/localstack/data - DEFAULT_REGION=us-east-1 From 9900a0d27147addda7e9ad92160f6c240330c18b Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Mon, 7 Oct 2024 10:36:36 -0400 Subject: [PATCH 12/15] * Rename `eventbusname` tag to `rulename` * Use the standard logger instead of `Console.WriteLine()` * Don't pass in redundant parameter. * Remove unused imports --- .../AWS/EventBridge/AwsEventBridgeCommon.cs | 1 - .../AWS/EventBridge/ContextPropagation.cs | 11 ++++++---- .../AWS/EventBridge/IPutEventsRequestEntry.cs | 3 --- .../EventBridge/PutEventsAsyncIntegration.cs | 2 +- .../AWS/EventBridge/PutEventsIntegration.cs | 2 +- .../TagListGenerator/AwsEventBridgeTags.g.cs | 20 +++++++++---------- .../TagListGenerator/AwsEventBridgeTags.g.cs | 20 +++++++++---------- .../TagListGenerator/AwsEventBridgeTags.g.cs | 20 +++++++++---------- .../TagListGenerator/AwsEventBridgeTags.g.cs | 20 +++++++++---------- .../Tagging/AwsEventBridgeTags.cs | 9 +++++---- tracer/src/Datadog.Trace/Tags.cs | 4 ++-- .../SpanMetadataV0Rules.cs | 2 +- .../SpanMetadataV1Rules.cs | 8 ++++---- ...tBridgeTests.NetCore.SchemaV0.verified.txt | 2 +- ...tBridgeTests.NetCore.SchemaV1.verified.txt | 4 ++-- 15 files changed, 64 insertions(+), 64 deletions(-) diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs index f94da596c7e4..5771f0ea58de 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.cs @@ -7,7 +7,6 @@ using System; using System.Collections; -using System.Linq; using Datadog.Trace.Configuration; using Datadog.Trace.DuckTyping; using Datadog.Trace.Logging; diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs index bf800b350e44..5cc9fbb94489 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs @@ -8,12 +8,15 @@ using System; using System.Text; using Datadog.Trace.DuckTyping; +using Datadog.Trace.Logging; using Datadog.Trace.Propagators; namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge { internal static class ContextPropagation { + internal static readonly IDatadogLogger Log = DatadogLogging.GetLoggerFor(typeof(ContextPropagation)); + private const string DatadogKey = "_datadog"; private const string StartTimeKey = "x-datadog-start-time"; private const string ResourceNameKey = "x-datadog-resource-name"; @@ -33,20 +36,20 @@ public static void InjectTracingContext(TPutEventsRequest req var duckEntry = entry.DuckCast(); if (duckEntry != null) { - InjectHeadersIntoDetail(duckEntry, context, duckEntry.EventBusName); + InjectHeadersIntoDetail(duckEntry, context); } } } // Tries to add Datadog trace context under the `_datadog` key at the top level of the `detail` field. // `detail` is a string, so we have to manually modify it using a StringBuilder. - private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanContext context, string? eventBusName) + private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanContext context) { var detail = entry.Detail?.Trim() ?? "{}"; if (!detail.EndsWith("}")) { // Unable to parse detail string, so just leave it unmodified. Don't inject trace context. - Console.WriteLine("Unable to parse detail string. Not injecting trace context."); + Log.Debug("Unable to parse detail string. Not injecting trace context."); return; } @@ -57,7 +60,7 @@ private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanCo detailBuilder.Append(','); // Add comma if the original detail is not empty } - var traceContext = BuildTraceContextJson(context, eventBusName); + var traceContext = BuildTraceContextJson(context, entry.EventBusName); detailBuilder.Append($"\"{DatadogKey}\":{traceContext}").Append('}'); entry.Detail = Util.StringBuilderCache.GetStringAndRelease(detailBuilder); } diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequestEntry.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequestEntry.cs index 2b7d539efb44..24ffc331be3d 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequestEntry.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequestEntry.cs @@ -5,9 +5,6 @@ #nullable enable -using System; -using System.Collections.Generic; - namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge { /// diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs index 2e1c457fe95a..29462812391a 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs @@ -55,7 +55,7 @@ internal static CallTargetState OnMethodBegin(TTarge var busName = AwsEventBridgeCommon.GetBusName(request.Entries.Value); if (busName is not null) { - tags.EventBusName = busName; + tags.RuleName = busName; } } diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs index b58eab6ae8aa..d593afc9bf73 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs @@ -52,7 +52,7 @@ internal static CallTargetState OnMethodBegin(TTarge var busName = AwsEventBridgeCommon.GetBusName(request.Entries.Value); if (busName is not null) { - tags.EventBusName = busName; + tags.RuleName = busName; } } diff --git a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs index 0a9265e6afae..37d81e323399 100644 --- a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs @@ -14,8 +14,8 @@ namespace Datadog.Trace.Tagging { partial class AwsEventBridgeTags { - // EventBusNameBytes = MessagePack.Serialize("eventbusname"); - private static ReadOnlySpan EventBusNameBytes => new byte[] { 172, 101, 118, 101, 110, 116, 98, 117, 115, 110, 97, 109, 101 }; + // RuleNameBytes = MessagePack.Serialize("rulename"); + private static ReadOnlySpan RuleNameBytes => new byte[] { 168, 114, 117, 108, 101, 110, 97, 109, 101 }; // SpanKindBytes = MessagePack.Serialize("span.kind"); private static ReadOnlySpan SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 }; @@ -23,7 +23,7 @@ partial class AwsEventBridgeTags { return key switch { - "eventbusname" => EventBusName, + "rulename" => RuleName, "span.kind" => SpanKind, _ => base.GetTag(key), }; @@ -33,8 +33,8 @@ public override void SetTag(string key, string value) { switch(key) { - case "eventbusname": - EventBusName = value; + case "rulename": + RuleName = value; break; case "span.kind": Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeTags)); @@ -47,9 +47,9 @@ public override void SetTag(string key, string value) public override void EnumerateTags(ref TProcessor processor) { - if (EventBusName is not null) + if (RuleName is not null) { - processor.Process(new TagItem("eventbusname", EventBusName, EventBusNameBytes)); + processor.Process(new TagItem("rulename", RuleName, RuleNameBytes)); } if (SpanKind is not null) @@ -62,10 +62,10 @@ public override void EnumerateTags(ref TProcessor processor) protected override void WriteAdditionalTags(System.Text.StringBuilder sb) { - if (EventBusName is not null) + if (RuleName is not null) { - sb.Append("eventbusname (tag):") - .Append(EventBusName) + sb.Append("rulename (tag):") + .Append(RuleName) .Append(','); } diff --git a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs index 0a9265e6afae..37d81e323399 100644 --- a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs @@ -14,8 +14,8 @@ namespace Datadog.Trace.Tagging { partial class AwsEventBridgeTags { - // EventBusNameBytes = MessagePack.Serialize("eventbusname"); - private static ReadOnlySpan EventBusNameBytes => new byte[] { 172, 101, 118, 101, 110, 116, 98, 117, 115, 110, 97, 109, 101 }; + // RuleNameBytes = MessagePack.Serialize("rulename"); + private static ReadOnlySpan RuleNameBytes => new byte[] { 168, 114, 117, 108, 101, 110, 97, 109, 101 }; // SpanKindBytes = MessagePack.Serialize("span.kind"); private static ReadOnlySpan SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 }; @@ -23,7 +23,7 @@ partial class AwsEventBridgeTags { return key switch { - "eventbusname" => EventBusName, + "rulename" => RuleName, "span.kind" => SpanKind, _ => base.GetTag(key), }; @@ -33,8 +33,8 @@ public override void SetTag(string key, string value) { switch(key) { - case "eventbusname": - EventBusName = value; + case "rulename": + RuleName = value; break; case "span.kind": Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeTags)); @@ -47,9 +47,9 @@ public override void SetTag(string key, string value) public override void EnumerateTags(ref TProcessor processor) { - if (EventBusName is not null) + if (RuleName is not null) { - processor.Process(new TagItem("eventbusname", EventBusName, EventBusNameBytes)); + processor.Process(new TagItem("rulename", RuleName, RuleNameBytes)); } if (SpanKind is not null) @@ -62,10 +62,10 @@ public override void EnumerateTags(ref TProcessor processor) protected override void WriteAdditionalTags(System.Text.StringBuilder sb) { - if (EventBusName is not null) + if (RuleName is not null) { - sb.Append("eventbusname (tag):") - .Append(EventBusName) + sb.Append("rulename (tag):") + .Append(RuleName) .Append(','); } diff --git a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs index 0a9265e6afae..37d81e323399 100644 --- a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs @@ -14,8 +14,8 @@ namespace Datadog.Trace.Tagging { partial class AwsEventBridgeTags { - // EventBusNameBytes = MessagePack.Serialize("eventbusname"); - private static ReadOnlySpan EventBusNameBytes => new byte[] { 172, 101, 118, 101, 110, 116, 98, 117, 115, 110, 97, 109, 101 }; + // RuleNameBytes = MessagePack.Serialize("rulename"); + private static ReadOnlySpan RuleNameBytes => new byte[] { 168, 114, 117, 108, 101, 110, 97, 109, 101 }; // SpanKindBytes = MessagePack.Serialize("span.kind"); private static ReadOnlySpan SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 }; @@ -23,7 +23,7 @@ partial class AwsEventBridgeTags { return key switch { - "eventbusname" => EventBusName, + "rulename" => RuleName, "span.kind" => SpanKind, _ => base.GetTag(key), }; @@ -33,8 +33,8 @@ public override void SetTag(string key, string value) { switch(key) { - case "eventbusname": - EventBusName = value; + case "rulename": + RuleName = value; break; case "span.kind": Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeTags)); @@ -47,9 +47,9 @@ public override void SetTag(string key, string value) public override void EnumerateTags(ref TProcessor processor) { - if (EventBusName is not null) + if (RuleName is not null) { - processor.Process(new TagItem("eventbusname", EventBusName, EventBusNameBytes)); + processor.Process(new TagItem("rulename", RuleName, RuleNameBytes)); } if (SpanKind is not null) @@ -62,10 +62,10 @@ public override void EnumerateTags(ref TProcessor processor) protected override void WriteAdditionalTags(System.Text.StringBuilder sb) { - if (EventBusName is not null) + if (RuleName is not null) { - sb.Append("eventbusname (tag):") - .Append(EventBusName) + sb.Append("rulename (tag):") + .Append(RuleName) .Append(','); } diff --git a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs index 0a9265e6afae..37d81e323399 100644 --- a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/TagListGenerator/AwsEventBridgeTags.g.cs @@ -14,8 +14,8 @@ namespace Datadog.Trace.Tagging { partial class AwsEventBridgeTags { - // EventBusNameBytes = MessagePack.Serialize("eventbusname"); - private static ReadOnlySpan EventBusNameBytes => new byte[] { 172, 101, 118, 101, 110, 116, 98, 117, 115, 110, 97, 109, 101 }; + // RuleNameBytes = MessagePack.Serialize("rulename"); + private static ReadOnlySpan RuleNameBytes => new byte[] { 168, 114, 117, 108, 101, 110, 97, 109, 101 }; // SpanKindBytes = MessagePack.Serialize("span.kind"); private static ReadOnlySpan SpanKindBytes => new byte[] { 169, 115, 112, 97, 110, 46, 107, 105, 110, 100 }; @@ -23,7 +23,7 @@ partial class AwsEventBridgeTags { return key switch { - "eventbusname" => EventBusName, + "rulename" => RuleName, "span.kind" => SpanKind, _ => base.GetTag(key), }; @@ -33,8 +33,8 @@ public override void SetTag(string key, string value) { switch(key) { - case "eventbusname": - EventBusName = value; + case "rulename": + RuleName = value; break; case "span.kind": Logger.Value.Warning("Attempted to set readonly tag {TagName} on {TagType}. Ignoring.", key, nameof(AwsEventBridgeTags)); @@ -47,9 +47,9 @@ public override void SetTag(string key, string value) public override void EnumerateTags(ref TProcessor processor) { - if (EventBusName is not null) + if (RuleName is not null) { - processor.Process(new TagItem("eventbusname", EventBusName, EventBusNameBytes)); + processor.Process(new TagItem("rulename", RuleName, RuleNameBytes)); } if (SpanKind is not null) @@ -62,10 +62,10 @@ public override void EnumerateTags(ref TProcessor processor) protected override void WriteAdditionalTags(System.Text.StringBuilder sb) { - if (EventBusName is not null) + if (RuleName is not null) { - sb.Append("eventbusname (tag):") - .Append(EventBusName) + sb.Append("rulename (tag):") + .Append(RuleName) .Append(','); } diff --git a/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs b/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs index 01dc3625be70..5d2526ab3386 100644 --- a/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs +++ b/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs @@ -21,8 +21,9 @@ public AwsEventBridgeTags(string spanKind) SpanKind = spanKind; } - [Tag(Trace.Tags.EventBusName)] - public string EventBusName { get; set; } + // TODO rename the `rulename` tag to `eventbusname` across all runtimes + [Tag(Trace.Tags.RuleName)] + public string RuleName { get; set; } [Tag(Trace.Tags.SpanKind)] public override string SpanKind { get; } @@ -61,7 +62,7 @@ public string PeerService return null; } - return _peerServiceOverride ?? EventBusName; + return _peerServiceOverride ?? RuleName; } private set => _peerServiceOverride = value; } @@ -78,7 +79,7 @@ public string PeerServiceSource return _peerServiceOverride is not null ? "peer.service" - : Trace.Tags.EventBusName; + : Trace.Tags.RuleName; } } } diff --git a/tracer/src/Datadog.Trace/Tags.cs b/tracer/src/Datadog.Trace/Tags.cs index 7f7b0a310336..ae10f9968abb 100644 --- a/tracer/src/Datadog.Trace/Tags.cs +++ b/tracer/src/Datadog.Trace/Tags.cs @@ -431,9 +431,9 @@ public static partial class Tags internal const string AwsQueueUrl = "aws.queue.url"; /// - /// The event bus name associated with the span. + /// The rule name associated with the AWS EventBridge span. /// - internal const string EventBusName = "eventbusname"; + internal const string RuleName = "rulename"; /// /// The stream name associated with the AWS SDK Kinesis span. diff --git a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs index a68107e0bc48..42175b9d9a16 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs @@ -230,7 +230,7 @@ public static Result IsAwsEventBridgeRequestV0(this MockSpan span) => Result.Fro .IsPresent("aws.requestId") .Matches("aws.service", "EventBridge") .Matches("aws_service", "EventBridge") - .IsPresent("eventbusname") + .IsPresent("rulename") .IsPresent("http.method") .IsPresent("http.status_code") .IsPresent("http.url") diff --git a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs index b6914a3fca2f..570f0fa5baae 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs @@ -341,7 +341,7 @@ public static Result IsAwsEventBridgeInboundV1(this MockSpan span) => Result.Fro .IsPresent("aws.requestId") .Matches("aws.service", "EventBridge") .Matches("aws_service", "EventBridge") - .IsPresent("eventbusname") + .IsPresent("rulename") .IsPresent("http.method") .IsPresent("http.status_code") .IsPresent("http.url") @@ -361,13 +361,13 @@ public static Result IsAwsEventBridgeOutboundV1(this MockSpan span) => Result.Fr .IsPresent("aws.requestId") .Matches("aws.service", "EventBridge") .Matches("aws_service", "EventBridge") - .IsPresent("eventbusname") + .IsPresent("rulename") .IsPresent("http.method") .IsPresent("http.status_code") .IsPresent("http.url") .IsPresent("peer.service") .IsOptional("peer.service.remapped_from") - .MatchesOneOf("_dd.peer.service.source", "eventbusname", "peer.service") + .MatchesOneOf("_dd.peer.service.source", "rulename", "peer.service") .Matches("component", "aws-sdk") .Matches("span.kind", "producer")); @@ -383,7 +383,7 @@ public static Result IsAwsEventBridgeRequestV1(this MockSpan span) => Result.Fro .IsPresent("aws.requestId") .Matches("aws.service", "EventBridge") .Matches("aws_service", "EventBridge") - .IsPresent("eventbusname") + .IsPresent("rulename") .IsPresent("http.method") .IsPresent("http.status_code") .IsPresent("http.url") diff --git a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt index 15ad1d449729..56ec8855d9f1 100644 --- a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt +++ b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV0.verified.txt @@ -58,11 +58,11 @@ aws_service: EventBridge, component: aws-sdk, env: integration_tests, - eventbusname: MyEventBus, http.method: POST, http.status_code: 200, http.url: http://localhost:00000/, language: dotnet, + rulename: MyEventBus, runtime-id: Guid_1, span.kind: client, _dd.base_service: Samples.AWS.EventBridge diff --git a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV1.verified.txt b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV1.verified.txt index 6f7dc36e286e..4340b9c68aef 100644 --- a/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV1.verified.txt +++ b/tracer/test/snapshots/AwsEventBridgeTests.NetCore.SchemaV1.verified.txt @@ -55,14 +55,14 @@ aws_service: EventBridge, component: aws-sdk, env: integration_tests, - eventbusname: MyEventBus, http.method: POST, http.status_code: 200, http.url: http://localhost:00000/, language: dotnet, peer.service: MyEventBus, + rulename: MyEventBus, span.kind: producer, - _dd.peer.service.source: eventbusname + _dd.peer.service.source: rulename } }, { From 311a8c640ff1f951ff64490870f09f879e202043 Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Tue, 8 Oct 2024 11:41:17 -0400 Subject: [PATCH 13/15] Add size limit check --- .../AWS/EventBridge/ContextPropagation.cs | 15 +++++- .../EventBridge/ContextPropagationTests.cs | 48 +++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs index 5cc9fbb94489..246cffe2ea20 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs @@ -20,6 +20,7 @@ internal static class ContextPropagation private const string DatadogKey = "_datadog"; private const string StartTimeKey = "x-datadog-start-time"; private const string ResourceNameKey = "x-datadog-resource-name"; + private const int MaxSizeBytes = 256 * 1024; // 256 KB // Loops through all entries of the EventBridge event and tries to inject Datadog context into each. public static void InjectTracingContext(TPutEventsRequest request, SpanContext context) @@ -49,7 +50,7 @@ private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanCo if (!detail.EndsWith("}")) { // Unable to parse detail string, so just leave it unmodified. Don't inject trace context. - Log.Debug("Unable to parse detail string. Not injecting trace context."); + Log.Information("Unable to parse detail string. Not injecting trace context."); return; } @@ -62,7 +63,17 @@ private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanCo var traceContext = BuildTraceContextJson(context, entry.EventBusName); detailBuilder.Append($"\"{DatadogKey}\":{traceContext}").Append('}'); - entry.Detail = Util.StringBuilderCache.GetStringAndRelease(detailBuilder); + + // Check new detail size + var updatedDetail = Util.StringBuilderCache.GetStringAndRelease(detailBuilder); + var byteSize = Encoding.UTF8.GetByteCount(updatedDetail); + if (byteSize >= MaxSizeBytes) + { + Log.Information("Payload size too large to pass context"); + return; + } + + entry.Detail = updatedDetail; } // Builds a JSON string containing Datadog trace context diff --git a/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/ContextPropagationTests.cs b/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/ContextPropagationTests.cs index 748c66a5f8a4..2ee2ab127a72 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/ContextPropagationTests.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/ContextPropagationTests.cs @@ -7,6 +7,7 @@ using System.Collections; using System.Collections.Generic; +using System.Text; using Amazon.EventBridge.Model; using Datadog.Trace.ClrProfiler.AutoInstrumentation.AWS.EventBridge; using Datadog.Trace.DuckTyping; @@ -22,6 +23,7 @@ public class ContextPropagationTests private const string StartTimeKey = "x-datadog-start-time"; private const string ResourceNameKey = "x-datadog-resource-name"; private const string EventBusName = "test-event-bus"; + private const int MaxSizeBytes = 256 * 1024; // 256 KB private readonly SpanContext _spanContext; @@ -223,6 +225,52 @@ public void InjectTracingContext_NullEventBusName_OmitsResourceName() extractedTraceContext[StartTimeKey].Should().NotBeNullOrEmpty(); } + [Fact] + public void InjectTracingContext_PayloadTooLarge_DoesNotAddTraceContext() + { + var largeDetail = new string('a', MaxSizeBytes); + var request = GeneratePutEventsRequest([ + new PutEventsRequestEntry { Detail = $"{{{largeDetail}}}", EventBusName = EventBusName } + ]); + + var proxy = request.DuckCast(); + + ContextPropagation.InjectTracingContext(proxy, _spanContext); + + var entries = (IList)proxy.Entries.Value!; + entries.Count.Should().Be(1); + var entry = (PutEventsRequestEntry)entries[0]!; + + entry.Detail.Should().Be($"{{{largeDetail}}}"); + } + + [Fact] + public void InjectTracingContext_PayloadJustUnderLimit_AddsTraceContext() + { + var detailSize = MaxSizeBytes - 1000; // Leave some room for the trace context + var largeDetail = new string('a', detailSize); + var request = GeneratePutEventsRequest([ + new PutEventsRequestEntry { Detail = $"{{\"large\":\"{largeDetail}\"}}", EventBusName = EventBusName } + ]); + + var proxy = request.DuckCast(); + + ContextPropagation.InjectTracingContext(proxy, _spanContext); + + var entries = (IList)proxy.Entries.Value!; + entries.Count.Should().Be(1); + var entry = (PutEventsRequestEntry)entries[0]!; + + var detail = JsonConvert.DeserializeObject>(entry.Detail); + detail.Should().NotBeNull(); + detail!.Count.Should().Be(2); + detail.Should().ContainKey("large"); + detail.Should().ContainKey(DatadogKey); + + var byteSize = Encoding.UTF8.GetByteCount(entry.Detail); + byteSize.Should().BeLessThan(MaxSizeBytes); + } + private static PutEventsRequest GeneratePutEventsRequest(List entries) { return new PutEventsRequest { Entries = entries }; From c04872a5a97c69dd98e530fb6202dcce2492ad6a Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Fri, 11 Oct 2024 09:32:13 -0400 Subject: [PATCH 14/15] Change log level; add comments --- .../AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs | 4 ++-- .../AWS/EventBridge/PutEventsAsyncIntegration.cs | 2 ++ .../AWS/EventBridge/PutEventsIntegration.cs | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs index 246cffe2ea20..932ee8619935 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs @@ -50,7 +50,7 @@ private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanCo if (!detail.EndsWith("}")) { // Unable to parse detail string, so just leave it unmodified. Don't inject trace context. - Log.Information("Unable to parse detail string. Not injecting trace context."); + Log.Debug("Unable to parse detail string. Not injecting trace context."); return; } @@ -69,7 +69,7 @@ private static void InjectHeadersIntoDetail(IPutEventsRequestEntry entry, SpanCo var byteSize = Encoding.UTF8.GetByteCount(updatedDetail); if (byteSize >= MaxSizeBytes) { - Log.Information("Payload size too large to pass context"); + Log.Debug("Payload size too large to pass context"); return; } diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs index 29462812391a..9e0087c7249e 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs @@ -55,6 +55,8 @@ internal static CallTargetState OnMethodBegin(TTarge var busName = AwsEventBridgeCommon.GetBusName(request.Entries.Value); if (busName is not null) { + // We use RuleName to stay consistent with other runtimes + // TODO rename rulename tag to busname across all runtimes tags.RuleName = busName; } } diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs index d593afc9bf73..b0425053fe15 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs @@ -52,6 +52,8 @@ internal static CallTargetState OnMethodBegin(TTarge var busName = AwsEventBridgeCommon.GetBusName(request.Entries.Value); if (busName is not null) { + // We use RuleName to stay consistent with other runtimes + // TODO rename rulename tag to busname across all runtimes tags.RuleName = busName; } } From 57cf577350635dca4fd07f73a724e9ce44b74ef9 Mon Sep 17 00:00:00 2001 From: Nicholas Hulston Date: Fri, 11 Oct 2024 14:44:46 -0400 Subject: [PATCH 15/15] Add nullability annotations to AwsEventBridgeTags.cs --- tracer/missing-nullability-files.csv | 1 - tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tracer/missing-nullability-files.csv b/tracer/missing-nullability-files.csv index 757fef1bcca9..ad2464eeee8e 100644 --- a/tracer/missing-nullability-files.csv +++ b/tracer/missing-nullability-files.csv @@ -200,7 +200,6 @@ src/Datadog.Trace/Tagging/AspNetCoreMvcTags.cs src/Datadog.Trace/Tagging/AspNetCoreTags.cs src/Datadog.Trace/Tagging/AspNetTags.cs src/Datadog.Trace/Tagging/AwsDynamoDbTags.cs -src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs src/Datadog.Trace/Tagging/AwsKinesisTags.cs src/Datadog.Trace/Tagging/AwsSdkTags.cs src/Datadog.Trace/Tagging/AwsSnsTags.cs diff --git a/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs b/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs index 5d2526ab3386..e7318dac9430 100644 --- a/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs +++ b/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs @@ -3,6 +3,8 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. // +#nullable enable + using System; using Datadog.Trace.SourceGenerators; @@ -23,7 +25,7 @@ public AwsEventBridgeTags(string spanKind) // TODO rename the `rulename` tag to `eventbusname` across all runtimes [Tag(Trace.Tags.RuleName)] - public string RuleName { get; set; } + public string? RuleName { get; set; } [Tag(Trace.Tags.SpanKind)] public override string SpanKind { get; } @@ -31,7 +33,7 @@ public AwsEventBridgeTags(string spanKind) internal partial class AwsEventBridgeV1Tags : AwsEventBridgeTags { - private string _peerServiceOverride = null; + private string? _peerServiceOverride; // For the sake of unit tests, define a default constructor // though the AWS EventBridge integration should use the constructor that takes a @@ -53,7 +55,7 @@ public AwsEventBridgeV1Tags(string spanKind) // However, this can still be set from ITags.SetTag so the user can // customize the value if they wish. [Tag(Trace.Tags.PeerService)] - public string PeerService + public string? PeerService { get { @@ -68,7 +70,7 @@ public string PeerService } [Tag(Trace.Tags.PeerServiceSource)] - public string PeerServiceSource + public string? PeerServiceSource { get {