Skip to content

Commit 7a0f908

Browse files
[Azure Event Grid] Register outbound SDK calltargets
1 parent c67ae6c commit 7a0f908

20 files changed

Lines changed: 2017 additions & 1129 deletions

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: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,6 +3508,308 @@
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[System.BinaryData]",
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.EventGridPublisherClientSendCustomEventsIntegration",
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": "SendEvents",
3592+
"TargetReturnType": "Azure.Response",
3593+
"TargetParameterTypes": [
3594+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.EventGrid.EventGridEvent]",
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.EventGridPublisherClientSendEventsIntegration",
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.Threading.CancellationToken"
3621+
],
3622+
"MinimumVersion": {
3623+
"Item1": 4,
3624+
"Item2": 0,
3625+
"Item3": 0
3626+
},
3627+
"MaximumVersion": {
3628+
"Item1": 5,
3629+
"Item2": 65535,
3630+
"Item3": 65535
3631+
},
3632+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsAsyncIntegration",
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": "SendEventsAsync",
3642+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3643+
"TargetParameterTypes": [
3644+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.CloudEvent]",
3645+
"System.String",
3646+
"System.Threading.CancellationToken"
3647+
],
3648+
"MinimumVersion": {
3649+
"Item1": 4,
3650+
"Item2": 11,
3651+
"Item3": 0
3652+
},
3653+
"MaximumVersion": {
3654+
"Item1": 5,
3655+
"Item2": 65535,
3656+
"Item3": 65535
3657+
},
3658+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCloudEventsToChannelAsyncIntegration",
3659+
"IntegrationKind": 0,
3660+
"IsAdoNetIntegration": false,
3661+
"InstrumentationCategory": 1
3662+
},
3663+
{
3664+
"IntegrationName": "AzureEventGrid",
3665+
"AssemblyName": "Azure.Messaging.EventGrid",
3666+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3667+
"TargetMethodName": "SendEventsAsync",
3668+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3669+
"TargetParameterTypes": [
3670+
"System.Collections.Generic.IEnumerable`1[System.BinaryData]",
3671+
"System.Threading.CancellationToken"
3672+
],
3673+
"MinimumVersion": {
3674+
"Item1": 4,
3675+
"Item2": 0,
3676+
"Item3": 0
3677+
},
3678+
"MaximumVersion": {
3679+
"Item1": 5,
3680+
"Item2": 65535,
3681+
"Item3": 65535
3682+
},
3683+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendCustomEventsAsyncIntegration",
3684+
"IntegrationKind": 0,
3685+
"IsAdoNetIntegration": false,
3686+
"InstrumentationCategory": 1
3687+
},
3688+
{
3689+
"IntegrationName": "AzureEventGrid",
3690+
"AssemblyName": "Azure.Messaging.EventGrid",
3691+
"TargetTypeName": "Azure.Messaging.EventGrid.EventGridPublisherClient",
3692+
"TargetMethodName": "SendEventsAsync",
3693+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3694+
"TargetParameterTypes": [
3695+
"System.Collections.Generic.IEnumerable`1[Azure.Messaging.EventGrid.EventGridEvent]",
3696+
"System.Threading.CancellationToken"
3697+
],
3698+
"MinimumVersion": {
3699+
"Item1": 4,
3700+
"Item2": 0,
3701+
"Item3": 0
3702+
},
3703+
"MaximumVersion": {
3704+
"Item1": 5,
3705+
"Item2": 65535,
3706+
"Item3": 65535
3707+
},
3708+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridPublisherClientSendEventsAsyncIntegration",
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": "Send",
3718+
"TargetReturnType": "Azure.Response",
3719+
"TargetParameterTypes": [
3720+
"System.Collections.Generic.IEnumerable`1[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.EventGridSenderClientSendEventsIntegration",
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": "Send",
3743+
"TargetReturnType": "Azure.Response",
3744+
"TargetParameterTypes": [
3745+
"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.EventGridSenderClientSendIntegration",
3759+
"IntegrationKind": 0,
3760+
"IsAdoNetIntegration": false,
3761+
"InstrumentationCategory": 1
3762+
},
3763+
{
3764+
"IntegrationName": "AzureEventGrid",
3765+
"AssemblyName": "Azure.Messaging.EventGrid.Namespaces",
3766+
"TargetTypeName": "Azure.Messaging.EventGrid.Namespaces.EventGridSenderClient",
3767+
"TargetMethodName": "SendAsync",
3768+
"TargetReturnType": "System.Threading.Tasks.Task`1[Azure.Response]",
3769+
"TargetParameterTypes": [
3770+
"Azure.Messaging.CloudEvent",
3771+
"System.Threading.CancellationToken"
3772+
],
3773+
"MinimumVersion": {
3774+
"Item1": 1,
3775+
"Item2": 0,
3776+
"Item3": 0
3777+
},
3778+
"MaximumVersion": {
3779+
"Item1": 1,
3780+
"Item2": 65535,
3781+
"Item3": 65535
3782+
},
3783+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.Azure.EventGrid.EventGridSenderClientSendAsyncIntegration",
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": "SendAsync",
3793+
"TargetReturnType": "System.Threading.Tasks.Task`1[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.EventGridSenderClientSendEventsAsyncIntegration",
3809+
"IntegrationKind": 0,
3810+
"IsAdoNetIntegration": false,
3811+
"InstrumentationCategory": 1
3812+
},
35113813
{
35123814
"IntegrationName": "AzureEventHubs",
35133815
"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)