Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tracer/build/_build/Honeypot/IntegrationGroups.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ static IntegrationMap()
NugetPackages.Add("Microsoft.AspNetCore.Diagnostics", new[] { "Microsoft.AspNetCore.Diagnostics" });
NugetPackages.Add("Azure.Messaging.ServiceBus", new string[] { "Azure.Messaging.ServiceBus" });
NugetPackages.Add("Azure.Messaging.EventHubs", new string[] { "Azure.Messaging.EventHubs" });
NugetPackages.Add("Azure.Messaging.EventGrid", new string[] { "Azure.Messaging.EventGrid" });
NugetPackages.Add("Azure.Messaging.EventGrid.Namespaces", new string[] { "Azure.Messaging.EventGrid.Namespaces" });
NugetPackages.Add("amqmdnetstd", new [] { "IBMMQDotnetClient" });
NugetPackages.Add("Ocelot", new [] { "Ocelot" });
NugetPackages.Add("Yarp.ReverseProxy", new [] { "Yarp.ReverseProxy" });
Expand Down
302 changes: 302 additions & 0 deletions tracer/build/supported_calltargets.g.json
Original file line number Diff line number Diff line change
Expand Up @@ -3611,6 +3611,308 @@
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid",
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
"TargetMethodName": "SendEvents",
"TargetReturnType": "Azure.Response",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 4,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 5,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid",
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
"TargetMethodName": "SendEvents",
"TargetReturnType": "Azure.Response",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
"System.String",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 4,
"Item2": 11,
"Item3": 0
},
"MaximumVersion": {
"Item1": 5,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsToChannelIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid",
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
"TargetMethodName": "SendEvents",
"TargetReturnType": "Azure.Response",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[System.BinaryData]",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 4,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 5,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCustomEventsIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid",
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
"TargetMethodName": "SendEvents",
"TargetReturnType": "Azure.Response",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.EventGrid.EventGridEvent]",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 4,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 5,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendEventsIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid",
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
"TargetMethodName": "SendEventsAsync",
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 4,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 5,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsAsyncIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid",
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
"TargetMethodName": "SendEventsAsync",
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
"System.String",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 4,
"Item2": 11,
"Item3": 0
},
"MaximumVersion": {
"Item1": 5,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsToChannelAsyncIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid",
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
"TargetMethodName": "SendEventsAsync",
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[System.BinaryData]",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 4,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 5,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCustomEventsAsyncIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid",
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
"TargetMethodName": "SendEventsAsync",
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.EventGrid.EventGridEvent]",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 4,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 5,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendEventsAsyncIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
"TargetMethodName": "Send",
"TargetReturnType": "Azure.Response",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 1,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 1,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendEventsIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
"TargetMethodName": "Send",
"TargetReturnType": "Azure.Response",
"TargetParameterTypes": [
"Azure.Messaging.CloudEvent",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 1,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 1,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
"TargetMethodName": "SendAsync",
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
"TargetParameterTypes": [
"Azure.Messaging.CloudEvent",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 1,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 1,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendAsyncIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventGrid",
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
"TargetMethodName": "SendAsync",
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
"TargetParameterTypes": [
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
"System.Threading.CancellationToken"
],
"MinimumVersion": {
"Item1": 1,
"Item2": 0,
"Item3": 0
},
"MaximumVersion": {
"Item1": 1,
"Item2": 65535,
"Item3": 65535
},
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendEventsAsyncIntegration",
"IntegrationKind": 0,
"IsAdoNetIntegration": false,
"InstrumentationCategory": 1
},
{
"IntegrationName": "AzureEventHubs",
"AssemblyName": "Azure.Messaging.EventHubs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<assembly fullname="AWSSDK.SimpleNotificationService" />
<assembly fullname="AWSSDK.SQS" />
<assembly fullname="AWSSDK.StepFunctions" />
<assembly fullname="Azure.Messaging.EventGrid" />
<assembly fullname="Azure.Messaging.EventGrid.Namespaces" />
<assembly fullname="Azure.Messaging.EventHubs" />
<assembly fullname="Azure.Messaging.ServiceBus" />
<assembly fullname="Confluent.Kafka" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// <copyright file="EventGridPublisherClientSendCloudEventsAsyncIntegration.cs" company="Datadog">
// 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.
// </copyright>

#nullable enable

using System;
using System.ComponentModel;
using System.Threading;
using Datadog.Trace.ClrProfiler.CallTarget;
using Datadog.Trace.Configuration;

namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid;

/// <summary>
/// Azure.Messaging.EventGrid.EventGridPublisherClient.SendEventsAsync calltarget instrumentation for IEnumerable&lt;CloudEvent&gt;
/// </summary>
[InstrumentMethod(
AssemblyName = "Azure.Messaging.EventGrid",
TypeName = "Azure.Messaging.EventGrid.EventGridPublisherClient",
MethodName = "SendEventsAsync",
ReturnTypeName = "System.Threading.Tasks.Task`1[Azure.Response]",
ParameterTypeNames = ["System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]", ClrNames.CancellationToken],
MinimumVersion = "4.0.0",
MaximumVersion = "5.*.*",
IntegrationName = nameof(IntegrationId.AzureEventGrid))]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public sealed class EventGridPublisherClientSendCloudEventsAsyncIntegration
{
internal static CallTargetState OnMethodBegin<TTarget, TEvents>(TTarget instance, ref TEvents events, CancellationToken cancellationToken)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the best duck-typing performance, you should add a generic constraint so we do the ducktyping upfront and we don't have to do it later on in downstream method calls. And then in the EventGridCommon.CreateProducerSpan you can do the same, where you have the generic constraint TTarget : IEventGridPublisherClient

Suggested change
internal static CallTargetState OnMethodBegin<TTarget, TEvents>(TTarget instance, ref TEvents events, CancellationToken cancellationToken)
internal static CallTargetState OnMethodBegin<TTarget, TEvents>(TTarget instance, ref TEvents events, CancellationToken cancellationToken)
where TTarget : IEventGridPublisherClient

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feedback applies to all the calltarget OnMethodBegin's where you call EventGridCommon.CreateProducerSpan

where TTarget : IEventGridPublisherClient
{
return EventGridCommon.CreateProducerSpan(instance, ref events, injectContext: true);
}

internal static TReturn OnAsyncMethodEnd<TTarget, TReturn>(TTarget instance, TReturn returnValue, Exception? exception, in CallTargetState state)
{
state.Scope?.DisposeWithException(exception);
return returnValue;
}
}
Loading
Loading