@Override public String toString() { return "AddPoint[key=" + getResourceMetricKey() + ", point=" + getPoint() + "]"; } }
@Override public String toString() { return "SyncMetricDataTag[key=" + getResourceMetricKey() + ", tag=" + getTagName() + ", value=" + getValue() + "]"; }
@Override public boolean equals(Object obj) { if (obj == null) return false; if (this == obj) return true; if (getClass() != obj.getClass()) return false; AddPointCommand other=(AddPointCommand) obj; return isEquivalent(other) && ObjectUtil.typedEquals(getPoint(), other.getPoint()) ; }
@Override public boolean equals(Object obj) { if (obj == null) return false; if (this == obj) return true; if (getClass() != obj.getClass()) return false; MetricValueCommand<?> other=(MetricValueCommand<?>) obj; return isEquivalent(other) && ObjectUtil.typedEquals(getValue(), other.getValue()); }
@Override @InsightEndPoint public void executeCommand(IncrementCommand command) { ResourceMetricKey key = command.getResourceMetricKey(); CounterMetricDataAdapter mData = (CounterMetricDataAdapter) dataRepo.createOrGetMetricData(key); mData.increment(command.getValue()); } }
@Override @InsightEndPoint public void executeCommand(UpdateGaugeCommand command) { ResourceMetricKey key = command.getResourceMetricKey(); GaugeMetricDataAdapter mData = (GaugeMetricDataAdapter) dataRepo.createOrGetMetricData(key); mData.addValues(singletonList(command.getValue())); } }
protected boolean isEquivalent (MetricDataCommand other) { if (other == null) return false; if (this == other) return true; return ObjectUtil.typedEquals(getResourceMetricKey(), other.getResourceMetricKey()); }
public List<SyncMetricDataTagCommand> generateCommands(TraceAnalysis analysis) { Set<Resource> resources = analysis.getResources(); List<SyncMetricDataTagCommand> commands = new ArrayList<SyncMetricDataTagCommand>(resources.size()); String tagName = REQUEST_URI_EXAMPLE; String tagValue = analysis.getEndPointAnalysis().getExample(); for (Resource r : resources) { ResourceMetricKey rmKey = ResourceMetricKey.valueOf(r.getKey(), ENDPOINT_RESPONSE_TIME); commands.add(new SyncMetricDataTagCommand(rmKey, tagName, tagValue)); } return commands; }
@Override public boolean equals(Object obj) { if (obj == null) return false; if (this == obj) return true; if (getClass() != obj.getClass()) return false; return isEquivalent((MetricDataCommand) obj); }
@Override public void executeCommand(SyncMetricDataTagCommand command) { repo.setTag(command.getResourceMetricKey(), command.getTagName(), command.getValue()); } }
@Override @InsightEndPoint public void executeCommand(AddPointCommand command) { ResourceMetricKey key = command.getResourceMetricKey(); GaugeMetricDataAdapter mData = (GaugeMetricDataAdapter) dataRepo.createOrGetMetricData(key); DataPoint point = command.getPoint(); Time rangeStart = point.getTimeStamp(); Time rangeEnd = rangeStart.plus(Time.inMillis((int)point.getValue())); if (rangeEnd.equals(rangeStart)) { // In case of something executing in no time, our range is still 1 ns rangeEnd = rangeEnd.plus(Time.inNanos(1)); } TimeRange pointRange = TimeRange.between(rangeStart, rangeEnd); GaugeMetricValue value = new GaugeMetricValueBuilder(pointRange).addPoint(point.getValue()).build(); mData.addValues(singletonList(value)); } }
@Override public int hashCode() { return ObjectUtil.hashCode(getResourceMetricKey()); }
public static SyncMetricDataTagCommand getMetricDataTagCommand() { ResourceMetricKey key = ResourceMetricKey.valueOf(getServerResourceCommand("butter", "butter-label").getResource().getKey(), Metrics.INVOCATION_COUNT); return new SyncMetricDataTagCommand(key,"mytagName", "tag"); }
@Override public int hashCode() { return ObjectUtil.hashCode(getResourceMetricKey()) + ObjectUtil.hashCode(getTagName()) + ObjectUtil.hashCode(getValue()) ; } }
@Override public String toString() { return getClass().getSimpleName() + "[" + String.valueOf(getResourceMetricKey()) + "]"; } }
@Override public boolean equals(Object obj) { if (obj == null) return false; if (this == obj) return true; if (getClass() != obj.getClass()) return false; SyncMetricDataTagCommand other = (SyncMetricDataTagCommand) obj; return ObjectUtil.typedEquals(getResourceMetricKey(), other.getResourceMetricKey()) && ObjectUtil.typedEquals(getTagName(), other.getTagName()) && ObjectUtil.typedEquals(getValue(), other.getValue()) ; }