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/21 20:28:19 UTC

[incubator-skywalking] branch exporter-impl updated: Support scope(all) metric export and finish document.

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch exporter-impl
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git


The following commit(s) were added to refs/heads/exporter-impl by this push:
     new f14a34b  Support scope(all) metric export and finish document.
f14a34b is described below

commit f14a34bbeaaab89aaf65c172fffeae802ff507c7
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Thu Mar 21 13:28:10 2019 -0700

    Support scope(all) metric export and finish document.
---
 docs/en/setup/backend/backend-setup.md             |  2 +
 docs/en/setup/backend/metric-exporter.md           | 46 ++++++++++++++++++++++
 .../server/exporter/provider/MetricFormatter.java  |  2 +
 3 files changed, 50 insertions(+)

diff --git a/docs/en/setup/backend/backend-setup.md b/docs/en/setup/backend/backend-setup.md
index 61e39b9..fe42829 100644
--- a/docs/en/setup/backend/backend-setup.md
+++ b/docs/en/setup/backend/backend-setup.md
@@ -77,6 +77,8 @@ which helps you to understand which metric data are in process, also could be us
 rules targeting the analysis oal metric objects.
 1. [Advanced deployment options](advanced-deployment.md). If you want to deploy backend in very large
 scale and support high payload, you may need this. 
+1. [Metric exporter](metric-exporter.md). Use metric data exporter to forward metric data to 3rd party
+system.
 
 ## Telemetry for backend
 OAP backend cluster itself underlying is a distributed streaming process system. For helping the Ops team,
diff --git a/docs/en/setup/backend/metric-exporter.md b/docs/en/setup/backend/metric-exporter.md
new file mode 100644
index 0000000..72e08cd
--- /dev/null
+++ b/docs/en/setup/backend/metric-exporter.md
@@ -0,0 +1,46 @@
+# Metric Exporter
+SkyWalking provides basic and most important metric aggregation, alarm and analysis. 
+In real world, people may want to forward the data to their 3rd party system, for deeper analysis or anything else.
+**Metric Exporter** makes that possible.
+
+Metric exporter is an independent module, you need manually active it.
+
+Right now, we provide the following exporters
+1. gRPC exporter
+
+## gRPC exporter
+gRPC exporter uses SkyWalking native exporter service definition. Here is proto definition.
+```proto
+service MetricExportService {
+    rpc export (stream ExportMetricValue) returns (ExportResponse) {
+    }
+}
+
+message ExportMetricValue {
+    string metricName = 1;
+    string entityName = 2;
+    string entityId = 3;
+    ValueType type = 5;
+    int64 timeBucket = 6;
+    int64 longValue = 7;
+    double doubleValue = 8;
+}
+
+enum ValueType {
+    LONG = 0;
+    DOUBLE = 1;
+}
+
+message ExportResponse {
+}
+```
+
+To active the exporter, you should add this into your `application.yml`
+```yaml
+exporter:
+  grpc:
+    targetHost: 127.0.0.1
+    targetPort: 9870
+```
+
+`targetHost`:`targetPort` is the expected target service address. You could set any gRPC server to receive the data.
\ No newline at end of file
diff --git a/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/MetricFormatter.java b/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/MetricFormatter.java
index eafb9f9..800d248 100644
--- a/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/MetricFormatter.java
+++ b/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/MetricFormatter.java
@@ -40,6 +40,8 @@ public class MetricFormatter {
             return serviceInstanceInventoryCache.get(scope).getName();
         } else if (DefaultScopeDefine.inEndpointCatalog(scope)) {
             return endpointInventoryCache.get(scope).getName();
+        } else if (scope == DefaultScopeDefine.ALL) {
+            return "";
         } else {
             return null;
         }