Skip to content

Commit 9818224

Browse files
[Azure Event Grid] Register outbound SDK calltargets
1 parent 4a68967 commit 9818224

18 files changed

Lines changed: 1871 additions & 1129 deletions

File tree

tracer/build/_build/Honeypot/IntegrationGroups.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ static IntegrationMap()
108108
NugetPackages.Add("Microsoft.AspNetCore.Diagnostics", new[] { "Microsoft.AspNetCore.Diagnostics" });
109109
NugetPackages.Add("Azure.Messaging.ServiceBus", new string[] { "Azure.Messaging.ServiceBus" });
110110
NugetPackages.Add("Azure.Messaging.EventHubs", new string[] { "Azure.Messaging.EventHubs" });
111+
NugetPackages.Add("Azure.Messaging.EventGrid", new string[] { "Azure.Messaging.EventGrid" });
112+
NugetPackages.Add("Azure.Messaging.EventGrid.Namespaces", new string[] { "Azure.Messaging.EventGrid.Namespaces" });
111113
NugetPackages.Add("amqmdnetstd", new [] { "IBMMQDotnetClient" });
112114
NugetPackages.Add("Ocelot", new [] { "Ocelot" });
113115
NugetPackages.Add("Yarp.ReverseProxy", new [] { "Yarp.ReverseProxy" });

tracer/build/supported_calltargets.g.json

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,6 +3508,258 @@
35083508
"IsAdoNetIntegration": false,
35093509
"InstrumentationCategory": 1
35103510
},
3511+
{
3512+
"IntegrationName": "AzureEventGrid",
3513+
"AssemblyName": "Azure.Messaging.EventGrid",
3514+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3515+
"TargetMethodName": "SendEvents",
3516+
"TargetReturnType": "Azure.Response",
3517+
"TargetParameterTypes": [
3518+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3519+
"System.Threading.CancellationToken"
3520+
],
3521+
"MinimumVersion": {
3522+
"Item1": 4,
3523+
"Item2": 0,
3524+
"Item3": 0
3525+
},
3526+
"MaximumVersion": {
3527+
"Item1": 5,
3528+
"Item2": 65535,
3529+
"Item3": 65535
3530+
},
3531+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsIntegration",
3532+
"IntegrationKind": 0,
3533+
"IsAdoNetIntegration": false,
3534+
"InstrumentationCategory": 1
3535+
},
3536+
{
3537+
"IntegrationName": "AzureEventGrid",
3538+
"AssemblyName": "Azure.Messaging.EventGrid",
3539+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3540+
"TargetMethodName": "SendEvents",
3541+
"TargetReturnType": "Azure.Response",
3542+
"TargetParameterTypes": [
3543+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3544+
"System.String",
3545+
"System.Threading.CancellationToken"
3546+
],
3547+
"MinimumVersion": {
3548+
"Item1": 4,
3549+
"Item2": 11,
3550+
"Item3": 0
3551+
},
3552+
"MaximumVersion": {
3553+
"Item1": 5,
3554+
"Item2": 65535,
3555+
"Item3": 65535
3556+
},
3557+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsToChannelIntegration",
3558+
"IntegrationKind": 0,
3559+
"IsAdoNetIntegration": false,
3560+
"InstrumentationCategory": 1
3561+
},
3562+
{
3563+
"IntegrationName": "AzureEventGrid",
3564+
"AssemblyName": "Azure.Messaging.EventGrid",
3565+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3566+
"TargetMethodName": "SendEvents",
3567+
"TargetReturnType": "Azure.Response",
3568+
"TargetParameterTypes": [
3569+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.EventGrid.EventGridEvent]",
3570+
"System.Threading.CancellationToken"
3571+
],
3572+
"MinimumVersion": {
3573+
"Item1": 4,
3574+
"Item2": 0,
3575+
"Item3": 0
3576+
},
3577+
"MaximumVersion": {
3578+
"Item1": 5,
3579+
"Item2": 65535,
3580+
"Item3": 65535
3581+
},
3582+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendEventsIntegration",
3583+
"IntegrationKind": 0,
3584+
"IsAdoNetIntegration": false,
3585+
"InstrumentationCategory": 1
3586+
},
3587+
{
3588+
"IntegrationName": "AzureEventGrid",
3589+
"AssemblyName": "Azure.Messaging.EventGrid",
3590+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3591+
"TargetMethodName": "SendEventsAsync",
3592+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3593+
"TargetParameterTypes": [
3594+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3595+
"System.Threading.CancellationToken"
3596+
],
3597+
"MinimumVersion": {
3598+
"Item1": 4,
3599+
"Item2": 0,
3600+
"Item3": 0
3601+
},
3602+
"MaximumVersion": {
3603+
"Item1": 5,
3604+
"Item2": 65535,
3605+
"Item3": 65535
3606+
},
3607+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsAsyncIntegration",
3608+
"IntegrationKind": 0,
3609+
"IsAdoNetIntegration": false,
3610+
"InstrumentationCategory": 1
3611+
},
3612+
{
3613+
"IntegrationName": "AzureEventGrid",
3614+
"AssemblyName": "Azure.Messaging.EventGrid",
3615+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3616+
"TargetMethodName": "SendEventsAsync",
3617+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3618+
"TargetParameterTypes": [
3619+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3620+
"System.String",
3621+
"System.Threading.CancellationToken"
3622+
],
3623+
"MinimumVersion": {
3624+
"Item1": 4,
3625+
"Item2": 11,
3626+
"Item3": 0
3627+
},
3628+
"MaximumVersion": {
3629+
"Item1": 5,
3630+
"Item2": 65535,
3631+
"Item3": 65535
3632+
},
3633+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsToChannelAsyncIntegration",
3634+
"IntegrationKind": 0,
3635+
"IsAdoNetIntegration": false,
3636+
"InstrumentationCategory": 1
3637+
},
3638+
{
3639+
"IntegrationName": "AzureEventGrid",
3640+
"AssemblyName": "Azure.Messaging.EventGrid",
3641+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3642+
"TargetMethodName": "SendEventsAsync",
3643+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3644+
"TargetParameterTypes": [
3645+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.EventGrid.EventGridEvent]",
3646+
"System.Threading.CancellationToken"
3647+
],
3648+
"MinimumVersion": {
3649+
"Item1": 4,
3650+
"Item2": 0,
3651+
"Item3": 0
3652+
},
3653+
"MaximumVersion": {
3654+
"Item1": 5,
3655+
"Item2": 65535,
3656+
"Item3": 65535
3657+
},
3658+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendEventsAsyncIntegration",
3659+
"IntegrationKind": 0,
3660+
"IsAdoNetIntegration": false,
3661+
"InstrumentationCategory": 1
3662+
},
3663+
{
3664+
"IntegrationName": "AzureEventGrid",
3665+
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
3666+
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
3667+
"TargetMethodName": "Send",
3668+
"TargetReturnType": "Azure.Response",
3669+
"TargetParameterTypes": [
3670+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3671+
"System.Threading.CancellationToken"
3672+
],
3673+
"MinimumVersion": {
3674+
"Item1": 1,
3675+
"Item2": 0,
3676+
"Item3": 0
3677+
},
3678+
"MaximumVersion": {
3679+
"Item1": 1,
3680+
"Item2": 65535,
3681+
"Item3": 65535
3682+
},
3683+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendEventsIntegration",
3684+
"IntegrationKind": 0,
3685+
"IsAdoNetIntegration": false,
3686+
"InstrumentationCategory": 1
3687+
},
3688+
{
3689+
"IntegrationName": "AzureEventGrid",
3690+
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
3691+
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
3692+
"TargetMethodName": "Send",
3693+
"TargetReturnType": "Azure.Response",
3694+
"TargetParameterTypes": [
3695+
"Azure.Messaging.CloudEvent",
3696+
"System.Threading.CancellationToken"
3697+
],
3698+
"MinimumVersion": {
3699+
"Item1": 1,
3700+
"Item2": 0,
3701+
"Item3": 0
3702+
},
3703+
"MaximumVersion": {
3704+
"Item1": 1,
3705+
"Item2": 65535,
3706+
"Item3": 65535
3707+
},
3708+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendIntegration",
3709+
"IntegrationKind": 0,
3710+
"IsAdoNetIntegration": false,
3711+
"InstrumentationCategory": 1
3712+
},
3713+
{
3714+
"IntegrationName": "AzureEventGrid",
3715+
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
3716+
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
3717+
"TargetMethodName": "SendAsync",
3718+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3719+
"TargetParameterTypes": [
3720+
"Azure.Messaging.CloudEvent",
3721+
"System.Threading.CancellationToken"
3722+
],
3723+
"MinimumVersion": {
3724+
"Item1": 1,
3725+
"Item2": 0,
3726+
"Item3": 0
3727+
},
3728+
"MaximumVersion": {
3729+
"Item1": 1,
3730+
"Item2": 65535,
3731+
"Item3": 65535
3732+
},
3733+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendAsyncIntegration",
3734+
"IntegrationKind": 0,
3735+
"IsAdoNetIntegration": false,
3736+
"InstrumentationCategory": 1
3737+
},
3738+
{
3739+
"IntegrationName": "AzureEventGrid",
3740+
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
3741+
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
3742+
"TargetMethodName": "SendAsync",
3743+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3744+
"TargetParameterTypes": [
3745+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3746+
"System.Threading.CancellationToken"
3747+
],
3748+
"MinimumVersion": {
3749+
"Item1": 1,
3750+
"Item2": 0,
3751+
"Item3": 0
3752+
},
3753+
"MaximumVersion": {
3754+
"Item1": 1,
3755+
"Item2": 65535,
3756+
"Item3": 65535
3757+
},
3758+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendEventsAsyncIntegration",
3759+
"IntegrationKind": 0,
3760+
"IsAdoNetIntegration": false,
3761+
"InstrumentationCategory": 1
3762+
},
35113763
{
35123764
"IntegrationName": "AzureEventHubs",
35133765
"AssemblyName": "Azure.Messaging.EventHubs",

tracer/src/Datadog.Trace.Trimming/build/Datadog.Trace.Trimming.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
<assembly fullname="AWSSDK.SimpleNotificationService" />
1111
<assembly fullname="AWSSDK.SQS" />
1212
<assembly fullname="AWSSDK.StepFunctions" />
13+
<assembly fullname="Azure.Messaging.EventGrid" />
14+
<assembly fullname="Azure.Messaging.EventGrid.Namespaces" />
1315
<assembly fullname="Azure.Messaging.EventHubs" />
1416
<assembly fullname="Azure.Messaging.ServiceBus" />
1517
<assembly fullname="Confluent.Kafka" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// <copyright file="EventGridPublisherClientSendCloudEventsAsyncIntegration.cs" company="Datadog">
2+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
3+
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
4+
// </copyright>
5+
6+
#nullable enable
7+
8+
using System;
9+
using System.ComponentModel;
10+
using System.Threading;
11+
using Datadog.Trace.ClrProfiler.CallTarget;
12+
using Datadog.Trace.Configuration;
13+
14+
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid;
15+
16+
/// <summary>
17+
/// Azure.Messaging.EventGrid.EventGridPublisherClient.SendEventsAsync calltarget instrumentation for IEnumerable&lt;CloudEvent&gt;
18+
/// </summary>
19+
[InstrumentMethod(
20+
AssemblyName = "Azure.Messaging.EventGrid",
21+
TypeName = "Azure.Messaging.EventGrid.EventGridPublisherClient",
22+
MethodName = "SendEventsAsync",
23+
ReturnTypeName = "System.Threading.Tasks.Task`1[Azure.Response]",
24+
ParameterTypeNames = ["System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]", ClrNames.CancellationToken],
25+
MinimumVersion = "4.0.0",
26+
MaximumVersion = "5.*.*",
27+
IntegrationName = nameof(IntegrationId.AzureEventGrid))]
28+
[Browsable(false)]
29+
[EditorBrowsable(EditorBrowsableState.Never)]
30+
public sealed class EventGridPublisherClientSendCloudEventsAsyncIntegration
31+
{
32+
internal static CallTargetState OnMethodBegin<TTarget, TEvents>(TTarget instance, ref TEvents events, CancellationToken cancellationToken)
33+
{
34+
return EventGridCommon.CreateProducerSpan(instance, ref events, injectContext: true);
35+
}
36+
37+
internal static TReturn OnAsyncMethodEnd<TTarget, TReturn>(TTarget instance, TReturn returnValue, Exception? exception, in CallTargetState state)
38+
{
39+
state.Scope?.DisposeWithException(exception);
40+
return returnValue;
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// <copyright file="EventGridPublisherClientSendCloudEventsIntegration.cs" company="Datadog">
2+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
3+
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
4+
// </copyright>
5+
6+
#nullable enable
7+
8+
using System;
9+
using System.ComponentModel;
10+
using System.Threading;
11+
using Datadog.Trace.ClrProfiler.CallTarget;
12+
using Datadog.Trace.Configuration;
13+
14+
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid;
15+
16+
/// <summary>
17+
/// Azure.Messaging.EventGrid.EventGridPublisherClient.SendEvents calltarget instrumentation for IEnumerable&lt;CloudEvent&gt;
18+
/// </summary>
19+
[InstrumentMethod(
20+
AssemblyName = "Azure.Messaging.EventGrid",
21+
TypeName = "Azure.Messaging.EventGrid.EventGridPublisherClient",
22+
MethodName = "SendEvents",
23+
ReturnTypeName = "Azure.Response",
24+
ParameterTypeNames = ["System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]", ClrNames.CancellationToken],
25+
MinimumVersion = "4.0.0",
26+
MaximumVersion = "5.*.*",
27+
IntegrationName = nameof(IntegrationId.AzureEventGrid))]
28+
[Browsable(false)]
29+
[EditorBrowsable(EditorBrowsableState.Never)]
30+
public sealed class EventGridPublisherClientSendCloudEventsIntegration
31+
{
32+
internal static CallTargetState OnMethodBegin<TTarget, TEvents>(TTarget instance, ref TEvents events, CancellationToken cancellationToken)
33+
{
34+
return EventGridCommon.CreateProducerSpan(instance, ref events, injectContext: true);
35+
}
36+
37+
internal static CallTargetReturn<TReturn> OnMethodEnd<TTarget, TReturn>(TTarget instance, TReturn returnValue, Exception? exception, in CallTargetState state)
38+
{
39+
state.Scope?.DisposeWithException(exception);
40+
return new(returnValue);
41+
}
42+
}

0 commit comments

Comments
 (0)