Beispiel #1
0
 protected virtual void OnEventSent(RiemannEventArgs e)
 {
     EventHandler<RiemannEventArgs> handler = EventSent;
     if (handler != null) handler(this, e);
 }
Beispiel #2
0
        protected internal void Event(string service, long value, string metric, IEnumerable<string> tags,
                                      IEnumerable<Attribute> attributes)
        {
            var unixTime =
                Convert.ToInt64((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds);
            var ev = new Event
                {
                    Host = MachineName,
                    Service = service,
                    MetricSint64 = value,
                    Time = unixTime,
                };
            ev.Tags.AddRange(Tags);
            ev.Tags.Add(metric);

            if (tags != null)
            {
                ev.Tags.AddRange(tags);
            }

            if (attributes != null)
            {
                ev.Attributes.AddRange(attributes);
            }

            var eventArgs = new RiemannEventArgs(ev);
            OnEventSending(eventArgs);
            RiemannClient.SendEvent(ev);
            OnEventSent(eventArgs);
        }