static AotProcessor()
        {
            Definitions        = InstrumentationDefinitions.GetAllDefinitions().Definitions;
            DerivedDefinitions = InstrumentationDefinitions.GetDerivedDefinitions().Definitions;
            TracerAssembly     = typeof(Instrumentation).Assembly;

            var callTargetInvokerType = typeof(CallTargetInvoker);

            CallTargetInvokerMethods  = callTargetInvokerType.GetMethods();
            LogExceptionMethodInfo    = CallTargetInvokerMethods.FirstOrDefault(m => m.Name == "LogException");
            GetDefaultValueMethodInfo = CallTargetInvokerMethods.FirstOrDefault(m => m.Name == "GetDefaultValue");

            var callTargetStateType = typeof(CallTargetState);

            CallTargetStateGetDefaultMethodInfo = callTargetStateType.GetMethod("GetDefault", BindingFlags.Public | BindingFlags.Static);

            CallTargetReturnVoid = typeof(CallTargetReturn);
            var callTargetReturnVoidMethods = CallTargetReturnVoid.GetMethods();

            CallTargetReturnVoidGetDefaultValueMethodInfo = callTargetReturnVoidMethods.FirstOrDefault(m => m.Name == "GetDefault");

            CallTargetReturn = typeof(CallTargetReturn <>);
            var callTargetReturnMethods = CallTargetReturn.GetMethods();

            CallTargetReturnGetReturnValueMethodInfo  = callTargetReturnMethods.FirstOrDefault(m => m.Name == "GetReturnValue");
            CallTargetReturnGetDefaultValueMethodInfo = callTargetReturnMethods.FirstOrDefault(m => m.Name == "GetDefault");
        }
Esempio n. 2
0
        public void ForUnknownIntegrationType_ReturnsNull()
        {
            var integrationType = typeof(InstrumentationDefinitionsTests).FullName;
            var targetType      = typeof(FakeCommand);

            var info = InstrumentationDefinitions.GetIntegrationId(integrationType, targetType);

            info.Should().BeNull();
        }
Esempio n. 3
0
        public void CanGetIntegrationIdForAdoNetAttribute(Type targetType, int expected)
        {
            var integrationType = typeof(CommandExecuteNonQueryIntegration).FullName;

            var info = InstrumentationDefinitions.GetIntegrationId(integrationType, targetType);

            info.Should().NotBeNull();
            info.Value.Should().Be((IntegrationId)expected);
        }
Esempio n. 4
0
        public void CanGetIntegrationIdFromAssemblyLevelInstrumentAttribute_IntegrationTypeIsDerived()
        {
            var integrationType = typeof(CommandExecuteNonQueryIntegration).FullName;
            var targetType      = typeof(FakeCommand);

            var info = InstrumentationDefinitions.GetIntegrationId(integrationType, targetType);

            info.Should().NotBeNull();
            info.Value.Should().Be(IntegrationId.AdoNet);
        }
Esempio n. 5
0
        public void CanGetIntegrationIdFromInstrumentAttributeWithMultipleTypeNames()
        {
            var integrationType = typeof(IWireProtocol_Generic_Execute_Integration).FullName;

            // target type doesn't matter in this case
            var info = InstrumentationDefinitions.GetIntegrationId(integrationType, null);

            info.Should().NotBeNull();
            info.Value.Should().Be(IntegrationId.MongoDb);
        }
Esempio n. 6
0
        public void CanGetIntegrationIdFromInstrumentAttributeWithMultipleAssemblyNames()
        {
            var integrationType = typeof(XUnitTestInvokerRunAsyncIntegration).FullName;
            var targetType      = typeof(Xunit.Sdk.TestInvoker <>);

            var info = InstrumentationDefinitions.GetIntegrationId(integrationType, targetType);

            info.Should().NotBeNull();
            info.Value.Should().Be(IntegrationId.XUnit);
        }
Esempio n. 7
0
        public void CanGetIntegrationIdFromInstrumentAttribute()
        {
            var integrationType = typeof(HttpClientHandlerIntegration).FullName;
            var targetType      = typeof(System.Net.Http.HttpClientHandler);

            var info = InstrumentationDefinitions.GetIntegrationId(integrationType, targetType);

            info.Should().NotBeNull();
            info.Value.Should().Be(IntegrationId.HttpMessageHandler);
        }