You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/03/11 14:23:40 UTC
[incubator-skywalking] branch k8s-Coordinator-role updated:
Forcedly fix envoy timestamp issue.
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch k8s-Coordinator-role
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git
The following commit(s) were added to refs/heads/k8s-Coordinator-role by this push:
new d185857 Forcedly fix envoy timestamp issue.
d185857 is described below
commit d18585779369fa76461dd5182053c6beab6877ea
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Mon Mar 11 22:23:29 2019 +0800
Forcedly fix envoy timestamp issue.
---
.../server/receiver/envoy/MetricServiceGRPCHandler.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/MetricServiceGRPCHandler.java b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/MetricServiceGRPCHandler.java
index 9a413cd..6ade680 100644
--- a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/MetricServiceGRPCHandler.java
+++ b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/MetricServiceGRPCHandler.java
@@ -113,6 +113,20 @@ public class MetricServiceGRPCHandler extends MetricsServiceGrpc.MetricsServiceI
timestamp = metric.getTimestampMs();
value = metric.getGauge().getValue();
+ if (timestamp > 1000000000000000000L) {
+ /**
+ * Several versions of envoy in istio.deps send timestamp in nanoseconds,
+ * instead of milliseconds(protocol says).
+ *
+ * Sadly, but have to fix it forcedly.
+ *
+ * An example of timestamp is '1552303033488741055', clearly it is not in milliseconds.
+ *
+ * This should be removed in the future.
+ */
+ timestamp /= 1_000_000;
+ }
+
EnvoyInstanceMetric metricSource = new EnvoyInstanceMetric();
metricSource.setServiceId(serviceId);
metricSource.setServiceName(serviceName);