Esempio n. 1
0
        public AfterWrappedMethodDelegate BeforeWrappedMethod(InstrumentedMethodCall instrumentedMethodCall, IAgent agent, ITransaction transaction)
        {
            return(Delegates.GetDelegateFor(onComplete: () =>
            {
                var serviceDescription = instrumentedMethodCall.MethodCall.MethodArguments[0] as ServiceDescription;

                lock (_bindingLock)
                {
                    var bindingsSent = new List <Type>();
                    foreach (var endpoint in serviceDescription.Endpoints)
                    {
                        var bindingType = endpoint.Binding.GetType();
                        if (!bindingsSent.Contains(bindingType))
                        {
                            bindingsSent.Add(bindingType);
                            if (!SystemBindingTypes.Contains(bindingType))
                            {
                                agent.GetExperimentalApi().RecordSupportabilityMetric("WCFService/BindingType/CustomBinding");
                            }
                            else
                            {
                                agent.GetExperimentalApi().RecordSupportabilityMetric($"WCFService/BindingType/{bindingType.Name}");
                            }
                        }
                    }
                }
            }));
        }
Esempio n. 2
0
        private static void TrySendBindingMetric(Type bindingType, IAgent agent)
        {
            // this will work for both custom and MS bindings
            var sendMetric = false;

            lock (_bindingLock)
            {
                if (!_bindingsSent.Contains(bindingType))
                {
                    _bindingsSent.Add(bindingType);
                    sendMetric = true;
                }
            }

            if (sendMetric)
            {
                if (!SystemBindingTypes.Contains(bindingType))
                {
                    agent.GetExperimentalApi().RecordSupportabilityMetric("WCFClient/BindingType/CustomBinding");
                }
                else
                {
                    agent.GetExperimentalApi().RecordSupportabilityMetric($"WCFClient/BindingType/{bindingType.Name}");
                }
            }
        }