diff --git a/hera-all/trace-etl/trace-etl-server/src/main/java/com/xiaomi/hera/trace/etl/consumer/MetricsParseService.java b/hera-all/trace-etl/trace-etl-server/src/main/java/com/xiaomi/hera/trace/etl/consumer/MetricsParseService.java index 7c605064e..51521da09 100644 --- a/hera-all/trace-etl/trace-etl-server/src/main/java/com/xiaomi/hera/trace/etl/consumer/MetricsParseService.java +++ b/hera-all/trace-etl/trace-etl-server/src/main/java/com/xiaomi/hera/trace/etl/consumer/MetricsParseService.java @@ -143,11 +143,11 @@ public MetricsParseResult metricsParse(TSpanData tSpanData) { jtd.setTraceId(tSpanData.getTraceId()); long startTime = tSpanData.getStartEpochNanos(); if (startTime > 0) { - // 纳秒转为毫秒 + // ns to ms jtd.setStartTime(startTime / (1000 * 1000)); } long duration = tSpanData.getEndEpochNanos() - startTime; - // 纳秒转为微秒,微秒到毫秒需要保留小数 + // Nanoseconds to microseconds, microseconds to milliseconds need to keep decimal long durationUs = duration / 1000; if (duration > 0) { jtd.setDuration(durationUs); @@ -248,7 +248,7 @@ public MetricsParseResult metricsParse(TSpanData tSpanData) { } } } - // 获取process中的属性 + // Gets the properties in process TResource resource = tSpanData.getResouce(); if (resource != null) { TAttributes resourceAttributes = resource.getAttributes(); @@ -286,7 +286,7 @@ private void computeMetrics(JaegerTracerDomain jtc, HeraTraceEtlConfig config) { if (StringUtils.isEmpty(jtc.getType())) { return; } - // 请求类型处理 + // Request type processing if ("redis".equals(jtc.getType())) { redisBuild(jtc.getStatement(), jtc); } @@ -296,23 +296,23 @@ private void computeMetrics(JaegerTracerDomain jtc, HeraTraceEtlConfig config) { String serviceName = jtc.getServiceName(); String metricsServiceName = formatServiceName(serviceName); jtc.setMetricsServiceName(metricsServiceName); - // http请求 + // http request if (SpanType.HTTP.equals(jtc.getType())) { String httpMetricsName = "hera_"; if (SpanKind.SERVER.equals(jtc.getKind())) { - // 过滤http server端指标 + // Filters http server counters if (exclude(config == null ? excludeHttpServer : config.getExcludeHttpserverMethod(), jtc.getMethod())) { return; } singleMetrics.newCounter(httpMetricsName+jtc.getType() + "TotalMethodCount", "methodName", "application", "serverIp", "serverEnv", "serverEnvId") .with(jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()) .add(1, jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()); - // 成功失败数 + // success or fail counter if (jtc.isSuccess()) { singleMetrics.newCounter(httpMetricsName+jtc.getType() + "SuccessMethodCount", "methodName", "application", "serverIp", "serverEnv", "serverEnvId") .with(jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()) .add(1, jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()); - // 慢查询 + // slow query if (jtc.getDuration() > (config == null ? httpSlowTime : config.getHttpSlowThreshold())) { singleMetrics.newCounter(httpMetricsName+"httpSlowQuery", "methodName", "application", "serverIp", "serverEnv", "serverEnvId") .with(jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()) @@ -335,12 +335,10 @@ private void computeMetrics(JaegerTracerDomain jtc, HeraTraceEtlConfig config) { singleMetrics.newCounter(httpMetricsName+jtc.getType() + "ClientTotalMethodCount", "methodName", "application", "serverIp", "serverEnv", "serverEnvId") .with(jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()) .add(1, jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()); - // 成功失败数 if (jtc.isSuccess()) { singleMetrics.newCounter(httpMetricsName+jtc.getType() + "ClientSuccessMethodCount", "methodName", "application", "serverIp", "serverEnv", "serverEnvId") .with(jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()) .add(1, jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()); - // 慢查询 if (jtc.getDuration() > (config == null ? httpSlowTime : config.getHttpSlowThreshold())) { singleMetrics.newCounter(httpMetricsName+"httpClientSlowQuery", "methodName", "application", "serverIp", "serverEnv", "serverEnvId") .with(jtc.getMethod(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()) @@ -361,7 +359,7 @@ private void computeMetrics(JaegerTracerDomain jtc, HeraTraceEtlConfig config) { .observe(jtc.getDuration(), metricsServiceName, jtc.getServerIp(), jtc.getServiceEnv(), jtc.getServiceEnvId()); } } - // dubbo请求 + // dubbo request if (SpanType.DUBBO.equals(jtc.getType())) { String dubboMetricsName = "hera_"; if (SpanKind.CLIENT.equals(jtc.getKind())) { @@ -420,7 +418,6 @@ private void computeMetrics(JaegerTracerDomain jtc, HeraTraceEtlConfig config) { } // redis if (SpanType.REDIS.equals(jtc.getType())) { - // 区分慢查询 String redisMetricsName = "hera_"; if (jtc.isSuccess()) { singleMetrics.newCounter(redisMetricsName + "RedisSuccessCount", "method", "host", "port", "application", "serverIp", "serverEnv", "serverEnvId") @@ -581,7 +578,7 @@ private boolean exclude(String excludeList, String excludeString) { } /** - * 处理redis method\key + * deal redis method\key * * @param statement * @param jtc