Package com.aphyr.riemann.client

Examples of com.aphyr.riemann.client.EventDSL


            }
        }
    }

    private EventDSL newEvent() {
        EventDSL event = riemann.event();
        if (c.localHost != null) {
            event.host(c.localHost);
        }
        if (!c.tags.isEmpty()) {
            event.tags(c.tags);
        }
        return event;
    }
View Full Code Here


    }

    @Override
    public void processGauge(MetricName name, Gauge<?> gauge, Long epoch) {
        Object v = gauge.value();
        EventDSL e = newEvent().service(service(name)).time(epoch);
        if (v instanceof Integer) {
            e.metric((Integer) v).send();
        } else if (v instanceof Long) {
            e.metric((Long) v).send();
        } else if (v instanceof Double) {
            e.metric((Double) v).send();
        } else if (v instanceof Float) {
            e.metric((Float) v).send();
        } else if (v instanceof Number) {
            e.metric(((Number) v).floatValue()).send();
        }
    }
View Full Code Here

    private EventClosure newEvent(final String metricName, final long timestamp, final String metricType) {
        final String prefix = this.prefix;
        final String separator = this.separator;
        return new EventClosure() {
            public EventDSL name(String... components) {
                EventDSL event = riemann.client.event();
                if (localHost != null) {
                    event.host(localHost);
                }
                if (ttl != null) {
                    event.ttl(ttl);
                }
                if (!tags.isEmpty()) {
                    event.tags(tags);
                }
                final StringBuilder sb = new StringBuilder();
                if (prefix != null) {
                    sb.append(prefix);
                    sb.append(separator);
                }
                sb.append(metricName);

                for (String part : components) {
                    sb.append(separator);
                    sb.append(part);
                }

                event.service(sb.toString());
                event.time(timestamp);
                event.attribute("metric-type", metricType);
                return event;
            }
        };
    }
View Full Code Here

  @Before
  public void setUp() throws Exception {
    when(riemannClient.aSendEventsWithAck(eventCaptor.capture()))
        .thenReturn(new Promise<Boolean>());
    when(riemannClient.event()).thenReturn(new EventDSL(riemannClient));
    final RiemannFacade riemannFacade = new RiemannFacade(riemannClient, HOST, SERVICE);
    sut = MonitoredDockerClient.wrap(riemannFacade, client);
  }
View Full Code Here

TOP

Related Classes of com.aphyr.riemann.client.EventDSL

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.