Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.clustermate.service.metrics;
  
  
Container class for exposing OperationMetrics externally, usually as JSON, to be displayed on dashboards etc.
 
 @JsonPropertyOrder(alphabetic=true,
    value={ "count""inFlight""requestTimes" }
 )
 {
 	private final static double NANOS_TO_MILLIS_MULTIPLIER = 1.0 / (1000.0 * 1000.0);

    
Total count from rate metrics
 
     public long count;

    
Number of operations active (in-flight)
 
     public long inFlight;
 
     public int rate1Minrate5Minrate15MinrateMean;
 
     public Histogram requestTimes;
 
     public Histogram requestSizes;
 
     public Histogram requestEntryCounts;

    
Optional extra information about queuing; currently only used with DELETE operations.
 
     public DeferQueueMetrics queue;
 
     protected ExternalOperationMetrics(OperationMetrics raw)
     {
          = raw._metricInFlight.getCount();
 
          = raw._metricTimes.getCount();
          = _doubleToInt(raw._metricTimes.getOneMinuteRate());
          = _doubleToInt(raw._metricTimes.getFiveMinuteRate());
          = _doubleToInt(raw._metricTimes.getFifteenMinuteRate());
          = _doubleToInt(raw._metricTimes.getMeanRate());
 
          = _histogram(raw._metricTimestrue);
          = _histogram(raw._metricSizesfalse);
          = _histogram(raw._metricEntryCountsfalse);
     }
     
     public static ExternalOperationMetrics create(OperationMetrics raw) {
         if (raw == null) {
             return null;
         }
         return new ExternalOperationMetrics(raw);
     }
     
     private static Histogram _histogram(Sampling srcboolean nanosToMillis)
     {
         if (src == null) {
             return null;
         }
         return new Histogram(src.getSnapshot(), nanosToMillis);
     }
 
     private static int _doubleToInt(double d) {
     	return (int) (d + 0.5);
     }
     
     private static int _nanosToMillis(double rawTimeNanosecs) {
     	// Since 3.0, times are in nanoseconds; used to be in milliseconds.
     	return (int) Math.round(rawTimeNanosecs * );
     }
     
     public static class Histogram
     {
         public int pct50;
         public int pct75;
         public int pct95;
         public int pct99;
         public int pct999;
 
         protected Histogram() { } // if deserializing
         public Histogram(Snapshot snapboolean nanosToMillis)
         {
         	if (nanosToMillis) {
 	             = _nanosToMillis(snap.getMedian());
 	             = _nanosToMillis(snap.get75thPercentile());
 	             = _nanosToMillis(snap.get95thPercentile());
 	             = _nanosToMillis(snap.get99thPercentile());
 	             = _nanosToMillis(snap.get999thPercentile());
        	} else {
	             = _doubleToInt(snap.getMedian());
	             = _doubleToInt(snap.get75thPercentile());
	             = _doubleToInt(snap.get95thPercentile());
	             = _doubleToInt(snap.get99thPercentile());
	             = _doubleToInt(snap.get999thPercentile());
        	}
        }
    }
New to GrepCode? Check out our FAQ X