/// <inheritdoc />
        public void OnException(Exception exception)
        {
            var eventBuilder = exception.ToExceptionless()
                               .SetEventReference(FeatureName, ParentReference.ToString())
                               .SetReferenceId(FeatureReference.ToString());

            eventBuilder.Submit();
        }
        private void PrepareEventData <TTelemetry>(TTelemetry eventTelemetry)
            where TTelemetry : ISupportProperties
        {
            eventTelemetry.Properties.Add("Name", FeatureName);
            eventTelemetry.Properties.Add("Reference", FeatureReference.ToString());

            if (ParentReference != Guid.Empty)
            {
                eventTelemetry.Properties.Add("ParentReference", ParentReference.ToString());
            }
        }
        public DefaultHttpContext(IFeatureCollection features)
        {
            _features = features;
            _request = new DefaultHttpRequest(this, features);
            _response = new DefaultHttpResponse(this, features);

            _items = FeatureReference<IItemsFeature>.Default;
            _serviceProviders = FeatureReference<IServiceProvidersFeature>.Default;
            _authentication = FeatureReference<IHttpAuthenticationFeature>.Default;
            _lifetime = FeatureReference<IHttpRequestLifetimeFeature>.Default;
            _webSockets = FeatureReference<IHttpWebSocketFeature>.Default;
            _session = FeatureReference<ISessionFeature>.Default;
        }
Beispiel #4
0
        public DefaultHttpContext(IFeatureCollection features)
        {
            _features = features;
            _request  = new DefaultHttpRequest(this, features);
            _response = new DefaultHttpResponse(this, features);

            _items            = FeatureReference <IItemsFeature> .Default;
            _serviceProviders = FeatureReference <IServiceProvidersFeature> .Default;
            _authentication   = FeatureReference <IHttpAuthenticationFeature> .Default;
            _lifetime         = FeatureReference <IHttpRequestLifetimeFeature> .Default;
            _webSockets       = FeatureReference <IHttpWebSocketFeature> .Default;
            _session          = FeatureReference <ISessionFeature> .Default;
        }
        private IDictionary <string, string> GetProperties()
        {
            var properties = new Dictionary <string, string>
            {
                { "Name", FeatureName },
                { "Reference", FeatureReference.ToString() },
            };

            if (ParentReference != Guid.Empty)
            {
                properties.Add("ParentReference", ParentReference.ToString());
            }

            return(properties);
        }
Beispiel #6
0
        internal RaygunFeatureUsageTrackingSession(
            string featureName,
            Guid parentReference,
            RaygunClient raygunClient,
            RaygunSettings raygunSettings)
        {
            if (string.IsNullOrWhiteSpace(featureName))
            {
                throw new ArgumentNullException(nameof(featureName));
            }

            _raygunClient   = raygunClient;
            _raygunSettings = raygunSettings;

            ParentReference  = parentReference;
            FeatureName      = featureName;
            FeatureReference = Guid.NewGuid();

            var userCustomData = new Dictionary <string, string>
            {
                { "EventType", "FeatureUsage" },
                { "EventReference", FeatureReference.ToString() },
                { "ParentReference", parentReference.ToString() }
            };

            // keep an eye on
            // https://raygun.com/forums/thread/92182
#if NETSTANDARD2_0 || NET5_0
            var messageBuilder = RaygunMessageBuilder.New(raygunSettings)
#else
            var messageBuilder = RaygunMessageBuilder.New
#endif
                                 .SetClientDetails()
                                 .SetEnvironmentDetails()
                                 .SetUserCustomData(userCustomData);
            var raygunMessage = messageBuilder.Build();
            _raygunClient.SendInBackground(raygunMessage);
        }
        internal ExceptionlessFeatureUsageTrackingSession(
            string featureName,
            Guid parentReference)
        {
            if (string.IsNullOrWhiteSpace(featureName))
            {
                throw new ArgumentNullException(nameof(featureName));
            }

            ParentReference  = parentReference;
            FeatureName      = featureName;
            FeatureReference = Guid.NewGuid();

            var client       = ExceptionlessClient.Default;
            var eventBuilder = client.CreateFeatureUsage(featureName);

            if (!parentReference.Equals(Guid.Empty))
            {
                eventBuilder.SetEventReference(FeatureName, FeatureReference.ToString());
            }

            eventBuilder.SetReferenceId(FeatureReference.ToString());
            eventBuilder.Submit();
        }