congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
com.googlecode.jmxtrans.util
Code IndexAdd Tabnine to your IDE (free)

How to use com.googlecode.jmxtrans.util

Best Java code snippets using com.googlecode.jmxtrans.util (Showing top 20 results out of 315)

origin: jmxtrans/jmxtrans

public static boolean isValidNumber(Object value) {
  if (value == null) {
    return false;
  }
  if (value instanceof Number) {
    return isValidNumber((Number) value);
  }
  if (value instanceof String) {
    return isNumeric(value);
  }
  return false;
}
origin: jmxtrans/jmxtrans

  private synchronized boolean shouldFlush() {
    if (lastFlush + flushPeriodMillisecond < clock.currentTimeMillis()) {
      lastFlush = clock.currentTimeMillis();
      return true;
    }
    return false;
  }
}
origin: jmxtrans/jmxtrans

private boolean isNotValidValue(Object value) {
  return !(isNumeric(value) || stringsValuesAsKey);
}
origin: jmxtrans/jmxtrans

public void infoOnce(String format, Object... arguments) {
  if (maxHistorySizeReached()) return;
  if (!logger.isInfoEnabled()) return;
  LogEntry logEntry = new LogEntry(format, arguments);
  if (shouldLog(logEntry)) logger.info(format, arguments);
}
origin: jmxtrans/jmxtrans

/**
 * <p>
 * Register for the given signal. Note that the signal name should
 * <b>not</b> begin with <b>SIG</b>. For example, if you are interested in
 * <b>SIGTERM</b>, you should call <code>register("TERM")</code>.
 * </p>
 * <p>
 * If the registration fails for any reason, a
 * <code>SignalInterceptorException</code> will be thrown. This is usually
 * caused by one of the following conditions:
 * </p>
 * <ul>
 * <li>The <code>sun.misc.Signal*</code> classes are not available (e.g. you
 * are not using Sun's JVM).</li>
 * <li><code>signame</code> is not a valid trappable signal name on this OS
 * (e.g. <b>KILL</b> can't be trapped, <b>HUP</b> does not exist on Windows)
 * </li>
 * <li>The JVM refuses to let you trap <code>signame</code> because it is
 * already being used for some other important purpose (e.g. <b>QUIT</b>
 * and/or <b>BREAK</b> cause the JVM to print diagnostic output).</li>
 * </ul>
 */
protected void register(String signame) throws SignalInterceptorException {
  try {
    new SignalInterceptorHelper(signame, this);
  } catch (Throwable e) {
    throw new SignalInterceptorException(signame, e);
  }
}
origin: jmxtrans/jmxtrans

/**
 * Startup the watchdir service.
 */
private void startupWatchdir() throws Exception {
  File dirToWatch;
  if (this.configuration.getProcessConfigDirOrFile().isFile()) {
    dirToWatch = new File(FilenameUtils.getFullPath(this.configuration.getProcessConfigDirOrFile().getAbsolutePath()));
  } else {
    dirToWatch = this.configuration.getProcessConfigDirOrFile();
  }
  // start the watcher
  this.watcher = new WatchDir(dirToWatch, this);
  this.watcher.start();
}
origin: jmxtrans/jmxtrans

  public static void main(String[] args) throws Exception {
    Injector injector = JmxTransModule.createInjector(new JmxTransConfiguration());
    ProcessConfigUtils processConfigUtils = injector.getInstance(ProcessConfigUtils.class);
    JmxProcess process = processConfigUtils.parseProcess(new File("local.json"));
    new JsonPrinter(System.out).print(process);
    JmxTransformer transformer = injector.getInstance(JmxTransformer.class);
    transformer.executeStandalone(process);
  }
}
origin: jmxtrans/jmxtrans

public ManualClock() {
  setTime(0L, MILLISECONDS);
}
origin: jmxtrans/jmxtrans

@Override
public TextNode textNode(String text) {
  return super.textNode(propertyResolver.resolveProps(text));
}
origin: jmxtrans/jmxtrans

  @Override @IgnoreJRERequirement
  public void handle(Signal sig) {
    if (interceptor.handle(sig.getName()) && (oldHandler != null)) {
      oldHandler.handle(sig);
    }
  }
}
origin: jmxtrans/jmxtrans

private MetricDatum processResult(Result result) {
  // Sometimes the attribute name and the key of the value are the same
  MetricDatum metricDatum = new MetricDatum();
  if (result.getValuePath().isEmpty()) {
    metricDatum.setMetricName(result.getAttributeName());
  } else {
    metricDatum.setMetricName(result.getAttributeName() + "_" + KeyUtils.getValuePathString(result));
  }
  metricDatum.setDimensions(dimensions);
  // Converts the Objects to Double-values for CloudWatch
  metricDatum.setValue(toDoubleConverter.apply(result.getValue()));
  metricDatum.setTimestamp(new Date());
  return metricDatum;
}
origin: jmxtrans/jmxtrans

private boolean isNotValidValue(Object value) {
  return !isNumeric(value);
}
origin: jmxtrans/jmxtrans

public TimeBasedFlush(@Nonnull Clock clock, long flushPeriod, @Nonnull TimeUnit unit) {
  this.clock = clock;
  this.lastFlush = clock.currentTimeMillis();
  this.flushPeriodMillisecond = MILLISECONDS.convert(flushPeriod, unit);
}
origin: jmxtrans/jmxtrans

public ManualClock(long time, TimeUnit unit) {
  setTime(time, unit);
}
origin: jmxtrans/jmxtrans

private boolean isNotValidValue(Object value){
  return ! (isNumeric(value) || stringsValuesAsKey);
}
origin: jmxtrans/jmxtrans

  @Override
  public String serialize(Server server, Query query, Result result) {
    return isNumeric(result.getValue()) ? "" : null;
  }
};
origin: jmxtrans/jmxtrans

  private String computeActualValue(Object value) {
    Object transformedValue = valueTransformer.apply(value);
    if (isNumeric(transformedValue)) {
      return ":" + transformedValue.toString();
    } else if (transformedValue == null) {
      return ":";
    }

    return "." + transformedValue.toString() + ":" + stringValueDefaultCount;
  }
}
origin: jmxtrans/jmxtrans

private String computeActualValue(Object value){
  Object transformedValue = valueTransformer.apply(value);
  if(isNumeric(transformedValue)){
    return ":" + transformedValue.toString();
  }
  return "." + transformedValue.toString() + ":" + stringValueDefaultCount.toString();
}
origin: jmxtrans/jmxtrans

private Number computeActualValue(Object value) {
  Object transformedValue = valueTransformer.apply(value);
  if (isNumeric(transformedValue)) {
    return transformedValue instanceof Number ?
      (Number) transformedValue : Float.valueOf(transformedValue.toString());
  }
  throw new IllegalArgumentException("Only numeric values are supported, enable debug log level for more details.");
}
origin: jmxtrans/jmxtrans

@Override
public String serialize(Server server, Query query, Result result) throws IOException {
  log.debug("Query result: [{}]", result);
  Object value = result.getValue();
  if (!isNumeric(value)) {
    log.warn("Unable to submit non-numeric value to Kafka: [{}] from result [{}]", value, result);
    return null;
  }
  return createJsonMessage(server, query, result, result.getValuePath(), value);
}
com.googlecode.jmxtrans.util

Most used classes

  • NumberUtils
  • OnlyOnceLogger
    This class provides a simple filter on top of a logger to ensure that the same message is only logge
  • ProcessConfigUtils
  • BaseOutputWriter
  • Clock
  • JmxConnectionFactory,
  • JmxUtils$ProcessQueryThread,
  • JmxUtils$ProcessServerThread,
  • JmxUtils,
  • LifecycleException,
  • ManualClock,
  • ObjectToDouble,
  • OnlyOnceLogger$LogEntry,
  • PropertyResolver,
  • SignalInterceptor$SignalInterceptorException,
  • SignalInterceptor$SignalInterceptorHelper,
  • SignalInterceptor,
  • SocketFactory,
  • SystemClock
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now