Skip to content

Commit 7af02af

Browse files
[Azure Event Grid] Register outbound SDK calltargets
1 parent 14823fd commit 7af02af

20 files changed

Lines changed: 2023 additions & 1135 deletions

tracer/build/_build/Honeypot/IntegrationGroups.cs

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

tracer/build/supported_calltargets.g.json

Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,6 +3583,308 @@
35833583
"IsAdoNetIntegration": false,
35843584
"InstrumentationCategory": 1
35853585
},
3586+
{
3587+
"IntegrationName": "AzureEventGrid",
3588+
"AssemblyName": "Azure.Messaging.EventGrid",
3589+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3590+
"TargetMethodName": "SendEvents",
3591+
"TargetReturnType": "Azure.Response",
3592+
"TargetParameterTypes": [
3593+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3594+
"System.Threading.CancellationToken"
3595+
],
3596+
"MinimumVersion": {
3597+
"Item1": 4,
3598+
"Item2": 0,
3599+
"Item3": 0
3600+
},
3601+
"MaximumVersion": {
3602+
"Item1": 5,
3603+
"Item2": 65535,
3604+
"Item3": 65535
3605+
},
3606+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsIntegration",
3607+
"IntegrationKind": 0,
3608+
"IsAdoNetIntegration": false,
3609+
"InstrumentationCategory": 1
3610+
},
3611+
{
3612+
"IntegrationName": "AzureEventGrid",
3613+
"AssemblyName": "Azure.Messaging.EventGrid",
3614+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3615+
"TargetMethodName": "SendEvents",
3616+
"TargetReturnType": "Azure.Response",
3617+
"TargetParameterTypes": [
3618+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3619+
"System.String",
3620+
"System.Threading.CancellationToken"
3621+
],
3622+
"MinimumVersion": {
3623+
"Item1": 4,
3624+
"Item2": 11,
3625+
"Item3": 0
3626+
},
3627+
"MaximumVersion": {
3628+
"Item1": 5,
3629+
"Item2": 65535,
3630+
"Item3": 65535
3631+
},
3632+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsToChannelIntegration",
3633+
"IntegrationKind": 0,
3634+
"IsAdoNetIntegration": false,
3635+
"InstrumentationCategory": 1
3636+
},
3637+
{
3638+
"IntegrationName": "AzureEventGrid",
3639+
"AssemblyName": "Azure.Messaging.EventGrid",
3640+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3641+
"TargetMethodName": "SendEvents",
3642+
"TargetReturnType": "Azure.Response",
3643+
"TargetParameterTypes": [
3644+
"System.Collections.Generic.IEnumerable`1[System.BinaryData]",
3645+
"System.Threading.CancellationToken"
3646+
],
3647+
"MinimumVersion": {
3648+
"Item1": 4,
3649+
"Item2": 0,
3650+
"Item3": 0
3651+
},
3652+
"MaximumVersion": {
3653+
"Item1": 5,
3654+
"Item2": 65535,
3655+
"Item3": 65535
3656+
},
3657+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCustomEventsIntegration",
3658+
"IntegrationKind": 0,
3659+
"IsAdoNetIntegration": false,
3660+
"InstrumentationCategory": 1
3661+
},
3662+
{
3663+
"IntegrationName": "AzureEventGrid",
3664+
"AssemblyName": "Azure.Messaging.EventGrid",
3665+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3666+
"TargetMethodName": "SendEvents",
3667+
"TargetReturnType": "Azure.Response",
3668+
"TargetParameterTypes": [
3669+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.EventGrid.EventGridEvent]",
3670+
"System.Threading.CancellationToken"
3671+
],
3672+
"MinimumVersion": {
3673+
"Item1": 4,
3674+
"Item2": 0,
3675+
"Item3": 0
3676+
},
3677+
"MaximumVersion": {
3678+
"Item1": 5,
3679+
"Item2": 65535,
3680+
"Item3": 65535
3681+
},
3682+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendEventsIntegration",
3683+
"IntegrationKind": 0,
3684+
"IsAdoNetIntegration": false,
3685+
"InstrumentationCategory": 1
3686+
},
3687+
{
3688+
"IntegrationName": "AzureEventGrid",
3689+
"AssemblyName": "Azure.Messaging.EventGrid",
3690+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3691+
"TargetMethodName": "SendEventsAsync",
3692+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3693+
"TargetParameterTypes": [
3694+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3695+
"System.Threading.CancellationToken"
3696+
],
3697+
"MinimumVersion": {
3698+
"Item1": 4,
3699+
"Item2": 0,
3700+
"Item3": 0
3701+
},
3702+
"MaximumVersion": {
3703+
"Item1": 5,
3704+
"Item2": 65535,
3705+
"Item3": 65535
3706+
},
3707+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsAsyncIntegration",
3708+
"IntegrationKind": 0,
3709+
"IsAdoNetIntegration": false,
3710+
"InstrumentationCategory": 1
3711+
},
3712+
{
3713+
"IntegrationName": "AzureEventGrid",
3714+
"AssemblyName": "Azure.Messaging.EventGrid",
3715+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3716+
"TargetMethodName": "SendEventsAsync",
3717+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3718+
"TargetParameterTypes": [
3719+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3720+
"System.String",
3721+
"System.Threading.CancellationToken"
3722+
],
3723+
"MinimumVersion": {
3724+
"Item1": 4,
3725+
"Item2": 11,
3726+
"Item3": 0
3727+
},
3728+
"MaximumVersion": {
3729+
"Item1": 5,
3730+
"Item2": 65535,
3731+
"Item3": 65535
3732+
},
3733+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsToChannelAsyncIntegration",
3734+
"IntegrationKind": 0,
3735+
"IsAdoNetIntegration": false,
3736+
"InstrumentationCategory": 1
3737+
},
3738+
{
3739+
"IntegrationName": "AzureEventGrid",
3740+
"AssemblyName": "Azure.Messaging.EventGrid",
3741+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3742+
"TargetMethodName": "SendEventsAsync",
3743+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3744+
"TargetParameterTypes": [
3745+
"System.Collections.Generic.IEnumerable`1[System.BinaryData]",
3746+
"System.Threading.CancellationToken"
3747+
],
3748+
"MinimumVersion": {
3749+
"Item1": 4,
3750+
"Item2": 0,
3751+
"Item3": 0
3752+
},
3753+
"MaximumVersion": {
3754+
"Item1": 5,
3755+
"Item2": 65535,
3756+
"Item3": 65535
3757+
},
3758+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCustomEventsAsyncIntegration",
3759+
"IntegrationKind": 0,
3760+
"IsAdoNetIntegration": false,
3761+
"InstrumentationCategory": 1
3762+
},
3763+
{
3764+
"IntegrationName": "AzureEventGrid",
3765+
"AssemblyName": "Azure.Messaging.EventGrid",
3766+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3767+
"TargetMethodName": "SendEventsAsync",
3768+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3769+
"TargetParameterTypes": [
3770+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.EventGrid.EventGridEvent]",
3771+
"System.Threading.CancellationToken"
3772+
],
3773+
"MinimumVersion": {
3774+
"Item1": 4,
3775+
"Item2": 0,
3776+
"Item3": 0
3777+
},
3778+
"MaximumVersion": {
3779+
"Item1": 5,
3780+
"Item2": 65535,
3781+
"Item3": 65535
3782+
},
3783+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendEventsAsyncIntegration",
3784+
"IntegrationKind": 0,
3785+
"IsAdoNetIntegration": false,
3786+
"InstrumentationCategory": 1
3787+
},
3788+
{
3789+
"IntegrationName": "AzureEventGrid",
3790+
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
3791+
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
3792+
"TargetMethodName": "Send",
3793+
"TargetReturnType": "Azure.Response",
3794+
"TargetParameterTypes": [
3795+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3796+
"System.Threading.CancellationToken"
3797+
],
3798+
"MinimumVersion": {
3799+
"Item1": 1,
3800+
"Item2": 0,
3801+
"Item3": 0
3802+
},
3803+
"MaximumVersion": {
3804+
"Item1": 1,
3805+
"Item2": 65535,
3806+
"Item3": 65535
3807+
},
3808+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendEventsIntegration",
3809+
"IntegrationKind": 0,
3810+
"IsAdoNetIntegration": false,
3811+
"InstrumentationCategory": 1
3812+
},
3813+
{
3814+
"IntegrationName": "AzureEventGrid",
3815+
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
3816+
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
3817+
"TargetMethodName": "Send",
3818+
"TargetReturnType": "Azure.Response",
3819+
"TargetParameterTypes": [
3820+
"Azure.Messaging.CloudEvent",
3821+
"System.Threading.CancellationToken"
3822+
],
3823+
"MinimumVersion": {
3824+
"Item1": 1,
3825+
"Item2": 0,
3826+
"Item3": 0
3827+
},
3828+
"MaximumVersion": {
3829+
"Item1": 1,
3830+
"Item2": 65535,
3831+
"Item3": 65535
3832+
},
3833+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendIntegration",
3834+
"IntegrationKind": 0,
3835+
"IsAdoNetIntegration": false,
3836+
"InstrumentationCategory": 1
3837+
},
3838+
{
3839+
"IntegrationName": "AzureEventGrid",
3840+
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
3841+
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
3842+
"TargetMethodName": "SendAsync",
3843+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3844+
"TargetParameterTypes": [
3845+
"Azure.Messaging.CloudEvent",
3846+
"System.Threading.CancellationToken"
3847+
],
3848+
"MinimumVersion": {
3849+
"Item1": 1,
3850+
"Item2": 0,
3851+
"Item3": 0
3852+
},
3853+
"MaximumVersion": {
3854+
"Item1": 1,
3855+
"Item2": 65535,
3856+
"Item3": 65535
3857+
},
3858+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendAsyncIntegration",
3859+
"IntegrationKind": 0,
3860+
"IsAdoNetIntegration": false,
3861+
"InstrumentationCategory": 1
3862+
},
3863+
{
3864+
"IntegrationName": "AzureEventGrid",
3865+
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
3866+
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
3867+
"TargetMethodName": "SendAsync",
3868+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3869+
"TargetParameterTypes": [
3870+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3871+
"System.Threading.CancellationToken"
3872+
],
3873+
"MinimumVersion": {
3874+
"Item1": 1,
3875+
"Item2": 0,
3876+
"Item3": 0
3877+
},
3878+
"MaximumVersion": {
3879+
"Item1": 1,
3880+
"Item2": 65535,
3881+
"Item3": 65535
3882+
},
3883+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendEventsAsyncIntegration",
3884+
"IntegrationKind": 0,
3885+
"IsAdoNetIntegration": false,
3886+
"InstrumentationCategory": 1
3887+
},
35863888
{
35873889
"IntegrationName": "AzureEventHubs",
35883890
"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+
}

0 commit comments

Comments
 (0)