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/01/04 13:36:23 UTC

[incubator-skywalking] branch self-telemetry created (now c8e5817)

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

wusheng pushed a change to branch self-telemetry
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git.


      at c8e5817  Finish the APIs of telemetry module.

This branch includes the following new commits:

     new c8e5817  Finish the APIs of telemetry module.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-skywalking] 01/01: Finish the APIs of telemetry module.

Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c8e581788fe1a5cbd929931937820eafe9f248c3
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Fri Jan 4 21:36:12 2019 +0800

    Finish the APIs of telemetry module.
---
 docker/config/application.yml                      |  2 +
 oap-server/pom.xml                                 |  1 +
 oap-server/server-core/pom.xml                     | 14 +++--
 .../src/main/assembly/application.yml              |  2 +
 .../src/main/resources/application.yml             |  2 +
 oap-server/server-telemetry/pom.xml                | 36 +++++++++++++
 oap-server/server-telemetry/telemetry-api/pom.xml  | 40 ++++++++++++++
 .../oap/server/telemetry/TelemetryModule.java      | 39 ++++++++++++++
 .../oap/server/telemetry/api/CounterMetric.java    | 40 ++++++++++++++
 .../oap/server/telemetry/api/GaugeMetric.java      | 50 +++++++++++++++++
 .../oap/server/telemetry/api/HistogramMetric.java  | 62 ++++++++++++++++++++++
 .../oap/server/telemetry/api/MetricCreator.java    | 60 +++++++++++++++++++++
 .../oap/server/telemetry/api/MetricTag.java        | 58 ++++++++++++++++++++
 .../oap/server/telemetry/api/TaggableMetric.java   | 28 ++++++++++
 .../telemetry/api/TelemetryRelatedContext.java     | 46 ++++++++++++++++
 .../server/telemetry/none/MetricCreatorNoop.java   | 41 ++++++++++++++
 .../telemetry/none/NoneTelemetryProvider.java      | 59 ++++++++++++++++++++
 ...ywalking.oap.server.library.module.ModuleDefine | 19 +++++++
 ...alking.oap.server.library.module.ModuleProvider | 19 +++++++
 .../server-telemetry/telemetry-prometheus/pom.xml  | 54 +++++++++++++++++++
 20 files changed, 668 insertions(+), 4 deletions(-)

diff --git a/docker/config/application.yml b/docker/config/application.yml
index 842b142..1a13b4c 100644
--- a/docker/config/application.yml
+++ b/docker/config/application.yml
@@ -95,3 +95,5 @@ query:
     path: ${SW_QUERY_GRAPHQL_PATH:/graphql}
 alarm:
   default:
+telemetry:
+  none:
\ No newline at end of file
diff --git a/oap-server/pom.xml b/oap-server/pom.xml
index 28ad1b6..040deb3 100644
--- a/oap-server/pom.xml
+++ b/oap-server/pom.xml
@@ -40,6 +40,7 @@
         <module>server-testing</module>
         <module>generated-analysis</module>
         <module>generate-tool</module>
+        <module>server-telemetry</module>
     </modules>
 
     <properties>
diff --git a/oap-server/server-core/pom.xml b/oap-server/server-core/pom.xml
index 97cd6b2..9c4075e 100644
--- a/oap-server/server-core/pom.xml
+++ b/oap-server/server-core/pom.xml
@@ -34,14 +34,15 @@
             <groupId>org.yaml</groupId>
             <artifactId>snakeyaml</artifactId>
         </dependency>
+
         <dependency>
-            <groupId>io.grpc</groupId>
-            <artifactId>grpc-testing</artifactId>
-            <scope>test</scope>
+            <groupId>org.apache.skywalking</groupId>
+            <artifactId>library-module</artifactId>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.skywalking</groupId>
-            <artifactId>library-module</artifactId>
+            <artifactId>telemetry-api</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
@@ -75,6 +76,11 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-testing</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/oap-server/server-starter/src/main/assembly/application.yml b/oap-server/server-starter/src/main/assembly/application.yml
index 7324012..746de62 100644
--- a/oap-server/server-starter/src/main/assembly/application.yml
+++ b/oap-server/server-starter/src/main/assembly/application.yml
@@ -95,3 +95,5 @@ query:
     path: ${SW_QUERY_GRAPHQL_PATH:/graphql}
 alarm:
   default:
+telemetry:
+  none:
\ No newline at end of file
diff --git a/oap-server/server-starter/src/main/resources/application.yml b/oap-server/server-starter/src/main/resources/application.yml
index 4312eba..d352526 100644
--- a/oap-server/server-starter/src/main/resources/application.yml
+++ b/oap-server/server-starter/src/main/resources/application.yml
@@ -95,3 +95,5 @@ query:
     path: ${SW_QUERY_GRAPHQL_PATH:/graphql}
 alarm:
   default:
+telemetry:
+  none:
diff --git a/oap-server/server-telemetry/pom.xml b/oap-server/server-telemetry/pom.xml
new file mode 100644
index 0000000..72897f9
--- /dev/null
+++ b/oap-server/server-telemetry/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>oap-server</artifactId>
+        <groupId>org.apache.skywalking</groupId>
+        <version>6.0.0-GA-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>server-telemetry</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>telemetry-prometheus</module>
+        <module>telemetry-api</module>
+    </modules>
+</project>
\ No newline at end of file
diff --git a/oap-server/server-telemetry/telemetry-api/pom.xml b/oap-server/server-telemetry/telemetry-api/pom.xml
new file mode 100644
index 0000000..4a46872
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>server-telemetry</artifactId>
+        <groupId>org.apache.skywalking</groupId>
+        <version>6.0.0-GA-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>telemetry-api</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.skywalking</groupId>
+            <artifactId>library-module</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/TelemetryModule.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/TelemetryModule.java
new file mode 100644
index 0000000..f0f51c9
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/TelemetryModule.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry;
+
+import org.apache.skywalking.oap.server.library.module.ModuleDefine;
+import org.apache.skywalking.oap.server.telemetry.api.MetricCreator;
+
+/**
+ * Telemetry module definition
+ *
+ * @author wusheng
+ */
+public class TelemetryModule extends ModuleDefine {
+    public static final String NAME = "telemetry";
+
+    public TelemetryModule() {
+        super(NAME);
+    }
+
+    @Override public Class[] services() {
+        return new Class[] {MetricCreator.class};
+    }
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/CounterMetric.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/CounterMetric.java
new file mode 100644
index 0000000..944872a
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/CounterMetric.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry.api;
+
+/**
+ * A counter is a cumulative metric that represents a single monotonically increasing counter whose value can only
+ * increase or be reset to zero on restart. For example, you can use a counter to represent the number of requests
+ * served, tasks completed, or errors.z
+ *
+ * @author wusheng
+ */
+public interface CounterMetric extends TaggableMetric {
+    /**
+     * Increase 1 to counter
+     */
+    void inc();
+
+    /**
+     * Increase the given value to the counter
+     *
+     * @param value
+     */
+    void inc(double value);
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/GaugeMetric.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/GaugeMetric.java
new file mode 100644
index 0000000..4fd9bfb
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/GaugeMetric.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry.api;
+
+/**
+ * A gauge is a metric that represents a single numerical value that can arbitrarily go up and down.
+ *
+ * @author wusheng
+ */
+public interface GaugeMetric extends TaggableMetric {
+    /**
+     * Increase 1 to counter
+     */
+    void inc();
+
+    /**
+     * Increase the given value to the counter
+     *
+     * @param value
+     */
+    void inc(double value);
+
+    /**
+     * Decrease 1 to counter
+     */
+    void dec();
+
+    /**
+     * Decrease the given value to the counter
+     *
+     * @param value
+     */
+    void dec(double value);
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/HistogramMetric.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/HistogramMetric.java
new file mode 100644
index 0000000..240a318
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/HistogramMetric.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry.api;
+
+import java.io.*;
+
+/**
+ * A histogram samples observations (usually things like request durations or response sizes) and counts them in
+ * configurable buckets. It also provides a sum of all observed values.
+ *
+ * @author wusheng
+ */
+public abstract class HistogramMetric implements TaggableMetric {
+    public Timer createTimer() {
+        return new Timer(this);
+    }
+
+    /**
+     * Observe an execution, get a duration in second.
+     *
+     * @param value duration in second.
+     */
+    public abstract void observe(double value);
+
+    class Timer implements Closeable {
+        private final HistogramMetric metric;
+        private final long startNanos;
+        private double duration;
+
+        public Timer(HistogramMetric metric) {
+            this.metric = metric;
+            startNanos = System.nanoTime();
+        }
+
+        public void finish() {
+            long endNanos = System.nanoTime();
+            duration = (double)(endNanos - startNanos) / 1.0E9D;
+            metric.observe(duration);
+        }
+
+        @Override
+        public void close() throws IOException {
+            finish();
+        }
+    }
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/MetricCreator.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/MetricCreator.java
new file mode 100644
index 0000000..591d67b
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/MetricCreator.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry.api;
+
+import org.apache.skywalking.oap.server.library.module.Service;
+
+/**
+ * Open API to telemetry module, allow to create metric instance with different type. Types inherits from prometheus
+ * project, and plan to move to openmetrics APIs after it is ready.
+ *
+ * @author wusheng
+ */
+public interface MetricCreator extends Service {
+    /**
+     * Create a counter type metric instance.
+     *
+     * @param name
+     * @param tips
+     * @param labels
+     * @return
+     */
+    CounterMetric createCounter(String name, String tips, MetricTag.Keys labels);
+
+    /**
+     * Create a gauge type metric instance.
+     *
+     * @param name
+     * @param tips
+     * @param labels
+     * @return
+     */
+    GaugeMetric createGauge(String name, String tips, MetricTag.Keys labels);
+
+    /**
+     * Create a Histogram type metric instance.
+     *
+     * @param name
+     * @param tips
+     * @param labels
+     * @param buckets Time bucket for duration.
+     * @return
+     */
+    HistogramMetric createHistogramMetric(String name, String tips, MetricTag.Keys labels, double... buckets);
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/MetricTag.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/MetricTag.java
new file mode 100644
index 0000000..cd5b6b4
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/MetricTag.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry.api;
+
+/**
+ * Tag for the target metric.
+ *
+ * The tag values should be set in putting value phase.
+ */
+public class MetricTag {
+    public class Keys {
+        private String[] keys;
+
+        public Keys() {
+            this.keys = new String[0];
+        }
+
+        public Keys(String... keys) {
+            this.keys = keys;
+        }
+
+        public String[] getKeys() {
+            return keys;
+        }
+    }
+
+    public class Values {
+        private String[] values;
+
+        public Values(Keys keys) {
+            this.values = new String[0];
+        }
+
+        public Values(String... keys) {
+            this.values = keys;
+        }
+
+        public String[] getValues() {
+            return values;
+        }
+    }
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/TaggableMetric.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/TaggableMetric.java
new file mode 100644
index 0000000..ade3ff5
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/TaggableMetric.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry.api;
+
+/**
+ * Set tag values to this metric instance.
+ *
+ * @author wusheng
+ */
+public interface TaggableMetric {
+    void setTagValues(MetricTag.Values values);
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/TelemetryRelatedContext.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/TelemetryRelatedContext.java
new file mode 100644
index 0000000..a37e647
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/TelemetryRelatedContext.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry.api;
+
+/**
+ * The telemetry context which the metric instances may need to know.
+ * @author wusheng
+ */
+public enum TelemetryRelatedContext {
+    INTANCE;
+
+    private volatile String id = "default";
+    private TelemetryRelatedContext(){}
+
+    /**
+     * Set a global ID to represent the current oap instance
+     */
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    /**
+     * Get the oap instance ID, if be set before, otherwise, return `default` string.
+     *
+     * @return id
+     */
+    public String getId() {
+        return id;
+    }
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/none/MetricCreatorNoop.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/none/MetricCreatorNoop.java
new file mode 100644
index 0000000..c33dda7
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/none/MetricCreatorNoop.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry.none;
+
+import org.apache.skywalking.oap.server.telemetry.api.*;
+
+/**
+ * A no-op metric create, just create nut shell metric instance.
+ *
+ * @author wusheng
+ */
+public class MetricCreatorNoop implements MetricCreator {
+    @Override public CounterMetric createCounter(String name, String tips, MetricTag.Keys labels) {
+        return null;
+    }
+
+    @Override public GaugeMetric createGauge(String name, String tips, MetricTag.Keys labels) {
+        return null;
+    }
+
+    @Override
+    public HistogramMetric createHistogramMetric(String name, String tips, MetricTag.Keys labels, double... buckets) {
+        return null;
+    }
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/none/NoneTelemetryProvider.java b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/none/NoneTelemetryProvider.java
new file mode 100644
index 0000000..2fd8123
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/none/NoneTelemetryProvider.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.telemetry.none;
+
+import org.apache.skywalking.oap.server.library.module.*;
+import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
+import org.apache.skywalking.oap.server.telemetry.api.MetricCreator;
+
+/**
+ * A nutshell telemetry implementor.
+ *
+ * @author wusheng
+ */
+public class NoneTelemetryProvider extends ModuleProvider {
+    @Override public String name() {
+        return "none";
+    }
+
+    @Override public Class<? extends ModuleDefine> module() {
+        return TelemetryModule.class;
+    }
+
+    @Override public ModuleConfig createConfigBeanIfAbsent() {
+        return new ModuleConfig() {
+        };
+    }
+
+    @Override public void prepare() throws ServiceNotProvidedException, ModuleStartException {
+        this.registerServiceImplementation(MetricCreator.class, new MetricCreatorNoop());
+    }
+
+    @Override public void start() throws ServiceNotProvidedException, ModuleStartException {
+
+    }
+
+    @Override public void notifyAfterCompleted() throws ServiceNotProvidedException, ModuleStartException {
+
+    }
+
+    @Override public String[] requiredModules() {
+        return new String[0];
+    }
+}
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine b/oap-server/server-telemetry/telemetry-api/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine
new file mode 100644
index 0000000..8c0ab8b
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleDefine
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+org.apache.skywalking.oap.server.telemetry.TelemetryModule
diff --git a/oap-server/server-telemetry/telemetry-api/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider b/oap-server/server-telemetry/telemetry-api/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
new file mode 100644
index 0000000..f266fc8
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-api/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+org.apache.skywalking.oap.server.telemetry.none.NoneTelemetryProvider
\ No newline at end of file
diff --git a/oap-server/server-telemetry/telemetry-prometheus/pom.xml b/oap-server/server-telemetry/telemetry-prometheus/pom.xml
new file mode 100644
index 0000000..7885f9b
--- /dev/null
+++ b/oap-server/server-telemetry/telemetry-prometheus/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>server-telemetry</artifactId>
+        <groupId>org.apache.skywalking</groupId>
+        <version>6.0.0-GA-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>telemetry-prometheus</artifactId>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <!-- The client -->
+        <dependency>
+            <groupId>io.prometheus</groupId>
+            <artifactId>simpleclient</artifactId>
+            <version>0.6.0</version>
+        </dependency>
+        <!-- Hotspot JVM metrics-->
+        <dependency>
+            <groupId>io.prometheus</groupId>
+            <artifactId>simpleclient_hotspot</artifactId>
+            <version>0.6.0</version>
+        </dependency>
+        <!-- Exposition HTTPServer-->
+        <dependency>
+            <groupId>io.prometheus</groupId>
+            <artifactId>simpleclient_httpserver</artifactId>
+            <version>0.6.0</version>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file