private String messageFor(String aspect, String value, String type) { return messageFor(aspect, value, type, 1.0); }
private void recordGaugeCommon(String aspect, String value, boolean negative, boolean delta) { final StringBuilder message = new StringBuilder(); if (!delta && negative) { message.append(messageFor(aspect, "0", "g")).append('\n'); } message.append(messageFor(aspect, (delta && !negative) ? ("+" + value) : value, "g")); send(message.toString()); }
/** * Records an execution time in milliseconds for the specified named operation. * * <p>This method is non-blocking and is guaranteed not to throw an exception.</p> * * @param aspect * the name of the timed operation * @param timeInMs * the time in milliseconds */ @Override public void recordExecutionTime(String aspect, long timeInMs, double sampleRate) { send(messageFor(aspect, Long.toString(timeInMs), "ms", sampleRate)); }
/** * StatsD supports counting unique occurrences of events between flushes, Call this method to records an occurrence * of the specified named event. * * <p>This method is non-blocking and is guaranteed not to throw an exception.</p> * * @param aspect * the name of the set * @param eventName * the value to be added to the set */ @Override public void recordSetEvent(String aspect, String eventName) { send(messageFor(aspect, eventName, "s")); }
/** * Adjusts the specified counter by a given delta. * * <p>This method is non-blocking and is guaranteed not to throw an exception.</p> * * @param aspect * the name of the counter to adjust * @param delta * the amount to adjust the counter by * @param sampleRate * the sampling rate being employed. For example, a rate of 0.1 would tell StatsD that this counter is being sent * sampled every 1/10th of the time. */ @Override public void count(String aspect, long delta, double sampleRate) { send(messageFor(aspect, Long.toString(delta), "c", sampleRate)); }