public List<TraceTag> findTags(TraceTagRuleContext context) { boolean hasError = context.hasError(); long traceMillis = context.getTrace().getRange().getDurationMillis(); if (hasError || traceMillis >= frustratedMillis) { return FRUSTRATED_LIST; } else if (traceMillis < thresholdMillis) { return SATISFIED_LIST; } else { return TOLERATING_LIST; } }
@Override public List<MetricsBag> generateMetrics(Trace trace, ResourceKey endpointResourceKey, Collection<Frame> frames) { if (ListUtil.size(frames) <= 0) { return Collections.emptyList(); } int totalErrors=0; for (Frame frame : frames) { Operation op=frame.getOperation(); Number errorsCount=op.get(ValidationJoinPointFinalizer.ERRORS_COUNT, Number.class); int numErrors=(errorsCount == null) ? 0 : errorsCount.intValue(); if (numErrors <= 0) { continue; } else { totalErrors += numErrors; } } if (totalErrors <= 0) { return Collections.emptyList(); } MetricsBag mb=MetricsBag.create(endpointResourceKey, trace.getRange()); addCounterMetricToBag(trace, mb, METRIC_KEY, totalErrors); return Collections.singletonList(mb); }
public TraceAnalysis(Trace traceValue, ServerResource sourceServer, EndPointAnalysis endPoint, Collection<Resource> extResources, Collection<TraceError> traceErrors, Collection<TraceTag> tags) { ServerName srcName=sourceServer.getServer(); ServerName trcName=traceValue.getServer(); if (!ObjectUtil.typedEquals(srcName, trcName)) { throw new IllegalArgumentException("Trace server name (" + trcName + ") does not match the source server (" + srcName + ")"); } this.trace = traceValue; this.server = sourceServer; this.endPointAnalysis = endPoint; this.externalResources = extResources; // Create a new TimeRange from the existing one. If the endPoint has a // SelfTimeRange the additional fields will be culled out as an optimization // for memory. this.responseTime = traceValue.getRange(); this.responseTimePoint = dataPointFromRange(responseTime); this.resources = new HashMap<ResourceType, Resource>(); this.traceTags = (ListUtil.size(tags) > 0) ? new HashSet<TraceTag>(tags) : new HashSet<TraceTag>(); this.errors = (ListUtil.size(traceErrors) > 0) ? new ArrayList<TraceError>(traceErrors) : new ArrayList<TraceError>(); this.applicationMetadata = ApplicationMetadataCache.getInstance(); addResources(); }
TimeRange traceRange=trace.getRange(); for (Frame frame : frames) { Operation op=frame.getOperation();
Operation op = frame.getOperation(); ResourceKey resourceKey = getResourceKey(op, endpointResourceKey); TimeRange range = trace.getRange(); int time = TimeUtil.nanosToSeconds(range.getStart()); MetricsBag mb = MetricsBag.create(resourceKey, range);
if (endPoint != null) { summary = new PersistedTraceSummary(trace.getLabel(), persistedTrace.getTraceId(), trace.getRange(), errors.size(), errorText(errors), persistedTags, trace.getServer(), trace.getAppName(), endPoint.getEndPointName()); trace.getRange(), errors.size(), errorText(errors), persistedTags, trace.getServer(), trace.getAppName(), extResource.getEndPointKey().getEndPointName(), extResource.getExternalName(), extResource.getExternalType(), extResource.getHost(), extResource.getPort(), extResource.getVendor(),