diff --git a/Datadog.Trace.sln b/Datadog.Trace.sln index 4525f4ce2d2a..4f23e5c3a92e 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 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoadContextResolve", "tracer\test\test-applications\regression\AssemblyLoadContextResolve\AssemblyLoadContextResolve.csproj", "{8B1AF6A7-DD41-4347-B637-90C23D69B50E}" EndProject Global @@ -1411,6 +1413,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 {8B1AF6A7-DD41-4347-B637-90C23D69B50E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8B1AF6A7-DD41-4347-B637-90C23D69B50E}.Debug|Any CPU.Build.0 = Debug|Any CPU {8B1AF6A7-DD41-4347-B637-90C23D69B50E}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/docker-compose.yml b/docker-compose.yml index 2b73089d2613..be0e1399d555 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 @@ -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 @@ -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 diff --git a/tracer/build/PackageVersionsGeneratorDefinitions.json b/tracer/build/PackageVersionsGeneratorDefinitions.json index 2422b2b5a663..7b36c28fafe3 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": "4.0.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/PackageVersionsLatestMajors.g.props b/tracer/build/PackageVersionsLatestMajors.g.props index 05637bc1273d..1b5fdee2ad39 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.25;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + All + 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 a8f5ae5cc008..e9e8132d21e4 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 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + All + 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 ae6d4e38f9c5..72d56d8183ab 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 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp2.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.3.102.16;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.5.6.5;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + All + Samples.AWS.EventBridge + + + ApiVersion=3.7.401.25;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + All + Samples.AWS.EventBridge + ApiVersion=2.0.2;RestoreRecursive=false;BuildProjectReferences=false net462 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/build/supported_versions.json b/tracer/build/supported_versions.json index 4a8d1734a66d..424e2f4676a6 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.25", + "maxVersionAvailableInclusive": "3.7.401.25", + "maxVersionTestedInclusive": "3.7.401.25" + } + ] + }, { "integrationName": "AwsKinesis", "assemblyName": "AWSSDK.Kinesis", diff --git a/tracer/dependabot/Datadog.Dependabot.Integrations.csproj b/tracer/dependabot/Datadog.Dependabot.Integrations.csproj index e6702cd9f4a4..0df3bd8564a8 100644 --- a/tracer/dependabot/Datadog.Dependabot.Integrations.csproj +++ b/tracer/dependabot/Datadog.Dependabot.Integrations.csproj @@ -26,6 +26,11 @@ + + + + + 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..b8fd04046b8a 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 @@ + 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..5771f0ea58de --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/AwsEventBridgeCommon.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. +// + +#nullable enable + +using System; +using System.Collections; +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) + { + 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) + { + 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..932ee8619935 --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/ContextPropagation.cs @@ -0,0 +1,107 @@ +// +// 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.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"; + 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) + 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); + } + } + } + + // 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) + { + var detail = entry.Detail?.Trim() ?? "{}"; + 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."); + 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 = BuildTraceContextJson(context, entry.EventBusName); + detailBuilder.Append($"\"{DatadogKey}\":{traceContext}").Append('}'); + + // Check new detail size + var updatedDetail = Util.StringBuilderCache.GetStringAndRelease(detailBuilder); + var byteSize = Encoding.UTF8.GetByteCount(updatedDetail); + if (byteSize >= MaxSizeBytes) + { + Log.Debug("Payload size too large to pass context"); + return; + } + + entry.Detail = updatedDetail; + } + + // 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); + 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..24ffc331be3d --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/IPutEventsRequestEntry.cs @@ -0,0 +1,20 @@ +// +// 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 + +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 new file mode 100644 index 000000000000..9e0087c7249e --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsAsyncIntegration.cs @@ -0,0 +1,77 @@ +// +// 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.DuckTyping; + +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 = AwsEventBridgeCommon.IntegrationName)] +[Browsable(false)] +[EditorBrowsable(EditorBrowsableState.Never)] +public class PutEventsAsyncIntegration +{ + 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 + { + 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) + { + // We use RuleName to stay consistent with other runtimes + // TODO rename rulename tag to busname across all runtimes + tags.RuleName = busName; + } + } + + if (scope?.Span.Context is { } context) + { + ContextPropagation.InjectTracingContext(request, context); + } + + return new CallTargetState(scope); + } + + internal static TResponse OnAsyncMethodEnd(TTarget instance, TResponse response, Exception exception, in CallTargetState state) + { + 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 new file mode 100644 index 000000000000..b0425053fe15 --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AWS/EventBridge/PutEventsIntegration.cs @@ -0,0 +1,74 @@ +// +// 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.DuckTyping; + +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 = AwsEventBridgeCommon.IntegrationName)] +[Browsable(false)] +[EditorBrowsable(EditorBrowsableState.Never)] +public class PutEventsIntegration +{ + 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 + { + 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) + { + // We use RuleName to stay consistent with other runtimes + // TODO rename rulename tag to busname across all runtimes + tags.RuleName = 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) + { + state.Scope.DisposeWithException(exception); + 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/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/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 17e7520f63e0..ad9a42fef31b 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..37d81e323399 --- /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 + { + // 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 }; + + public override string? GetTag(string key) + { + return key switch + { + "rulename" => RuleName, + "span.kind" => SpanKind, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "rulename": + RuleName = 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 (RuleName is not null) + { + processor.Process(new TagItem("rulename", RuleName, RuleNameBytes)); + } + + 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 (RuleName is not null) + { + sb.Append("rulename (tag):") + .Append(RuleName) + .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 87fb058e6165..77e7033fab05 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..37d81e323399 --- /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 + { + // 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 }; + + public override string? GetTag(string key) + { + return key switch + { + "rulename" => RuleName, + "span.kind" => SpanKind, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "rulename": + RuleName = 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 (RuleName is not null) + { + processor.Process(new TagItem("rulename", RuleName, RuleNameBytes)); + } + + 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 (RuleName is not null) + { + sb.Append("rulename (tag):") + .Append(RuleName) + .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 afa5fe473e05..b2e39fcb92e5 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..37d81e323399 --- /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 + { + // 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 }; + + public override string? GetTag(string key) + { + return key switch + { + "rulename" => RuleName, + "span.kind" => SpanKind, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "rulename": + RuleName = 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 (RuleName is not null) + { + processor.Process(new TagItem("rulename", RuleName, RuleNameBytes)); + } + + 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 (RuleName is not null) + { + sb.Append("rulename (tag):") + .Append(RuleName) + .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 afa5fe473e05..b2e39fcb92e5 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..37d81e323399 --- /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 + { + // 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 }; + + public override string? GetTag(string key) + { + return key switch + { + "rulename" => RuleName, + "span.kind" => SpanKind, + _ => base.GetTag(key), + }; + } + + public override void SetTag(string key, string value) + { + switch(key) + { + case "rulename": + RuleName = 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 (RuleName is not null) + { + processor.Process(new TagItem("rulename", RuleName, RuleNameBytes)); + } + + 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 (RuleName is not null) + { + sb.Append("rulename (tag):") + .Append(RuleName) + .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/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs b/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.cs new file mode 100644 index 000000000000..e7318dac9430 --- /dev/null +++ b/tracer/src/Datadog.Trace/Tagging/AwsEventBridgeTags.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 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; + } + + // 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; } + } + + internal partial class AwsEventBridgeV1Tags : AwsEventBridgeTags + { + 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 + // 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 ?? RuleName; + } + 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.RuleName; + } + } + } +} diff --git a/tracer/src/Datadog.Trace/Tags.cs b/tracer/src/Datadog.Trace/Tags.cs index 41cf31d53a1f..ae10f9968abb 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 rule name associated with the AWS EventBridge span. + /// + internal const string RuleName = "rulename"; + /// /// The stream name associated with the AWS SDK Kinesis span. /// 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, 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..7479abbf0bf5 --- /dev/null +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs @@ -0,0 +1,114 @@ +// +// 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); + } + } + + [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/PackageVersions.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersions.g.cs index 0e5fa3a2009e..ab939108329a 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 b61954608020..f3865abb665c 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.30" }, #endif +#endif + }; + + public static IEnumerable AwsEventBridge => + + new List + { +#if DEFAULT_SAMPLES + new object[] { string.Empty }, +#else +#if NETCOREAPP2_1 + new object[] { "3.7.401.25" }, +#endif +#if NETCOREAPP3_0 + new object[] { "3.7.401.25" }, +#endif +#if NETCOREAPP3_1 + new object[] { "3.7.401.25" }, +#endif +#if NET5_0 + new object[] { "3.7.401.25" }, +#endif +#if NET6_0 + new object[] { "3.7.401.25" }, +#endif +#if NET7_0 + new object[] { "3.7.401.25" }, +#endif +#if NET8_0 + 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 bb2fa55abcbf..6baa39165360 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.30" }, #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.25" }, +#endif +#if NETCOREAPP3_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + 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.25" }, +#endif +#if NET5_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + 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.25" }, +#endif +#if NET7_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + 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.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 1bf02ed45eaa..7af0d82358f0 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.30" }, #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.25" }, +#endif +#if NETCOREAPP3_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + 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.25" }, +#endif +#if NET5_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + 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.25" }, +#endif +#if NET7_0 + new object[] { "3.3.102.16" }, + new object[] { "3.5.6.5" }, + 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.25" }, +#endif #endif }; 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..2ee2ab127a72 --- /dev/null +++ b/tracer/test/Datadog.Trace.ClrProfiler.Managed.Tests/AutoInstrumentation/AWS/EventBridge/ContextPropagationTests.cs @@ -0,0 +1,278 @@ +// +// 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 System.Text; +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 const int MaxSizeBytes = 256 * 1024; // 256 KB + + 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(); + } + + [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 }; + } +} 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.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 aac25f849adb..42175b9d9a16 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV0Rules.cs @@ -218,6 +218,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("rulename") + .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 4d43a180dc1a..570f0fa5baae 100644 --- a/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs +++ b/tracer/test/Datadog.Trace.TestHelpers/SpanMetadataV1Rules.cs @@ -329,6 +329,69 @@ public static Result IsAwsSnsRequestV1(this MockSpan span) => Result.FromSpan(sp .IsOptional("_dd.base_service") .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("rulename") + .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("rulename") + .IsPresent("http.method") + .IsPresent("http.status_code") + .IsPresent("http.url") + .IsPresent("peer.service") + .IsOptional("peer.service.remapped_from") + .MatchesOneOf("_dd.peer.service.source", "rulename", "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("rulename") + .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/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); + } } } 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..56ec8855d9f1 --- /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, + 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 + }, + 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..4340b9c68aef --- /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, + 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: rulename + } + }, + { + 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/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 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..d9a1bb0635af --- /dev/null +++ b/tracer/test/test-applications/integrations/Samples.AWS.EventBridge/Samples.AWS.EventBridge.csproj @@ -0,0 +1,19 @@ + + + + 3.3.100 + + + false + false + + All + + + + + + + + + \ 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