Exemple #1
0
        public object AddCustomAttribute(string key, object value)
        {
            try
            {
                _apiSupportabilityMetricCounters.Record(ApiMethod.SpanAddCustomAttribute);

                if (!_configSvc.Configuration.CaptureCustomParameters)
                {
                    return(_span);
                }

                _span.AddCustomAttribute(key, value);
            }
            catch (Exception ex)
            {
                try
                {
                    Log.Error($"Error in AddCustomAttribute: {ex}");
                }
                catch (Exception)
                {
                    //Swallow the error
                }
            }

            return(_span);
        }
        public ISpan AddCustomAttribute(string key, object value)
        {
            if (!_isAddCustomAttributeAvailable)
            {
                return(_noOpSpan.AddCustomAttribute(key, value));
            }

            try
            {
                _wrappedSpan.AddCustomAttribute(key, value);
                return(this);
            }
            catch (RuntimeBinderException ex)
            {
                _isAddCustomAttributeAvailable = false;
            }

            return(this);
        }