private static void OnRollbarInternalEvent(object sender, RollbarEventArgs e)
        {
            Console.WriteLine(e.TraceAsString());

            RollbarApiErrorEventArgs apiErrorEvent = e as RollbarApiErrorEventArgs;

            if (apiErrorEvent != null)
            {
                //TODO: handle/report Rollbar API communication error event...
                return;
            }
            CommunicationEventArgs commEvent = e as CommunicationEventArgs;

            if (commEvent != null)
            {
                //TODO: handle/report Rollbar API communication event...
                return;
            }
            CommunicationErrorEventArgs commErrorEvent = e as CommunicationErrorEventArgs;

            if (commErrorEvent != null)
            {
                //TODO: handle/report basic communication error while attempting to reach Rollbar API service...
                return;
            }
            InternalErrorEventArgs internalErrorEvent = e as InternalErrorEventArgs;

            if (internalErrorEvent != null)
            {
                //TODO: handle/report basic internal error while using the Rollbar Notifier...
                return;
            }
        }
Beispiel #2
0
        private void Instance_InternalEvent(object sender, RollbarEventArgs e)
        {
            //Console.WriteLine(e.TraceAsString());

            RollbarApiErrorEventArgs apiErrorEvent = e as RollbarApiErrorEventArgs;

            if (apiErrorEvent != null)
            {
                _apiErrorsCount++;
                return;
            }
            CommunicationEventArgs commEvent = e as CommunicationEventArgs;

            if (commEvent != null)
            {
                _commSuccessCount++;
                return;
            }
            CommunicationErrorEventArgs commErrorEvent = e as CommunicationErrorEventArgs;

            if (commErrorEvent != null)
            {
                _commErrorsCount++;
                return;
            }
            InternalErrorEventArgs internalErrorEvent = e as InternalErrorEventArgs;

            if (internalErrorEvent != null)
            {
                _internalErrorsCount++;
                return;
            }
        }
        private void OnRollbarInternalEvent(object sender, RollbarEventArgs e)
        {
            Console.WriteLine(e.TraceAsString());
            Trace.WriteLine(e.TraceAsString());

            switch (e)
            {
            case RollbarApiErrorEventArgs apiErrorEvent:
                this.ApiErrorEvents.Add(apiErrorEvent);
                return;

            case CommunicationEventArgs commEvent:
                this.CommunicationEvents.Add(commEvent);
                return;

            case CommunicationErrorEventArgs commErrorEvent:
                this.CommunicationErrorEvents.Add(commErrorEvent);
                return;

            case InternalErrorEventArgs internalErrorEvent:
                this.InternalSdkErrorEvents.Add(internalErrorEvent);
                return;

            default:
                Assert.Fail("Unexpected RollbarEventArgs specialization type!");
                return;
            }
        }
        /// <summary>
        /// Handles the <see cref="E:RollbarInternalEvent" /> event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
        private void OnRollbarInternalEvent(object sender, RollbarEventArgs e)
        {
            if (!(e is CommunicationEventArgs))
            {
            }

            //// for basic RollbarRateLimitVerification test:
            //switch (e)
            //{
            //    case RollbarApiErrorEventArgs apiErrorEvent:
            //        //this.ApiErrorEvents.Add(apiErrorEvent);
            //        return;
            //    case CommunicationEventArgs commEvent:
            //        Console.WriteLine(commEvent.EventTimestamp + " SENT: ");
            //        return;
            //    case CommunicationErrorEventArgs commErrorEvent:
            //        //this.CommunicationErrorEvents.Add(commErrorEvent);
            //        return;
            //    case InternalErrorEventArgs internalErrorEvent:
            //        //this.InternalSdkErrorEvents.Add(internalErrorEvent);
            //        return;
            //    case PayloadDropEventArgs payloadDropEvent:
            //        Console.WriteLine(payloadDropEvent.EventTimestamp + " DROP: " + payloadDropEvent.Reason);
            //        return;
            //    default:
            //        //Assert.Fail("Unexpected RollbarEventArgs specialization type!");
            //        return;
            //}

            //Console.WriteLine(e.TraceAsString());
            //Trace.WriteLine(e.TraceAsString());

            this.Register(e);
        }
        private void Instance_InternalEvent(object sender, RollbarEventArgs e)
        {
            CommunicationEventArgs communicationEventArgs = e as CommunicationEventArgs;

            if (e != null)
            {
                _rollbarCommunicationEventsCount++;
            }
        }
Beispiel #6
0
 /// <summary>
 /// Handles the InternalEvent event of the RollbarStress control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
 private static void RollbarStress_InternalEvent(object sender, RollbarEventArgs e)
 {
     if (e is CommunicationEventArgs)
     {
         Interlocked.Increment(ref RollbarLoggerFixture.stressLogsCount);
     }
     else
     {
     }
 }
Beispiel #7
0
        /// <summary>
        /// Handles the InternalEvent event of the Instance control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
        private void Instance_InternalEvent(object sender, RollbarEventArgs e)
        {
            //string eventTrace = $"##################{Environment.NewLine}{e.TraceAsString()}{Environment.NewLine}";
            //Console.WriteLine(eventTrace);
            //System.Diagnostics.Trace.WriteLine(eventTrace);

            CommunicationEventArgs communicationEventArgs = e as CommunicationEventArgs;

            if (e != null)
            {
                this._rollbarCommEvents.Add(communicationEventArgs);
            }
        }
Beispiel #8
0
        internal void OnRollbarEvent(RollbarEventArgs e)
        {
            Assumption.AssertNotNull(this._config, nameof(this._config));
            Assumption.AssertNotNull(e, nameof(e));

            EventHandler <RollbarEventArgs>?handler = InternalEvent;

            if (handler != null)
            {
                handler(this, e);
            }

            (e.Logger as RollbarLogger)?.OnRollbarEvent(e);

            const string category = nameof(this.OnRollbarEvent);
            const int    id       = 0;

            switch (e)
            {
            case InternalErrorEventArgs internalErrorEvent:
                traceSource.TraceData(TraceEventType.Critical, id, category, e.TraceAsString());
                break;

            case CommunicationErrorEventArgs commErrorEvent:
            case RollbarApiErrorEventArgs apiErrorEvent:
                traceSource.TraceData(TraceEventType.Error, id, category, e.TraceAsString());
                break;

            case CommunicationEventArgs commEvent:
                transmittedPayloadsTraceSource.TraceData(TraceEventType.Information, id, e.Payload);
                traceSource.TraceData(TraceEventType.Information, id, category, e.TraceAsString());
                break;

            case TransmissionOmittedEventArgs transmissionOmittedEvent:
                omittedPayloadsTraceSource.TraceData(TraceEventType.Information, id, e.Payload);
                traceSource.TraceData(TraceEventType.Warning, id, category, e.TraceAsString());
                break;

            case PayloadDropEventArgs payloadDropEvent:
            default:
                traceSource.TraceData(TraceEventType.Warning, id, category, e.TraceAsString());
                break;
            }
            traceSource.Flush();
        }
        /// <summary>
        /// Registers the specified rollbar event.
        /// </summary>
        /// <param name="rollbarEvent">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
        private void Register(RollbarEventArgs rollbarEvent)
        {
            if (rollbarEvent == null)
            {
                return;
            }

            var eventType = rollbarEvent.GetType();

            if (this._rollbarEventsByType.TryGetValue(eventType, out var rollbarEvents))
            {
                rollbarEvents.Add(rollbarEvent);
            }
            else
            {
                this._rollbarEventsByType.Add(
                    eventType,
                    new List <RollbarEventArgs>(new[] { rollbarEvent })
                    );
            }
        }
Beispiel #10
0
        /// <summary>
        /// Called when rollbar internal event is detected.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
        private static void OnRollbarInternalEvent(object sender, RollbarEventArgs e)
        {
            //Console.WriteLine(e.TraceAsString());

            switch (e)
            {
            case InternalErrorEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case RollbarApiErrorEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case CommunicationErrorEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case TransmissionOmittedEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case PayloadDropEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case CommunicationEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            default:
                // handle this specific type of Rollbar event...
                break;
            }

            _eventCounters[e.GetType().Name].Add(e);
        }
Beispiel #11
0
 /// <summary>
 /// Handles the InternalEvent event of the Logger control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
 private void Logger_InternalEvent(object sender, RollbarEventArgs e)
 {
     this._transformException = true;
     this._signal.Release();
 }
Beispiel #12
0
 /// <summary>
 /// Handles the <see cref="E:RollbarEvent" /> event.
 /// </summary>
 /// <param name="e">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
 internal virtual void OnRollbarEvent(RollbarEventArgs e)
 {
     InternalEvent?.Invoke(this, e);
 }