From fd8f2dcb8e06eb386a43625c11a383bec582e9ce Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sun, 18 Dec 2022 14:36:17 +0800 Subject: [PATCH 01/13] aws eks monitoring --- .github/workflows/skywalking.yaml | 2 + .../backend/backend-aws-eks-monitoring.md | 64 ++ docs/menu.yml | 4 + .../oap/server/core/analysis/Layer.java | 7 +- .../ui/template/UITemplateInitializer.java | 1 + .../src/main/resources/application.yml | 2 +- .../src/main/resources/log4j2.xml | 12 +- .../otel-rules/aws-eks/eks-cluster.yaml | 52 ++ .../otel-rules/aws-eks/eks-node.yaml | 72 ++ .../otel-rules/aws-eks/eks-service.yaml | 49 ++ .../aws_eks/aws_eks-cluster.json | 311 ++++++++ .../aws_eks/aws_eks-node.json | 478 +++++++++++++ .../aws_eks/aws_eks-root.json | 68 ++ .../aws_eks/aws_eks-service.json | 209 ++++++ test/e2e-v2/cases/aws/eks/docker-compose.yml | 49 ++ test/e2e-v2/cases/aws/eks/e2e.yaml | 44 ++ test/e2e-v2/cases/aws/eks/eks-cases.yaml | 28 + .../cases/aws/eks/expected/endpoint.yml | 19 + .../cases/aws/eks/expected/instance.yml | 22 + .../aws/eks/expected/metrics-has-value.yml | 19 + .../e2e-v2/cases/aws/eks/expected/service.yml | 24 + .../java-test-service/e2e-mock-sender/pom.xml | 5 + .../controller/AwsEKSOtelMetricsSender.java | 191 +++++ .../src/main/resources/application.yml | 1 + .../opentelemetry-proto/pom.xml | 98 +++ .../collector/logs/v1/logs_service.proto | 79 +++ .../metrics/v1/metrics_service.proto | 79 +++ .../collector/trace/v1/trace_service.proto | 79 +++ .../proto/common/v1/common.proto | 77 ++ .../opentelemetry/proto/logs/v1/logs.proto | 177 +++++ .../proto/metrics/v1/metrics.proto | 666 ++++++++++++++++++ .../proto/resource/v1/resource.proto | 37 + .../opentelemetry/proto/trace/v1/trace.proto | 280 ++++++++ test/e2e-v2/java-test-service/pom.xml | 1 + 34 files changed, 3298 insertions(+), 8 deletions(-) create mode 100644 docs/en/setup/backend/backend-aws-eks-monitoring.md create mode 100644 oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-cluster.yaml create mode 100644 oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-node.yaml create mode 100644 oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml create mode 100644 oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json create mode 100644 oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-node.json create mode 100644 oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-root.json create mode 100644 oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-service.json create mode 100644 test/e2e-v2/cases/aws/eks/docker-compose.yml create mode 100644 test/e2e-v2/cases/aws/eks/e2e.yaml create mode 100644 test/e2e-v2/cases/aws/eks/eks-cases.yaml create mode 100644 test/e2e-v2/cases/aws/eks/expected/endpoint.yml create mode 100644 test/e2e-v2/cases/aws/eks/expected/instance.yml create mode 100644 test/e2e-v2/cases/aws/eks/expected/metrics-has-value.yml create mode 100644 test/e2e-v2/cases/aws/eks/expected/service.yml create mode 100644 test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/AwsEKSOtelMetricsSender.java create mode 100644 test/e2e-v2/java-test-service/opentelemetry-proto/pom.xml create mode 100644 test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/logs/v1/logs_service.proto create mode 100644 test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/metrics/v1/metrics_service.proto create mode 100644 test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/trace/v1/trace_service.proto create mode 100644 test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/common/v1/common.proto create mode 100644 test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/logs/v1/logs.proto create mode 100644 test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto create mode 100644 test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/resource/v1/resource.proto create mode 100644 test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/trace/v1/trace.proto diff --git a/.github/workflows/skywalking.yaml b/.github/workflows/skywalking.yaml index 0580f99d7182..2dd30ae57cbd 100644 --- a/.github/workflows/skywalking.yaml +++ b/.github/workflows/skywalking.yaml @@ -645,6 +645,8 @@ jobs: config: test/e2e-v2/cases/exporter/kafka/e2e.yaml - name: Virtual MQ config: test/e2e-v2/cases/virtual-mq/e2e.yaml + - name: AWS Cloud EKS + config: test/e2e-v2/cases/aws/eks/e2e.yaml steps: - uses: actions/checkout@v3 with: diff --git a/docs/en/setup/backend/backend-aws-eks-monitoring.md b/docs/en/setup/backend/backend-aws-eks-monitoring.md new file mode 100644 index 000000000000..a465f9d042d9 --- /dev/null +++ b/docs/en/setup/backend/backend-aws-eks-monitoring.md @@ -0,0 +1,64 @@ +# AWS Cloud EKS monitoring +## APISIX performance from `apisix prometheus plugin` +SkyWalking leverages OpenTelemetry Collector to transfer the metrics to +[OpenTelemetry receiver](opentelemetry-receiver.md) and into the [Meter System](./../../concepts-and-designs/meter.md). + +### Data flow +1. OpenTelemetry Collector fetches metrics from EKS via [awscontainerinsightreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) and pushes metrics to SkyWalking OAP Server via the OpenCensus gRPC Exporter or OpenTelemetry gRPC exporter. +2. The SkyWalking OAP Server parses the expression with [MAL](../../concepts-and-designs/mal.md) to filter/calculate/aggregate and store the results. + +### Set up +1. Deploy [amazon/aws-otel-collector](https://hub.docker.com/r/amazon/aws-otel-collector) as `DaemonSet` to EKS +3. Config SkyWalking [OpenTelemetry receiver](opentelemetry-receiver.md). + +### APISIX Monitoring +[APISIX prometheus plugin](https://apisix.apache.org/docs/apisix/plugins/prometheus/) provide multiple dimensions metrics for APISIX server , upstream , route , etc. +Accordingly, SkyWalking observes the status, payload, and latency of the APISIX server, which is cataloged as a `LAYER: APISIX` `Service` in the OAP. Meanwhile, the instances would be recognized as `LAYER: APISIX` `instance`s. The route rules and nodes would be recognized as `endpoint`s with `route/` and `upstream/` prefixes. + +#### Specify Job Name + +SkyWalking distinguishes AWS Cloud EKS metrics by attributes `job_name`, which value is `aws-cloud-eks-monitoring` +You could leverage OTEL Collector processor to add `job_name` attribute , as following : + +```yaml +processors: + resource/job-name: + attributes: + - key: job_name + value: aws-cloud-eks-monitoring + action: insert +``` + +Notice , if you don't specify `job_name` attribute, SkyWalking OAP will ignore the metrics + +#### Supported Metrics +| Monitoring Panel | Unit | Metric Name | Catalog | Description | Data Source | +|-------------------------------------|------|----------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------------|--------------------------| +| HTTP status | | meter_apisix_sv_http_status | Service | The increment rate of the status of HTTP requests | APISIX Prometheus plugin | +| HTTP latency | | meter_apisix_sv_http_latency | Service | The increment rate of the latency of HTTP requests | APISIX Prometheus plugin | +| HTTP bandwidth | KB | meter_apisix_sv_bandwidth | Service | The increment rate of the bandwidth of HTTP requests | APISIX Prometheus plugin | +| HTTP status of non-matched requests | | meter_apisix_sv_http_status | Service | The increment rate of the status of HTTP requests, which don't match any route | APISIX Prometheus plugin | +| HTTP latency non-matched requests | | meter_apisix_sv_http_latency | Service | The increment rate of the latency of HTTP requests, which don't match any route | APISIX Prometheus plugin | +| HTTP bandwidth non-matched requests | KB | meter_apisix_sv_bandwidth | Service | The increment rate of the bandwidth of HTTP requests ,which don't match any route | APISIX Prometheus plugin | +| HTTP connection | | meter_apisix_sv_http_connections | Service | The avg number of the connections | APISIX Prometheus plugin | +| HTTP Request Trend | | meter_apisix_http_requests | Service | The increment rate of HTTP requests | APISIX Prometheus plugin | +| HTTP status | | meter_apisix_instance_http_status | Instance | The increment rate of the status of HTTP requests | APISIX Prometheus plugin | +| HTTP latency | | meter_apisix_instance_http_latency | Instance | The increment rate of the latency of HTTP requests | APISIX Prometheus plugin | +| HTTP bandwidth | KB | meter_apisix_instance_bandwidth | Instance | The increment rate of the bandwidth of HTTP requests | APISIX Prometheus plugin | +| HTTP status of non-matched requests | | meter_apisix_instance_http_status | Instance | The increment rate of the status of HTTP requests, which don't match any route | APISIX Prometheus plugin | +| HTTP latency non-matched requests | | meter_apisix_instance_http_latency | Instance | The increment rate of the latency of HTTP requests, which don't match any route | APISIX Prometheus plugin | +| HTTP bandwidth non-matched requests | KB | meter_apisix_instance_bandwidth | Instance | The increment rate of the bandwidth of HTTP requests ,which don't match any route | APISIX Prometheus plugin | +| HTTP connection | | meter_apisix_instance_http_connections | Instance | The avg number of the connections | APISIX Prometheus plugin | +| HTTP Request Trend | | meter_apisix_instance_http_requests | Instance | The increment rate of HTTP requests | APISIX Prometheus plugin | +| Shared dict capacity | MB | meter_apisix_instance_shared_dict_capacity_bytes | Instance | The avg capacity of shared dict capacity | APISIX Prometheus plugin | +| Shared free space | MB | meter_apisix_instance_shared_dict_free_space_bytes | Instance | The avg free space of shared dict capacity | APISIX Prometheus plugin | +| etcd index | | meter_apisix_instance_sv_etcd_indexes | Instance | etcd modify index for APISIX keys | APISIX Prometheus plugin | +| etcd latest reachability | | meter_apisix_instance_sv_etcd_reachable | Instance | etcd latest reachable , Refer to [APISIX Prometheus plugin](https://apisix.apache.org/docs/apisix/plugins/prometheus/) | APISIX Prometheus plugin | +| HTTP status | | meter_apisix_endpoint_node_http_status | Endpoint | The increment rate of the status of HTTP requests | APISIX Prometheus plugin | +| HTTP latency | | meter_apisix_endpoint_node_http_latency | Endpoint | The increment rate of the latency of HTTP requests | APISIX Prometheus plugin | +| HTTP bandwidth | KB | meter_apisix_endpoint_node_bandwidth | Endpoint | The increment rate of the bandwidth of HTTP requests | APISIX Prometheus plugin | + +### Customizations +You can customize your own metrics/expression/dashboard panel. +The metrics definition and expression rules are found in `/config/otel-rules/apisix.yaml`. +The APISIX dashboard panel configurations are found in `/config/ui-initialized-templates/apisix`. \ No newline at end of file diff --git a/docs/menu.yml b/docs/menu.yml index 046ec4d792ee..c93d6e6c33a1 100644 --- a/docs/menu.yml +++ b/docs/menu.yml @@ -179,6 +179,10 @@ catalog: catalog: - name: "Linux Monitoring" path: "/en/setup/backend/backend-vm-monitoring" + - name: "AWS Cloud Monitoring" + catalog: + - name: "EKS Monitoring" + path: "/en/setup/backend/backend-aws-eks-monitoring" - name: "Browser Monitoring" path: "/en/setup/service-agent/browser-agent" - name: "Gateway Monitoring" diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java index db393dcb8be5..d13c393ce182 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java @@ -136,7 +136,12 @@ public enum Layer { /** * Apache APISIX is an open source, dynamic, scalable, and high-performance cloud native API gateway. */ - APISIX(21, true); + APISIX(21, true), + + /** + * Apache APISIX is an open source, dynamic, scalable, and high-performance cloud native API gateway. + */ + AWS_EKS(22, true); private final int value; /** diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java index 2f62be0f3af3..1183a848a5d1 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java @@ -60,6 +60,7 @@ public class UITemplateInitializer { Layer.FAAS.name(), Layer.APISIX.name(), Layer.VIRTUAL_MQ.name(), + Layer.AWS_EKS.name(), "custom" }; private final UITemplateManagementService uiTemplateManagementService; diff --git a/oap-server/server-starter/src/main/resources/application.yml b/oap-server/server-starter/src/main/resources/application.yml index 32da4e1c48d2..186dfc7c76f2 100644 --- a/oap-server/server-starter/src/main/resources/application.yml +++ b/oap-server/server-starter/src/main/resources/application.yml @@ -353,7 +353,7 @@ receiver-otel: selector: ${SW_OTEL_RECEIVER:default} default: enabledHandlers: ${SW_OTEL_RECEIVER_ENABLED_HANDLERS:"oc,otlp"} - enabledOtelRules: ${SW_OTEL_RECEIVER_ENABLED_OTEL_RULES:"apisix,k8s/*,istio-controlplane,vm,mysql/*,postgresql/*,oap"} + enabledOtelRules: ${SW_OTEL_RECEIVER_ENABLED_OTEL_RULES:"apisix,k8s/*,istio-controlplane,vm,mysql/*,postgresql/*,oap,aws-eks/*"} receiver-zipkin: selector: ${SW_RECEIVER_ZIPKIN:-} diff --git a/oap-server/server-starter/src/main/resources/log4j2.xml b/oap-server/server-starter/src/main/resources/log4j2.xml index 6cbaa5c9dd0e..0702a7e77dcc 100644 --- a/oap-server/server-starter/src/main/resources/log4j2.xml +++ b/oap-server/server-starter/src/main/resources/log4j2.xml @@ -17,7 +17,7 @@ ~ --> - + @@ -32,15 +32,15 @@ - + - - + + - - + + diff --git a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-cluster.yaml b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-cluster.yaml new file mode 100644 index 000000000000..73e2fa860970 --- /dev/null +++ b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-cluster.yaml @@ -0,0 +1,52 @@ +# 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. + +# This will parse a textual representation of a duration. The formats +# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS} +# with days considered to be exactly 24 hours. +#

+# Examples: +#

+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# 
+ +filter: "{ tags -> tags.job_name == 'aws-cloud-eks-monitoring' }" # The OpenTelemetry job name +expPrefix: tag({tags -> tags.cluster = 'aws-eks-cluster::' + tags.ClusterName}) +expSuffix: service(['cluster'], Layer.AWS_EKS) +metricPrefix: eks_cluster +metricsRules: + - name: node_count + exp: cluster_node_count.downsampling(LATEST) + - name: failed_node_count + exp: cluster_failed_node_count.downsampling(LATEST) + - name: namespace_count + exp: namespace_number_of_running_pods.sum(['Namespace','cluster']) + - name: service_count + exp: service_number_of_running_pods.sum(['Service','cluster']) + - name: net_rx_dropped + exp: node_network_rx_dropped.downsampling(SUM) + - name: net_rx_error + exp: node_network_rx_errors.downsampling(SUM) + - name: net_tx_dropped + exp: node_network_tx_dropped.downsampling(SUM) + - name: net_tx_error + exp: node_network_tx_errors.downsampling(SUM) diff --git a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-node.yaml b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-node.yaml new file mode 100644 index 000000000000..90debc1e4dd7 --- /dev/null +++ b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-node.yaml @@ -0,0 +1,72 @@ +# 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. + +# This will parse a textual representation of a duration. The formats +# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS} +# with days considered to be exactly 24 hours. +#

+# Examples: +#

+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# 
+ +filter: "{ tags -> tags.job_name == 'aws-cloud-eks-monitoring' }" # The OpenTelemetry job name +expPrefix: tag({tags -> tags.cluster = 'aws-eks-cluster::' + tags.ClusterName}) +expSuffix: instance(['cluster'],['NodeName'], Layer.AWS_EKS) +metricPrefix: eks_cluster_node +metricsRules: + - name: pod_number + exp: pod_number_of_containers.downsampling(SUM) + - name: cpu_utilization + exp: node_cpu_utilization + + + + - name: memory_utilization + exp: node_memory_utilization + - name: net_rx_bytes + exp: node_network_rx_bytes + - name: net_rx_error + exp: node_network_rx_errors + - name: net_tx_bytes + exp: node_network_tx_bytes + - name: net_tx_error + exp: node_network_tx_errors + - name: disk_io_write + exp: node_diskio_io_service_bytes_write.sum(['device','cluster','NodeName']) + - name: disk_io_read + exp: node_diskio_io_service_bytes_read.sum(['device','cluster','NodeName']) + - name: fs_utilization + exp: node_filesystem_utilization.sum(['device','cluster','NodeName']) + # Pod + - name: pod_cpu_utilization + exp: pod_cpu_utilization.sum(['PodName','cluster','NodeName']) + - name: pod_memory_utilization + exp: pod_memory_utilization.sum(['PodName','cluster','NodeName']) + - name: pod_net_rx_bytes + exp: pod_network_rx_bytes.sum(['PodName','cluster','NodeName']) + - name: pod_net_rx_error + exp: pod_network_rx_errors.sum(['PodName','cluster','NodeName']) + - name: pod_net_tx_bytes + exp: pod_network_tx_bytes.sum(['PodName','cluster','NodeName']) + - name: pod_net_tx_error + exp: pod_network_tx_errors.sum(['PodName','cluster','NodeName']) diff --git a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml new file mode 100644 index 000000000000..d2fbd229f7ab --- /dev/null +++ b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml @@ -0,0 +1,49 @@ +# 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. + +# This will parse a textual representation of a duration. The formats +# accepted are based on the ISO-8601 duration format {@code PnDTnHnMn.nS} +# with days considered to be exactly 24 hours. +#

+# Examples: +#

+#    "PT20.345S" -- parses as "20.345 seconds"
+#    "PT15M"     -- parses as "15 minutes" (where a minute is 60 seconds)
+#    "PT10H"     -- parses as "10 hours" (where an hour is 3600 seconds)
+#    "P2D"       -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
+#    "P2DT3H4M"  -- parses as "2 days, 3 hours and 4 minutes"
+#    "P-6H3M"    -- parses as "-6 hours and +3 minutes"
+#    "-P6H3M"    -- parses as "-6 hours and -3 minutes"
+#    "-P-6H+3M"  -- parses as "+6 hours and -3 minutes"
+# 
+ +filter: "{ tags -> tags.job_name == 'aws-cloud-eks-monitoring' && tags.Service?.trim() }" # The OpenTelemetry job name +expSuffix: tag({tags -> tags.cluster = 'aws-eks-cluster::' + tags.ClusterName}).endpoint(['cluster'],['Service'], Layer.AWS_EKS) +metricPrefix: eks_cluster_service +metricsRules: + - name: pod_number + exp: pod_number_of_containers + - name: pod_cpu_utilization + exp: pod_cpu_utilization + - name: pod_memory_utilization + exp: pod_memory_utilization + - name: pod_net_rx_bytes + exp: pod_network_rx_bytes + - name: pod_net_rx_error + exp: pod_network_rx_errors + - name: pod_net_tx_bytes + exp: pod_network_tx_bytes + - name: pod_net_tx_error + exp: pod_network_tx_errors diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json new file mode 100644 index 000000000000..ab5b52b7dd5a --- /dev/null +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json @@ -0,0 +1,311 @@ +/** + * 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. + */ + +[ + { + "id": "AWS_EKS-cluster", + "configuration": { + "children": [ + { + "x": 0, + "y": 0, + "w": 6, + "h": 13, + "i": "1", + "type": "Widget", + "widget": { + "title": "Node Count" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_count" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 6, + "y": 0, + "w": 6, + "h": 13, + "i": "2", + "type": "Widget", + "widget": { + "title": "Failed Node Count" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_failed_node_count" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 12, + "y": 0, + "w": 6, + "h": 13, + "i": "3", + "type": "Widget", + "widget": { + "title": "Pod Count (namespace dimension)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_namespace_count" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ] + }, + { + "x": 18, + "y": 0, + "w": 6, + "h": 13, + "i": "4", + "type": "Widget", + "widget": { + "title": "Pod Count (service dimension)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_service_count" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ] + }, + { + "x": 0, + "y": 13, + "w": 6, + "h": 13, + "i": "8", + "type": "Widget", + "widget": { + "title": "Network RX Dropped Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_net_rx_dropped" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 6, + "y": 13, + "w": 6, + "h": 13, + "i": "9", + "type": "Widget", + "widget": { + "title": "Network RX Error Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_net_rx_error" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 12, + "y": 13, + "w": 6, + "h": 13, + "i": "10", + "type": "Widget", + "widget": { + "title": "Network TX Dropped Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_net_tx_dropped" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 18, + "y": 13, + "w": 6, + "h": 13, + "i": "11", + "type": "Widget", + "widget": { + "title": "Network TX Error Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_net_tx_error" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 0, + "y": 26, + "w": 12, + "h": 26, + "i": "12", + "type": "Widget", + "widget": { + "title": "Node List" + }, + "graph": { + "type": "InstanceList", + "dashboardName": "AWS_EKS-node", + "fontSize": 12 + }, + "metrics": [ + "eks_cluster_node_cpu_utilization", + "eks_cluster_node_memory_utilization", + "eks_cluster_node_disk_io_write", + "eks_cluster_node_fs_utilization" + ], + "metricTypes": [ + "readMetricsValues", + "readMetricsValues", + "readLabeledMetricsValues", + "readLabeledMetricsValues" + ], + "metricConfig": [ + { + "label": "CPU Usage", + "unit": "%", + "calculation": "average" + }, + { + "label": "memory Usage", + "unit": "%", + "calculation": "average" + } + ], + "moved": false + }, + { + "x": 12, + "y": 52, + "w": 12, + "h": 26, + "i": "13", + "type": "Widget", + "widget": { + "title": "Service List" + }, + "graph": { + "type": "EndpointList", + "dashboardName": "AWS_EKS-service", + "fontSize": 12, + "showXAxis": false, + "showYAxis": false, + "showGroup": true + }, + "metrics": [ + "eks_cluster_service_pod_cpu_utilization", + "eks_cluster_service_pod_memory_utilization" + ], + "metricTypes": [ + "readMetricsValues", + "readMetricsValues" + ], + "metricConfig": [ + { + "label": "CPU Usage", + "unit": "%", + "calculation": "average" + }, + { + "label": "memory Usage", + "unit": "%", + "calculation": "average" + } + ] + } + ], + "layer": "AWS_EKS", + "entity": "Service", + "name": "AWS_EKS-cluster", + "id": "AWS_EKS-cluster", + "isRoot": false + } + } +] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-node.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-node.json new file mode 100644 index 000000000000..5fef6fbe77c8 --- /dev/null +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-node.json @@ -0,0 +1,478 @@ +/** + * 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. + */ + +[ + { + "id": "AWS_EKS-node", + "configuration": { + "children": [ + { + "x": 0, + "y": 0, + "w": 24, + "h": 52, + "i": "0", + "type": "Tab", + "children": [ + { + "name": "Node", + "children": [ + { + "x": 0, + "y": 0, + "w": 6, + "h": 13, + "i": "3", + "type": "Widget", + "widget": { + "title": "Pod Count" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_pod_number" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 6, + "y": 0, + "w": 6, + "h": 13, + "i": "6", + "type": "Widget", + "widget": { + "title": "CPU Utilization (%)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_cpu_utilization" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 12, + "y": 0, + "w": 6, + "h": 13, + "i": "7", + "type": "Widget", + "widget": { + "title": "Memory Utilization (%)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_memory_utilization" + ], + "metricTypes": [ + "readMetricsValues" + ] + + }, + { + "x": 18, + "y": 0, + "w": 6, + "h": 13, + "i": "8", + "type": "Widget", + "widget": { + "title": "Network RX (KB per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_net_rx_bytes" + ], + "metricTypes": [ + "readMetricsValues" + ], + "metricConfig": [ + { + "calculation": "byteToKB" + } + ] + }, + { + "x": 0, + "y": 13, + "w": 6, + "h": 13, + "i": "9", + "type": "Widget", + "widget": { + "title": "Network RX Error Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_net_rx_error" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 6, + "y": 13, + "w": 6, + "h": 13, + "i": "10", + "type": "Widget", + "widget": { + "title": "Network TX (KB per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_net_tx_bytes" + ], + "metricTypes": [ + "readMetricsValues" + ], + "metricConfig": [ + { + "calculation": "byteToKB" + } + ] + }, + { + "x": 12, + "y": 13, + "w": 6, + "h": 13, + "i": "11", + "type": "Widget", + "widget": { + "title": "Network TX Error Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_net_tx_error" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 18, + "y": 13, + "w": 6, + "h": 13, + "i": "12", + "type": "Widget", + "widget": { + "title": "Disk IO Write (byte per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_disk_io_write" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ] + }, + { + "x": 0, + "y": 26, + "w": 6, + "h": 13, + "i": "13", + "type": "Widget", + "widget": { + "title": "Disk IO Read (byte per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_disk_io_read" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ] + }, + { + "x": 6, + "y": 26, + "w": 6, + "h": 13, + "i": "14", + "type": "Widget", + "widget": { + "title": "FS Utilization (%)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_fs_utilization" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ] + } + ] + }, + { + "name": "Pod", + "children": [ + { + "x": 0, + "y": 0, + "w": 6, + "h": 13, + "i": "1", + "type": "Widget", + "widget": { + "title": "CPU Utilization" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_pod_cpu_utilization" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ] + }, + { + "x": 6, + "y": 0, + "w": 6, + "h": 13, + "i": "2", + "type": "Widget", + "widget": { + "title": "Memory Utilization" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_pod_memory_utilization" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ] + }, + { + "x": 12, + "y": 0, + "w": 6, + "h": 13, + "i": "3", + "type": "Widget", + "widget": { + "title": "Network RX (KB per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_pod_net_rx_bytes" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ], + "metricConfig": [ + { + "calculation": "byteToKB" + } + ] + }, + { + "x": 18, + "y": 0, + "w": 6, + "h": 13, + "i": "4", + "type": "Widget", + "widget": { + "title": "Network RX Error Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_pod_net_rx_error" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ] + }, + { + "x": 0, + "y": 13, + "w": 6, + "h": 13, + "i": "5", + "type": "Widget", + "widget": { + "title": "Network TX (KB per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_pod_net_tx_bytes" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ], + "metricConfig": [ + { + "calculation": "byteToKB" + } + ] + }, + { + "x": 6, + "y": 13, + "w": 6, + "h": 13, + "i": "6", + "type": "Widget", + "widget": { + "title": "Network TX Error Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_node_pod_net_tx_error" + ], + "metricTypes": [ + "readLabeledMetricsValues" + ] + } + + ] + + } + + + ] + } + + ], + + "layer": "AWS_EKS", + "entity": "ServiceInstance", + "name": "AWS_EKS-node", + "id": "AWS_EKS-node", + "isRoot": false + } + } +] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-root.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-root.json new file mode 100644 index 000000000000..401538bbc772 --- /dev/null +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-root.json @@ -0,0 +1,68 @@ +/** + * 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. + */ + +[ + { + "id": "AWS_EKS-Root", + "configuration": { + "children": [ + { + "x": 0, + "y": 2, + "w": 24, + "h": 51, + "i": "0", + "type": "Widget", + "widget": { + "title": "" + }, + "graph": { + "type": "ServiceList", + "dashboardName": "AWS_EKS-cluster", + "fontSize": 12, + "showXAxis": false, + "showYAxis": false, + "showGroup": true + }, + "moved": false + }, + { + "x": 0, + "y": 0, + "w": 24, + "h": 2, + "i": "100", + "type": "Text", + "graph": { + "fontColor":"blue", + "backgroundColor":"white", + "content":"Provide AWS Could monitoring through AWS Container Insights Receiver", + "fontSize":14, + "textAlign":"left", + "url":"https://skywalking.apache.org/docs/main/next/en/setup/backend/backend-aws-eks-monitoring/" + }, + "moved": false + } + ], + "id": "AWS_EKS-Root", + "layer": "AWS_EKS", + "entity": "All", + "name": "AWS_EKS-Root", + "isRoot": true + } + } +] diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-service.json new file mode 100644 index 000000000000..b9153666d7dd --- /dev/null +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-service.json @@ -0,0 +1,209 @@ +/** + * 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. + */ + +[ + { + "id": "AWS_EKS-service", + "configuration": { + "children": [ + { + "x": 0, + "y": 0, + "w": 24, + "h": 52, + "i": "0", + "type": "Tab", + "children": [ + { + "name": "Pod", + "children": [ + { + "x": 0, + "y": 0, + "w": 6, + "h": 13, + "i": "1", + "type": "Widget", + "widget": { + "title": "CPU Utilization (%)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_service_pod_cpu_utilization" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 6, + "y": 0, + "w": 6, + "h": 13, + "i": "2", + "type": "Widget", + "widget": { + "title": "Memory Utilization (%)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_service_pod_memory_utilization" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 12, + "y": 0, + "w": 6, + "h": 13, + "i": "3", + "type": "Widget", + "widget": { + "title": "Network RX (KB per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_service_pod_net_rx_bytes" + ], + "metricTypes": [ + "readMetricsValues" + ], + "metricConfig": [ + { + "calculation": "byteToKB" + } + ] + }, + { + "x": 18, + "y": 0, + "w": 6, + "h": 13, + "i": "4", + "type": "Widget", + "widget": { + "title": "Network RX Error Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_service_pod_net_rx_error" + ], + "metricTypes": [ + "readMetricsValues" + ] + }, + { + "x": 0, + "y": 13, + "w": 6, + "h": 13, + "i": "5", + "type": "Widget", + "widget": { + "title": "Network TX (KB per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_service_pod_net_tx_bytes" + ], + "metricTypes": [ + "readMetricsValues" + ], + "metricConfig": [ + { + "calculation": "byteToKB" + } + ] + }, + { + "x": 6, + "y": 13, + "w": 6, + "h": 13, + "i": "6", + "type": "Widget", + "widget": { + "title": "Network TX Error Count (per second)" + }, + "graph": { + "type": "Line", + "step": false, + "smooth": false, + "showSymbol": false, + "showXAxis": true, + "showYAxis": true + }, + "metrics": [ + "eks_cluster_service_pod_net_tx_error" + ], + "metricTypes": [ + "readMetricsValues" + ] + } + ] + } + + ] + } + + ], + + "layer": "AWS_EKS", + "entity": "Endpoint", + "name": "AWS_EKS-service", + "id": "AWS_EKS-service", + "isRoot": false + } + } +] diff --git a/test/e2e-v2/cases/aws/eks/docker-compose.yml b/test/e2e-v2/cases/aws/eks/docker-compose.yml new file mode 100644 index 000000000000..d75634329fc3 --- /dev/null +++ b/test/e2e-v2/cases/aws/eks/docker-compose.yml @@ -0,0 +1,49 @@ +# 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. + +version: '2.1' + +services: + oap: + extends: + file: ../../../script/docker-compose/base-compose.yml + service: oap + ports: + - 12800 + networks: + e2e: + + sender: + image: "eclipse-temurin:8-jre" + volumes: + - ./../../../java-test-service/e2e-mock-sender/target/e2e-mock-sender-2.0.0.jar:/e2e-mock-sender-2.0.0.jar + command: [ "java", "-jar", "/e2e-mock-sender-2.0.0.jar" ] + environment: + OAP_HOST: oap + OAP_GRPC_PORT: 11800 + networks: + - e2e + ports: + - 9093:9093 + healthcheck: + test: ["CMD", "sh", "-c", "nc -nz 127.0.0.1 9093"] + interval: 5s + timeout: 60s + retries: 120 + depends_on: + oap: + condition: service_healthy +networks: + e2e: diff --git a/test/e2e-v2/cases/aws/eks/e2e.yaml b/test/e2e-v2/cases/aws/eks/e2e.yaml new file mode 100644 index 000000000000..76f85d3c2785 --- /dev/null +++ b/test/e2e-v2/cases/aws/eks/e2e.yaml @@ -0,0 +1,44 @@ +# 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. + +# This file is used to show how to write configuration files and can be used to test. + +setup: + env: compose + file: docker-compose.yml + timeout: 20m + init-system-environment: ../../../script/env + steps: + - name: set PATH + command: export PATH=/tmp/skywalking-infra-e2e/bin:$PATH + - name: install yq + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh yq + - name: install swctl + command: bash test/e2e-v2/script/prepare/setup-e2e-shell/install.sh swctl + +trigger: + action: http + interval: 3s + times: 10 + url: http://localhost:9093/aws/otel/eks/send + method: GET + +verify: + retry: + count: 10 + interval: 3s + cases: + - includes: + - ./eks-cases.yaml diff --git a/test/e2e-v2/cases/aws/eks/eks-cases.yaml b/test/e2e-v2/cases/aws/eks/eks-cases.yaml new file mode 100644 index 000000000000..9e53b3982ca2 --- /dev/null +++ b/test/e2e-v2/cases/aws/eks/eks-cases.yaml @@ -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. + +# This file is used to show how to write configuration files and can be used to test. + + cases: + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls + expected: expected/service.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql instance ls --service-name=aws-eks-cluster::SkyWalking + expected: expected/instance.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql endpoint ls --service-name=aws-eks-cluster::SkyWalking + expected: expected/endpoint.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=eks_cluster_node_memory_utilization --service-name=aws-eks-cluster::SkyWalking --instance-name=ip-172-31-23-33.ap-northeast-1.compute.internal | yq e 'to_entries' - + expected: expected/metrics-has-value.yml + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=eks_cluster_service_pod_net_rx_bytes --service-name=aws-eks-cluster::SkyWalking --endpoint-name=kube-dns | yq e 'to_entries' - + expected: expected/metrics-has-value.yml diff --git a/test/e2e-v2/cases/aws/eks/expected/endpoint.yml b/test/e2e-v2/cases/aws/eks/expected/endpoint.yml new file mode 100644 index 000000000000..0197edc717d9 --- /dev/null +++ b/test/e2e-v2/cases/aws/eks/expected/endpoint.yml @@ -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. + +{{- contains .}} +- id: {{ b64enc "aws-eks-cluster::SkyWalking" }}.1_{{ b64enc "kube-dns" }} + name: kube-dns +{{- end}} diff --git a/test/e2e-v2/cases/aws/eks/expected/instance.yml b/test/e2e-v2/cases/aws/eks/expected/instance.yml new file mode 100644 index 000000000000..89127279b042 --- /dev/null +++ b/test/e2e-v2/cases/aws/eks/expected/instance.yml @@ -0,0 +1,22 @@ +# 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. + + {{- contains . }} +- id: {{ notEmpty .id }} + name: ip-172-31-23-33.ap-northeast-1.compute.internal + instanceuuid: {{ notEmpty .instanceuuid }} + attributes: [] + language: UNKNOWN + {{- end }} diff --git a/test/e2e-v2/cases/aws/eks/expected/metrics-has-value.yml b/test/e2e-v2/cases/aws/eks/expected/metrics-has-value.yml new file mode 100644 index 000000000000..ce1f3d83c82f --- /dev/null +++ b/test/e2e-v2/cases/aws/eks/expected/metrics-has-value.yml @@ -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. + +{{- contains . }} +- key: {{ notEmpty .key }} + value: {{ ge .value 0 }} +{{- end }} diff --git a/test/e2e-v2/cases/aws/eks/expected/service.yml b/test/e2e-v2/cases/aws/eks/expected/service.yml new file mode 100644 index 000000000000..8fb6d1070595 --- /dev/null +++ b/test/e2e-v2/cases/aws/eks/expected/service.yml @@ -0,0 +1,24 @@ +# 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. + + {{- contains . }} +- id: {{ b64enc "aws-eks-cluster::SkyWalking" }}.1 + name: aws-eks-cluster::SkyWalking + group: aws-eks-cluster + shortname: SkyWalking + normal: true + layers: + - AWS_EKS + {{- end }} diff --git a/test/e2e-v2/java-test-service/e2e-mock-sender/pom.xml b/test/e2e-v2/java-test-service/e2e-mock-sender/pom.xml index dc17f0759860..41c1bb89d49f 100644 --- a/test/e2e-v2/java-test-service/e2e-mock-sender/pom.xml +++ b/test/e2e-v2/java-test-service/e2e-mock-sender/pom.xml @@ -39,6 +39,11 @@ e2e-protocol ${project.version} + + org.apache.skywalking + opentelemetry-proto + ${project.version} + org.apache.kafka kafka-clients diff --git a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/AwsEKSOtelMetricsSender.java b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/AwsEKSOtelMetricsSender.java new file mode 100644 index 000000000000..2ab6b8e97ac2 --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/AwsEKSOtelMetricsSender.java @@ -0,0 +1,191 @@ +/* + * 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.e2e.controller; + +import io.grpc.ManagedChannel; +import io.grpc.internal.DnsNameResolverProvider; +import io.grpc.netty.NettyChannelBuilder; +import io.grpc.stub.StreamObserver; +import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest; +import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse; +import io.opentelemetry.proto.collector.metrics.v1.MetricsServiceGrpc; +import io.opentelemetry.proto.common.v1.AnyValue; +import io.opentelemetry.proto.common.v1.KeyValue; +import io.opentelemetry.proto.metrics.v1.Gauge; +import io.opentelemetry.proto.metrics.v1.Metric; +import io.opentelemetry.proto.metrics.v1.NumberDataPoint; +import io.opentelemetry.proto.metrics.v1.ResourceMetrics; +import io.opentelemetry.proto.resource.v1.Resource; +import lombok.extern.slf4j.Slf4j; +import org.apache.skywalking.e2e.E2EConfiguration; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Slf4j +@RestController +@RequestMapping("/aws/otel/eks") +public class AwsEKSOtelMetricsSender { + private static final int MAX_INBOUND_MESSAGE_SIZE = 1024 * 1024 * 50; + private final MetricsServiceGrpc.MetricsServiceStub metricsServiceStub; + private static final String JOB_NAME = "aws-cloud-eks-monitoring"; + + public AwsEKSOtelMetricsSender(final E2EConfiguration configuration) { + final ManagedChannel channel = NettyChannelBuilder.forAddress( + configuration.getOapHost(), Integer.parseInt(configuration.getOapGrpcPort())) + .nameResolverFactory(new DnsNameResolverProvider()) + .maxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE) + .usePlaintext() + .build(); + this.metricsServiceStub = MetricsServiceGrpc.newStub(channel); + } + + @GetMapping("send") + public String sendMetricsByTemplate() { + final ExportMetricsServiceRequest.Builder builder = ExportMetricsServiceRequest.newBuilder(); + addClusterMetrics(builder.addResourceMetricsBuilder()); + addNodeMemoryMetrics(builder.addResourceMetricsBuilder()); + addPodMemoryMetrics(builder.addResourceMetricsBuilder()); + + this.metricsServiceStub.export(builder.build(), new StreamObserver() { + @Override + public void onNext(final ExportMetricsServiceResponse exportMetricsServiceResponse) { + + } + + @Override + public void onError(final Throwable throwable) { + log.error("sendOtelMetrics by template error ", throwable); + } + + @Override + public void onCompleted() { + + } + }); + return "ok"; + } + + private void addPodMemoryMetrics(final ResourceMetrics.Builder resourceMetricsBuilder) { + final Resource.Builder builder = createPodResourceBuilder(System.currentTimeMillis()); + resourceMetricsBuilder.setResource(builder.build()); + final long timeInNano = System.nanoTime(); + resourceMetricsBuilder.addScopeMetricsBuilder().addMetrics( + Metric.newBuilder() + .setName("pod_network_rx_bytes") + .setUnit("Count") + .setGauge(Gauge.newBuilder().addDataPoints(intDataPointBuilder(timeInNano, 8000L)).build()) + .build()); + } + + private void addNodeMemoryMetrics(final ResourceMetrics.Builder resourceMetricsBuilder) { + final Resource.Builder builder = createNodeResourceBuilder(System.currentTimeMillis()); + resourceMetricsBuilder.setResource(builder.build()); + final long timeInNano = System.nanoTime(); + resourceMetricsBuilder.addScopeMetricsBuilder().addMetrics( + Metric.newBuilder() + .setName("node_memory_utilization") + .setUnit("Count") + .setGauge(Gauge.newBuilder().addDataPoints(intDataPointBuilder(timeInNano, 800L)).build()) + .build()); + } + + private void addClusterMetrics(ResourceMetrics.Builder resourceMetricsBuilder) { + final Resource.Builder builder = createClusterResourceBuilder(System.currentTimeMillis()); + resourceMetricsBuilder.setResource(builder.build()); + + final long timeInNano = System.nanoTime(); + + resourceMetricsBuilder.addScopeMetricsBuilder().addMetrics( + Metric.newBuilder() + .setName("cluster_node_count") + .setUnit("Count") + .setGauge(Gauge.newBuilder().addDataPoints(intDataPointBuilder(timeInNano, 8L)).build()) + .build()); + } + + private Resource.Builder createClusterResourceBuilder(Long timestamp) { + final Resource.Builder builder = Resource.newBuilder(); + builder.addAttributes(keyValue("ClusterName", "SkyWalking")); + builder.addAttributes(keyValue("NodeName", "ip-172-31-23-33.ap-northeast-1.compute.internal")); + builder.addAttributes(keyValue("Timestamp", timestamp + "")); + builder.addAttributes(keyValue("Type", "Cluster")); + builder.addAttributes(keyValue("Version", "0")); + builder.addAttributes(keyValue("job_name", JOB_NAME)); + return builder; + } + + private Resource.Builder createNodeResourceBuilder(Long timestamp) { + final Resource.Builder builder = Resource.newBuilder(); + builder.addAttributes(keyValue("AutoScalingGroupName", "eks-node-1-52c27f89-29fe-e08d-a931-8270467a8803")); + builder.addAttributes(keyValue("ClusterName", "SkyWalking")); + builder.addAttributes(keyValue("InstanceId", "i-0afe883d89558b631")); + builder.addAttributes(keyValue("InstanceType", "t3.medium")); + builder.addAttributes(keyValue("NodeName", "ip-172-31-23-33.ap-northeast-1.compute.internal")); + builder.addAttributes(keyValue("Sources", "[\"cadvisor\",\"pod\",\"calculated\"]")); + builder.addAttributes(keyValue("Timestamp", timestamp + "")); + builder.addAttributes(keyValue("Type", "Node")); + builder.addAttributes(keyValue("Version", "0")); + builder.addAttributes(keyValue("job_name", JOB_NAME)); + builder.addAttributes(keyValue( + "kubernetes", + "{\"host\":\"ip-172-31-23-33.ap-northeast-1.compute.internal\"}" + )); + builder.addAttributes(keyValue("pod_status", "Running")); + return builder; + } + + private Resource.Builder createPodResourceBuilder(Long timestamp) { + final Resource.Builder builder = Resource.newBuilder(); + builder.addAttributes(keyValue("AutoScalingGroupName", "eks-node-1-52c27f89-29fe-e08d-a931-8270467a8803")); + builder.addAttributes(keyValue("ClusterName", "SkyWalking")); + builder.addAttributes(keyValue("InstanceId", "i-0afe883d89558b631")); + builder.addAttributes(keyValue("InstanceType", "t3.medium")); + builder.addAttributes(keyValue("Namespace", "aws-otel-eks")); + builder.addAttributes(keyValue("NodeName", "ip-172-31-23-33.ap-northeast-1.compute.internal")); + builder.addAttributes(keyValue("PodName", "aws-otel-eks-ci")); + builder.addAttributes(keyValue("Sources", "[\"cadvisor\",\"pod\",\"calculated\"]")); + builder.addAttributes(keyValue("Timestamp", timestamp + "")); + builder.addAttributes(keyValue("Type", "Pod")); + builder.addAttributes(keyValue("Version", "0")); + builder.addAttributes(keyValue("job_name", JOB_NAME)); + builder.addAttributes(keyValue("Service", "kube-dns")); + builder.addAttributes(keyValue( + "kubernetes", + "{\"host\":\"ip-172-31-23-33.ap-northeast-1.compute.internal\",\"labels\":{\"controller-revision-hash\":\"7b5f4f4fff\",\"name\":\"aws-otel-eks-ci\",\"pod-template-generation\":\"1\"},\"namespace_name\":\"aws-otel-eks\",\"pod_id\":\"3a3e479b-986a-40d5-9023-f4c6a259b6ba\",\"pod_name\":\"aws-otel-eks-ci-lzbr8\",\"pod_owners\":[{\"owner_kind\":\"DaemonSet\",\"owner_name\":\"aws-otel-eks-ci\"}]}" + )); + builder.addAttributes(keyValue("pod_status", "Running")); + return builder; + } + + private NumberDataPoint.Builder intDataPointBuilder(long timeNano, long value) { + final NumberDataPoint.Builder numberDataPointBuilder = NumberDataPoint.newBuilder(); + numberDataPointBuilder.setTimeUnixNano(System.nanoTime()); + numberDataPointBuilder.setAsInt(value); + return numberDataPointBuilder; + } + + private KeyValue keyValue(String k, String v) { + return KeyValue.newBuilder() + .setKey(k) + .setValue(AnyValue.newBuilder().setStringValue(v).build()) + .build(); + } + +} diff --git a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml index 116b35982a10..69fb5a9d5133 100644 --- a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml +++ b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml @@ -26,3 +26,4 @@ e2e: zipkin-kafka-bootstrapServers: ${ZIPKIN_KAFKA_BOOTSTRAP_SERVERS:127.0.0.1:9092} zipkin-kafka-groupId: ${ZIPKIN_KAFKA_GROUPID:zipkin} zipkin-kafka-topic: ${ZIPKIN_KAFKA_TOPIC:zipkin} + otel-metrics-template: ${OTEL_METRICS_TEMPLATE:null} diff --git a/test/e2e-v2/java-test-service/opentelemetry-proto/pom.xml b/test/e2e-v2/java-test-service/opentelemetry-proto/pom.xml new file mode 100644 index 000000000000..12823fffcdc8 --- /dev/null +++ b/test/e2e-v2/java-test-service/opentelemetry-proto/pom.xml @@ -0,0 +1,98 @@ + + + + + + apache-skywalking-e2e + org.apache.skywalking + 2.0.0 + + 4.0.0 + + opentelemetry-proto + + + 1.43.2 + 1.5.0.Final + 0.6.1 + + + + + io.grpc + grpc-protobuf + ${grpc.version} + + + io.grpc + grpc-stub + ${grpc.version} + + + io.grpc + grpc-netty + ${grpc.version} + + + + + + + kr.motd.maven + os-maven-plugin + ${os-maven-plugin.version} + + + initialize + + detect + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + ${protobuf-maven-plugin.version} + + + com.google.protobuf:protoc:3.19.2:exe:${os.detected.classifier} + + grpc-java + io.grpc:protoc-gen-grpc-java:1.42.1:exe:${os.detected.classifier} + + + + + + compile + compile-custom + + + + + + + diff --git a/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/logs/v1/logs_service.proto b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/logs/v1/logs_service.proto new file mode 100644 index 000000000000..8260d8aaeb82 --- /dev/null +++ b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/logs/v1/logs_service.proto @@ -0,0 +1,79 @@ +// Copyright 2020, OpenTelemetry Authors +// +// Licensed 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. + +syntax = "proto3"; + +package opentelemetry.proto.collector.logs.v1; + +import "opentelemetry/proto/logs/v1/logs.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Collector.Logs.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.collector.logs.v1"; +option java_outer_classname = "LogsServiceProto"; +option go_package = "go.opentelemetry.io/proto/otlp/collector/logs/v1"; + +// Service that can be used to push logs between one Application instrumented with +// OpenTelemetry and an collector, or between an collector and a central collector (in this +// case logs are sent/received to/from multiple Applications). +service LogsService { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + rpc Export(ExportLogsServiceRequest) returns (ExportLogsServiceResponse) {} +} + +message ExportLogsServiceRequest { + // An array of ResourceLogs. + // For data coming from a single resource this array will typically contain one + // element. Intermediary nodes (such as OpenTelemetry Collector) that receive + // data from multiple origins typically batch the data before forwarding further and + // in that case this array will contain multiple elements. + repeated opentelemetry.proto.logs.v1.ResourceLogs resource_logs = 1; +} + +message ExportLogsServiceResponse { + // The details of a partially successful export request. + // + // If the request is only partially accepted + // (i.e. when the server accepts only parts of the data and rejects the rest) + // the server MUST initialize the `partial_success` field and MUST + // set the `rejected_` with the number of items it rejected. + // + // Servers MAY also make use of the `partial_success` field to convey + // warnings/suggestions to senders even when the request was fully accepted. + // In such cases, the `rejected_` MUST have a value of `0` and + // the `error_message` MUST be non-empty. + // + // A `partial_success` message with an empty value (rejected_ = 0 and + // `error_message` = "") is equivalent to it not being set/present. Senders + // SHOULD interpret it the same way as in the full success case. + ExportLogsPartialSuccess partial_success = 1; +} + +message ExportLogsPartialSuccess { + // The number of rejected log records. + // + // A `rejected_` field holding a `0` value indicates that the + // request was fully accepted. + int64 rejected_log_records = 1; + + // A developer-facing human-readable message in English. It should be used + // either to explain why the server rejected parts of the data during a partial + // success or to convey warnings/suggestions during a full success. The message + // should offer guidance on how users can address such issues. + // + // error_message is an optional field. An error_message with an empty value + // is equivalent to it not being set. + string error_message = 2; +} diff --git a/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/metrics/v1/metrics_service.proto b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/metrics/v1/metrics_service.proto new file mode 100644 index 000000000000..dd48f1ad3a16 --- /dev/null +++ b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/metrics/v1/metrics_service.proto @@ -0,0 +1,79 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed 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. + +syntax = "proto3"; + +package opentelemetry.proto.collector.metrics.v1; + +import "opentelemetry/proto/metrics/v1/metrics.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Collector.Metrics.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.collector.metrics.v1"; +option java_outer_classname = "MetricsServiceProto"; +option go_package = "go.opentelemetry.io/proto/otlp/collector/metrics/v1"; + +// Service that can be used to push metrics between one Application +// instrumented with OpenTelemetry and a collector, or between a collector and a +// central collector. +service MetricsService { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + rpc Export(ExportMetricsServiceRequest) returns (ExportMetricsServiceResponse) {} +} + +message ExportMetricsServiceRequest { + // An array of ResourceMetrics. + // For data coming from a single resource this array will typically contain one + // element. Intermediary nodes (such as OpenTelemetry Collector) that receive + // data from multiple origins typically batch the data before forwarding further and + // in that case this array will contain multiple elements. + repeated opentelemetry.proto.metrics.v1.ResourceMetrics resource_metrics = 1; +} + +message ExportMetricsServiceResponse { + // The details of a partially successful export request. + // + // If the request is only partially accepted + // (i.e. when the server accepts only parts of the data and rejects the rest) + // the server MUST initialize the `partial_success` field and MUST + // set the `rejected_` with the number of items it rejected. + // + // Servers MAY also make use of the `partial_success` field to convey + // warnings/suggestions to senders even when the request was fully accepted. + // In such cases, the `rejected_` MUST have a value of `0` and + // the `error_message` MUST be non-empty. + // + // A `partial_success` message with an empty value (rejected_ = 0 and + // `error_message` = "") is equivalent to it not being set/present. Senders + // SHOULD interpret it the same way as in the full success case. + ExportMetricsPartialSuccess partial_success = 1; +} + +message ExportMetricsPartialSuccess { + // The number of rejected data points. + // + // A `rejected_` field holding a `0` value indicates that the + // request was fully accepted. + int64 rejected_data_points = 1; + + // A developer-facing human-readable message in English. It should be used + // either to explain why the server rejected parts of the data during a partial + // success or to convey warnings/suggestions during a full success. The message + // should offer guidance on how users can address such issues. + // + // error_message is an optional field. An error_message with an empty value + // is equivalent to it not being set. + string error_message = 2; +} diff --git a/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/trace/v1/trace_service.proto b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/trace/v1/trace_service.proto new file mode 100644 index 000000000000..d6fe67f9e553 --- /dev/null +++ b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/collector/trace/v1/trace_service.proto @@ -0,0 +1,79 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed 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. + +syntax = "proto3"; + +package opentelemetry.proto.collector.trace.v1; + +import "opentelemetry/proto/trace/v1/trace.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Collector.Trace.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.collector.trace.v1"; +option java_outer_classname = "TraceServiceProto"; +option go_package = "go.opentelemetry.io/proto/otlp/collector/trace/v1"; + +// Service that can be used to push spans between one Application instrumented with +// OpenTelemetry and a collector, or between a collector and a central collector (in this +// case spans are sent/received to/from multiple Applications). +service TraceService { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + rpc Export(ExportTraceServiceRequest) returns (ExportTraceServiceResponse) {} +} + +message ExportTraceServiceRequest { + // An array of ResourceSpans. + // For data coming from a single resource this array will typically contain one + // element. Intermediary nodes (such as OpenTelemetry Collector) that receive + // data from multiple origins typically batch the data before forwarding further and + // in that case this array will contain multiple elements. + repeated opentelemetry.proto.trace.v1.ResourceSpans resource_spans = 1; +} + +message ExportTraceServiceResponse { + // The details of a partially successful export request. + // + // If the request is only partially accepted + // (i.e. when the server accepts only parts of the data and rejects the rest) + // the server MUST initialize the `partial_success` field and MUST + // set the `rejected_` with the number of items it rejected. + // + // Servers MAY also make use of the `partial_success` field to convey + // warnings/suggestions to senders even when the request was fully accepted. + // In such cases, the `rejected_` MUST have a value of `0` and + // the `error_message` MUST be non-empty. + // + // A `partial_success` message with an empty value (rejected_ = 0 and + // `error_message` = "") is equivalent to it not being set/present. Senders + // SHOULD interpret it the same way as in the full success case. + ExportTracePartialSuccess partial_success = 1; +} + +message ExportTracePartialSuccess { + // The number of rejected spans. + // + // A `rejected_` field holding a `0` value indicates that the + // request was fully accepted. + int64 rejected_spans = 1; + + // A developer-facing human-readable message in English. It should be used + // either to explain why the server rejected parts of the data during a partial + // success or to convey warnings/suggestions during a full success. The message + // should offer guidance on how users can address such issues. + // + // error_message is an optional field. An error_message with an empty value + // is equivalent to it not being set. + string error_message = 2; +} diff --git a/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/common/v1/common.proto b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/common/v1/common.proto new file mode 100644 index 000000000000..d233677c109a --- /dev/null +++ b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/common/v1/common.proto @@ -0,0 +1,77 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed 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. + +syntax = "proto3"; + +package opentelemetry.proto.common.v1; + +option csharp_namespace = "OpenTelemetry.Proto.Common.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.common.v1"; +option java_outer_classname = "CommonProto"; +option go_package = "go.opentelemetry.io/proto/otlp/common/v1"; + +// AnyValue is used to represent any type of attribute value. AnyValue may contain a +// primitive value such as a string or integer or it may contain an arbitrary nested +// object containing arrays, key-value lists and primitives. +message AnyValue { + // The value is one of the listed fields. It is valid for all values to be unspecified + // in which case this AnyValue is considered to be "empty". + oneof value { + string string_value = 1; + bool bool_value = 2; + int64 int_value = 3; + double double_value = 4; + ArrayValue array_value = 5; + KeyValueList kvlist_value = 6; + bytes bytes_value = 7; + } +} + +// ArrayValue is a list of AnyValue messages. We need ArrayValue as a message +// since oneof in AnyValue does not allow repeated fields. +message ArrayValue { + // Array of values. The array may be empty (contain 0 elements). + repeated AnyValue values = 1; +} + +// KeyValueList is a list of KeyValue messages. We need KeyValueList as a message +// since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need +// a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to +// avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches +// are semantically equivalent. +message KeyValueList { + // A collection of key/value pairs of key-value pairs. The list may be empty (may + // contain 0 elements). + // The keys MUST be unique (it is not allowed to have more than one + // value with the same key). + repeated KeyValue values = 1; +} + +// KeyValue is a key-value pair that is used to store Span attributes, Link +// attributes, etc. +message KeyValue { + string key = 1; + AnyValue value = 2; +} + +// InstrumentationScope is a message representing the instrumentation scope information +// such as the fully qualified name and version. +message InstrumentationScope { + // An empty instrumentation scope name means the name is unknown. + string name = 1; + string version = 2; + repeated KeyValue attributes = 3; + uint32 dropped_attributes_count = 4; +} diff --git a/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/logs/v1/logs.proto b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/logs/v1/logs.proto new file mode 100644 index 000000000000..9d0e376cad93 --- /dev/null +++ b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/logs/v1/logs.proto @@ -0,0 +1,177 @@ +// Copyright 2020, OpenTelemetry Authors +// +// Licensed 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. + +syntax = "proto3"; + +package opentelemetry.proto.logs.v1; + +import "opentelemetry/proto/common/v1/common.proto"; +import "opentelemetry/proto/resource/v1/resource.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Logs.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.logs.v1"; +option java_outer_classname = "LogsProto"; +option go_package = "go.opentelemetry.io/proto/otlp/logs/v1"; + +// LogsData represents the logs data that can be stored in a persistent storage, +// OR can be embedded by other protocols that transfer OTLP logs data but do not +// implement the OTLP protocol. +// +// The main difference between this message and collector protocol is that +// in this message there will not be any "control" or "metadata" specific to +// OTLP protocol. +// +// When new fields are added into this message, the OTLP request MUST be updated +// as well. +message LogsData { + // An array of ResourceLogs. + // For data coming from a single resource this array will typically contain + // one element. Intermediary nodes that receive data from multiple origins + // typically batch the data before forwarding further and in that case this + // array will contain multiple elements. + repeated ResourceLogs resource_logs = 1; +} + +// A collection of ScopeLogs from a Resource. +message ResourceLogs { + reserved 1000; + + // The resource for the logs in this message. + // If this field is not set then resource info is unknown. + opentelemetry.proto.resource.v1.Resource resource = 1; + + // A list of ScopeLogs that originate from a resource. + repeated ScopeLogs scope_logs = 2; + + // This schema_url applies to the data in the "resource" field. It does not apply + // to the data in the "scope_logs" field which have their own schema_url field. + string schema_url = 3; +} + +// A collection of Logs produced by a Scope. +message ScopeLogs { + // The instrumentation scope information for the logs in this message. + // Semantically when InstrumentationScope isn't set, it is equivalent with + // an empty instrumentation scope name (unknown). + opentelemetry.proto.common.v1.InstrumentationScope scope = 1; + + // A list of log records. + repeated LogRecord log_records = 2; + + // This schema_url applies to all logs in the "logs" field. + string schema_url = 3; +} + +// Possible values for LogRecord.SeverityNumber. +enum SeverityNumber { + // UNSPECIFIED is the default SeverityNumber, it MUST NOT be used. + SEVERITY_NUMBER_UNSPECIFIED = 0; + SEVERITY_NUMBER_TRACE = 1; + SEVERITY_NUMBER_TRACE2 = 2; + SEVERITY_NUMBER_TRACE3 = 3; + SEVERITY_NUMBER_TRACE4 = 4; + SEVERITY_NUMBER_DEBUG = 5; + SEVERITY_NUMBER_DEBUG2 = 6; + SEVERITY_NUMBER_DEBUG3 = 7; + SEVERITY_NUMBER_DEBUG4 = 8; + SEVERITY_NUMBER_INFO = 9; + SEVERITY_NUMBER_INFO2 = 10; + SEVERITY_NUMBER_INFO3 = 11; + SEVERITY_NUMBER_INFO4 = 12; + SEVERITY_NUMBER_WARN = 13; + SEVERITY_NUMBER_WARN2 = 14; + SEVERITY_NUMBER_WARN3 = 15; + SEVERITY_NUMBER_WARN4 = 16; + SEVERITY_NUMBER_ERROR = 17; + SEVERITY_NUMBER_ERROR2 = 18; + SEVERITY_NUMBER_ERROR3 = 19; + SEVERITY_NUMBER_ERROR4 = 20; + SEVERITY_NUMBER_FATAL = 21; + SEVERITY_NUMBER_FATAL2 = 22; + SEVERITY_NUMBER_FATAL3 = 23; + SEVERITY_NUMBER_FATAL4 = 24; +} + +// Masks for LogRecord.flags field. +enum LogRecordFlags { + LOG_RECORD_FLAG_UNSPECIFIED = 0; + LOG_RECORD_FLAG_TRACE_FLAGS_MASK = 0x000000FF; +} + +// A log record according to OpenTelemetry Log Data Model: +// https://github.com/open-telemetry/oteps/blob/main/text/logs/0097-log-data-model.md +message LogRecord { + reserved 4; + + // time_unix_nano is the time when the event occurred. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // Value of 0 indicates unknown or missing timestamp. + fixed64 time_unix_nano = 1; + + // Time when the event was observed by the collection system. + // For events that originate in OpenTelemetry (e.g. using OpenTelemetry Logging SDK) + // this timestamp is typically set at the generation time and is equal to Timestamp. + // For events originating externally and collected by OpenTelemetry (e.g. using + // Collector) this is the time when OpenTelemetry's code observed the event measured + // by the clock of the OpenTelemetry code. This field MUST be set once the event is + // observed by OpenTelemetry. + // + // For converting OpenTelemetry log data to formats that support only one timestamp or + // when receiving OpenTelemetry log data by recipients that support only one timestamp + // internally the following logic is recommended: + // - Use time_unix_nano if it is present, otherwise use observed_time_unix_nano. + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // Value of 0 indicates unknown or missing timestamp. + fixed64 observed_time_unix_nano = 11; + + // Numerical value of the severity, normalized to values described in Log Data Model. + // [Optional]. + SeverityNumber severity_number = 2; + + // The severity text (also known as log level). The original string representation as + // it is known at the source. [Optional]. + string severity_text = 3; + + // A value containing the body of the log record. Can be for example a human-readable + // string message (including multi-line) describing the event in a free form or it can + // be a structured data composed of arrays and maps of other values. [Optional]. + opentelemetry.proto.common.v1.AnyValue body = 5; + + // Additional attributes that describe the specific event occurrence. [Optional]. + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 6; + uint32 dropped_attributes_count = 7; + + // Flags, a bit field. 8 least significant bits are the trace flags as + // defined in W3C Trace Context specification. 24 most significant bits are reserved + // and must be set to 0. Readers must not assume that 24 most significant bits + // will be zero and must correctly mask the bits when reading 8-bit trace flag (use + // flags & TRACE_FLAGS_MASK). [Optional]. + fixed32 flags = 8; + + // A unique identifier for a trace. All logs from the same trace share + // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes + // is considered invalid. Can be set for logs that are part of request processing + // and have an assigned trace id. [Optional]. + bytes trace_id = 9; + + // A unique identifier for a span within a trace, assigned when the span + // is created. The ID is an 8-byte array. An ID with all zeroes is considered + // invalid. Can be set for logs that are part of a particular processing span. + // If span_id is present trace_id SHOULD be also present. [Optional]. + bytes span_id = 10; +} diff --git a/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto new file mode 100644 index 000000000000..101c8ccbbf56 --- /dev/null +++ b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/metrics/v1/metrics.proto @@ -0,0 +1,666 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed 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. + +syntax = "proto3"; + +package opentelemetry.proto.metrics.v1; + +import "opentelemetry/proto/common/v1/common.proto"; +import "opentelemetry/proto/resource/v1/resource.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Metrics.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.metrics.v1"; +option java_outer_classname = "MetricsProto"; +option go_package = "go.opentelemetry.io/proto/otlp/metrics/v1"; + +// MetricsData represents the metrics data that can be stored in a persistent +// storage, OR can be embedded by other protocols that transfer OTLP metrics +// data but do not implement the OTLP protocol. +// +// The main difference between this message and collector protocol is that +// in this message there will not be any "control" or "metadata" specific to +// OTLP protocol. +// +// When new fields are added into this message, the OTLP request MUST be updated +// as well. +message MetricsData { + // An array of ResourceMetrics. + // For data coming from a single resource this array will typically contain + // one element. Intermediary nodes that receive data from multiple origins + // typically batch the data before forwarding further and in that case this + // array will contain multiple elements. + repeated ResourceMetrics resource_metrics = 1; +} + +// A collection of ScopeMetrics from a Resource. +message ResourceMetrics { + reserved 1000; + + // The resource for the metrics in this message. + // If this field is not set then no resource info is known. + opentelemetry.proto.resource.v1.Resource resource = 1; + + // A list of metrics that originate from a resource. + repeated ScopeMetrics scope_metrics = 2; + + // This schema_url applies to the data in the "resource" field. It does not apply + // to the data in the "scope_metrics" field which have their own schema_url field. + string schema_url = 3; +} + +// A collection of Metrics produced by an Scope. +message ScopeMetrics { + // The instrumentation scope information for the metrics in this message. + // Semantically when InstrumentationScope isn't set, it is equivalent with + // an empty instrumentation scope name (unknown). + opentelemetry.proto.common.v1.InstrumentationScope scope = 1; + + // A list of metrics that originate from an instrumentation library. + repeated Metric metrics = 2; + + // This schema_url applies to all metrics in the "metrics" field. + string schema_url = 3; +} + +// Defines a Metric which has one or more timeseries. The following is a +// brief summary of the Metric data model. For more details, see: +// +// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md +// +// +// The data model and relation between entities is shown in the +// diagram below. Here, "DataPoint" is the term used to refer to any +// one of the specific data point value types, and "points" is the term used +// to refer to any one of the lists of points contained in the Metric. +// +// - Metric is composed of a metadata and data. +// - Metadata part contains a name, description, unit. +// - Data is one of the possible types (Sum, Gauge, Histogram, Summary). +// - DataPoint contains timestamps, attributes, and one of the possible value type +// fields. +// +// Metric +// +------------+ +// |name | +// |description | +// |unit | +------------------------------------+ +// |data |---> |Gauge, Sum, Histogram, Summary, ... | +// +------------+ +------------------------------------+ +// +// Data [One of Gauge, Sum, Histogram, Summary, ...] +// +-----------+ +// |... | // Metadata about the Data. +// |points |--+ +// +-----------+ | +// | +---------------------------+ +// | |DataPoint 1 | +// v |+------+------+ +------+ | +// +-----+ ||label |label |...|label | | +// | 1 |-->||value1|value2|...|valueN| | +// +-----+ |+------+------+ +------+ | +// | . | |+-----+ | +// | . | ||value| | +// | . | |+-----+ | +// | . | +---------------------------+ +// | . | . +// | . | . +// | . | . +// | . | +---------------------------+ +// | . | |DataPoint M | +// +-----+ |+------+------+ +------+ | +// | M |-->||label |label |...|label | | +// +-----+ ||value1|value2|...|valueN| | +// |+------+------+ +------+ | +// |+-----+ | +// ||value| | +// |+-----+ | +// +---------------------------+ +// +// Each distinct type of DataPoint represents the output of a specific +// aggregation function, the result of applying the DataPoint's +// associated function of to one or more measurements. +// +// All DataPoint types have three common fields: +// - Attributes includes key-value pairs associated with the data point +// - TimeUnixNano is required, set to the end time of the aggregation +// - StartTimeUnixNano is optional, but strongly encouraged for DataPoints +// having an AggregationTemporality field, as discussed below. +// +// Both TimeUnixNano and StartTimeUnixNano values are expressed as +// UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. +// +// # TimeUnixNano +// +// This field is required, having consistent interpretation across +// DataPoint types. TimeUnixNano is the moment corresponding to when +// the data point's aggregate value was captured. +// +// Data points with the 0 value for TimeUnixNano SHOULD be rejected +// by consumers. +// +// # StartTimeUnixNano +// +// StartTimeUnixNano in general allows detecting when a sequence of +// observations is unbroken. This field indicates to consumers the +// start time for points with cumulative and delta +// AggregationTemporality, and it should be included whenever possible +// to support correct rate calculation. Although it may be omitted +// when the start time is truly unknown, setting StartTimeUnixNano is +// strongly encouraged. +message Metric { + reserved 4, 6, 8; + + // name of the metric, including its DNS name prefix. It must be unique. + string name = 1; + + // description of the metric, which can be used in documentation. + string description = 2; + + // unit in which the metric value is reported. Follows the format + // described by http://unitsofmeasure.org/ucum.html. + string unit = 3; + + // Data determines the aggregation type (if any) of the metric, what is the + // reported value type for the data points, as well as the relatationship to + // the time interval over which they are reported. + oneof data { + Gauge gauge = 5; + Sum sum = 7; + Histogram histogram = 9; + ExponentialHistogram exponential_histogram = 10; + Summary summary = 11; + } +} + +// Gauge represents the type of a scalar metric that always exports the +// "current value" for every data point. It should be used for an "unknown" +// aggregation. +// +// A Gauge does not support different aggregation temporalities. Given the +// aggregation is unknown, points cannot be combined using the same +// aggregation, regardless of aggregation temporalities. Therefore, +// AggregationTemporality is not included. Consequently, this also means +// "StartTimeUnixNano" is ignored for all data points. +message Gauge { + repeated NumberDataPoint data_points = 1; +} + +// Sum represents the type of a scalar metric that is calculated as a sum of all +// reported measurements over a time interval. +message Sum { + repeated NumberDataPoint data_points = 1; + + // aggregation_temporality describes if the aggregator reports delta changes + // since last report time, or cumulative changes since a fixed start time. + AggregationTemporality aggregation_temporality = 2; + + // If "true" means that the sum is monotonic. + bool is_monotonic = 3; +} + +// Histogram represents the type of a metric that is calculated by aggregating +// as a Histogram of all reported measurements over a time interval. +message Histogram { + repeated HistogramDataPoint data_points = 1; + + // aggregation_temporality describes if the aggregator reports delta changes + // since last report time, or cumulative changes since a fixed start time. + AggregationTemporality aggregation_temporality = 2; +} + +// ExponentialHistogram represents the type of a metric that is calculated by aggregating +// as a ExponentialHistogram of all reported double measurements over a time interval. +message ExponentialHistogram { + repeated ExponentialHistogramDataPoint data_points = 1; + + // aggregation_temporality describes if the aggregator reports delta changes + // since last report time, or cumulative changes since a fixed start time. + AggregationTemporality aggregation_temporality = 2; +} + +// Summary metric data are used to convey quantile summaries, +// a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary) +// and OpenMetrics (see: https://github.com/OpenObservability/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45) +// data type. These data points cannot always be merged in a meaningful way. +// While they can be useful in some applications, histogram data points are +// recommended for new applications. +message Summary { + repeated SummaryDataPoint data_points = 1; +} + +// AggregationTemporality defines how a metric aggregator reports aggregated +// values. It describes how those values relate to the time interval over +// which they are aggregated. +enum AggregationTemporality { + // UNSPECIFIED is the default AggregationTemporality, it MUST not be used. + AGGREGATION_TEMPORALITY_UNSPECIFIED = 0; + + // DELTA is an AggregationTemporality for a metric aggregator which reports + // changes since last report time. Successive metrics contain aggregation of + // values from continuous and non-overlapping intervals. + // + // The values for a DELTA metric are based only on the time interval + // associated with one measurement cycle. There is no dependency on + // previous measurements like is the case for CUMULATIVE metrics. + // + // For example, consider a system measuring the number of requests that + // it receives and reports the sum of these requests every second as a + // DELTA metric: + // + // 1. The system starts receiving at time=t_0. + // 2. A request is received, the system measures 1 request. + // 3. A request is received, the system measures 1 request. + // 4. A request is received, the system measures 1 request. + // 5. The 1 second collection cycle ends. A metric is exported for the + // number of requests received over the interval of time t_0 to + // t_0+1 with a value of 3. + // 6. A request is received, the system measures 1 request. + // 7. A request is received, the system measures 1 request. + // 8. The 1 second collection cycle ends. A metric is exported for the + // number of requests received over the interval of time t_0+1 to + // t_0+2 with a value of 2. + AGGREGATION_TEMPORALITY_DELTA = 1; + + // CUMULATIVE is an AggregationTemporality for a metric aggregator which + // reports changes since a fixed start time. This means that current values + // of a CUMULATIVE metric depend on all previous measurements since the + // start time. Because of this, the sender is required to retain this state + // in some form. If this state is lost or invalidated, the CUMULATIVE metric + // values MUST be reset and a new fixed start time following the last + // reported measurement time sent MUST be used. + // + // For example, consider a system measuring the number of requests that + // it receives and reports the sum of these requests every second as a + // CUMULATIVE metric: + // + // 1. The system starts receiving at time=t_0. + // 2. A request is received, the system measures 1 request. + // 3. A request is received, the system measures 1 request. + // 4. A request is received, the system measures 1 request. + // 5. The 1 second collection cycle ends. A metric is exported for the + // number of requests received over the interval of time t_0 to + // t_0+1 with a value of 3. + // 6. A request is received, the system measures 1 request. + // 7. A request is received, the system measures 1 request. + // 8. The 1 second collection cycle ends. A metric is exported for the + // number of requests received over the interval of time t_0 to + // t_0+2 with a value of 5. + // 9. The system experiences a fault and loses state. + // 10. The system recovers and resumes receiving at time=t_1. + // 11. A request is received, the system measures 1 request. + // 12. The 1 second collection cycle ends. A metric is exported for the + // number of requests received over the interval of time t_1 to + // t_0+1 with a value of 1. + // + // Note: Even though, when reporting changes since last report time, using + // CUMULATIVE is valid, it is not recommended. This may cause problems for + // systems that do not use start_time to determine when the aggregation + // value was reset (e.g. Prometheus). + AGGREGATION_TEMPORALITY_CUMULATIVE = 2; +} + +// DataPointFlags is defined as a protobuf 'uint32' type and is to be used as a +// bit-field representing 32 distinct boolean flags. Each flag defined in this +// enum is a bit-mask. To test the presence of a single flag in the flags of +// a data point, for example, use an expression like: +// +// (point.flags & FLAG_NO_RECORDED_VALUE) == FLAG_NO_RECORDED_VALUE +// +enum DataPointFlags { + FLAG_NONE = 0; + + // This DataPoint is valid but has no recorded value. This value + // SHOULD be used to reflect explicitly missing data in a series, as + // for an equivalent to the Prometheus "staleness marker". + FLAG_NO_RECORDED_VALUE = 1; + + // Bits 2-31 are reserved for future use. +} + +// NumberDataPoint is a single data point in a timeseries that describes the +// time-varying scalar value of a metric. +message NumberDataPoint { + reserved 1; + + // The set of key/value pairs that uniquely identify the timeseries from + // where this point belongs. The list may be empty (may contain 0 elements). + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 7; + + // StartTimeUnixNano is optional but strongly encouraged, see the + // the detailed comments above Metric. + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + // 1970. + fixed64 start_time_unix_nano = 2; + + // TimeUnixNano is required, see the detailed comments above Metric. + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + // 1970. + fixed64 time_unix_nano = 3; + + // The value itself. A point is considered invalid when one of the recognized + // value fields is not present inside this oneof. + oneof value { + double as_double = 4; + sfixed64 as_int = 6; + } + + // (Optional) List of exemplars collected from + // measurements that were used to form the data point + repeated Exemplar exemplars = 5; + + // Flags that apply to this specific data point. See DataPointFlags + // for the available flags and their meaning. + uint32 flags = 8; +} + +// HistogramDataPoint is a single data point in a timeseries that describes the +// time-varying values of a Histogram. A Histogram contains summary statistics +// for a population of values, it may optionally contain the distribution of +// those values across a set of buckets. +// +// If the histogram contains the distribution of values, then both +// "explicit_bounds" and "bucket counts" fields must be defined. +// If the histogram does not contain the distribution of values, then both +// "explicit_bounds" and "bucket_counts" must be omitted and only "count" and +// "sum" are known. +message HistogramDataPoint { + reserved 1; + + // The set of key/value pairs that uniquely identify the timeseries from + // where this point belongs. The list may be empty (may contain 0 elements). + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 9; + + // StartTimeUnixNano is optional but strongly encouraged, see the + // the detailed comments above Metric. + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + // 1970. + fixed64 start_time_unix_nano = 2; + + // TimeUnixNano is required, see the detailed comments above Metric. + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + // 1970. + fixed64 time_unix_nano = 3; + + // count is the number of values in the population. Must be non-negative. This + // value must be equal to the sum of the "count" fields in buckets if a + // histogram is provided. + fixed64 count = 4; + + // sum of the values in the population. If count is zero then this field + // must be zero. + // + // Note: Sum should only be filled out when measuring non-negative discrete + // events, and is assumed to be monotonic over the values of these events. + // Negative events *can* be recorded, but sum should not be filled out when + // doing so. This is specifically to enforce compatibility w/ OpenMetrics, + // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram + optional double sum = 5; + + // bucket_counts is an optional field contains the count values of histogram + // for each bucket. + // + // The sum of the bucket_counts must equal the value in the count field. + // + // The number of elements in bucket_counts array must be by one greater than + // the number of elements in explicit_bounds array. + repeated fixed64 bucket_counts = 6; + + // explicit_bounds specifies buckets with explicitly defined bounds for values. + // + // The boundaries for bucket at index i are: + // + // (-infinity, explicit_bounds[i]] for i == 0 + // (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds) + // (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds) + // + // The values in the explicit_bounds array must be strictly increasing. + // + // Histogram buckets are inclusive of their upper boundary, except the last + // bucket where the boundary is at infinity. This format is intentionally + // compatible with the OpenMetrics histogram definition. + repeated double explicit_bounds = 7; + + // (Optional) List of exemplars collected from + // measurements that were used to form the data point + repeated Exemplar exemplars = 8; + + // Flags that apply to this specific data point. See DataPointFlags + // for the available flags and their meaning. + uint32 flags = 10; + + // min is the minimum value over (start_time, end_time]. + optional double min = 11; + + // max is the maximum value over (start_time, end_time]. + optional double max = 12; +} + +// ExponentialHistogramDataPoint is a single data point in a timeseries that describes the +// time-varying values of a ExponentialHistogram of double values. A ExponentialHistogram contains +// summary statistics for a population of values, it may optionally contain the +// distribution of those values across a set of buckets. +// +message ExponentialHistogramDataPoint { + // The set of key/value pairs that uniquely identify the timeseries from + // where this point belongs. The list may be empty (may contain 0 elements). + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 1; + + // StartTimeUnixNano is optional but strongly encouraged, see the + // the detailed comments above Metric. + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + // 1970. + fixed64 start_time_unix_nano = 2; + + // TimeUnixNano is required, see the detailed comments above Metric. + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + // 1970. + fixed64 time_unix_nano = 3; + + // count is the number of values in the population. Must be + // non-negative. This value must be equal to the sum of the "bucket_counts" + // values in the positive and negative Buckets plus the "zero_count" field. + fixed64 count = 4; + + // sum of the values in the population. If count is zero then this field + // must be zero. + // + // Note: Sum should only be filled out when measuring non-negative discrete + // events, and is assumed to be monotonic over the values of these events. + // Negative events *can* be recorded, but sum should not be filled out when + // doing so. This is specifically to enforce compatibility w/ OpenMetrics, + // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram + optional double sum = 5; + + // scale describes the resolution of the histogram. Boundaries are + // located at powers of the base, where: + // + // base = (2^(2^-scale)) + // + // The histogram bucket identified by `index`, a signed integer, + // contains values that are greater than (base^index) and + // less than or equal to (base^(index+1)). + // + // The positive and negative ranges of the histogram are expressed + // separately. Negative values are mapped by their absolute value + // into the negative range using the same scale as the positive range. + // + // scale is not restricted by the protocol, as the permissible + // values depend on the range of the data. + sint32 scale = 6; + + // zero_count is the count of values that are either exactly zero or + // within the region considered zero by the instrumentation at the + // tolerated degree of precision. This bucket stores values that + // cannot be expressed using the standard exponential formula as + // well as values that have been rounded to zero. + // + // Implementations MAY consider the zero bucket to have probability + // mass equal to (zero_count / count). + fixed64 zero_count = 7; + + // positive carries the positive range of exponential bucket counts. + Buckets positive = 8; + + // negative carries the negative range of exponential bucket counts. + Buckets negative = 9; + + // Buckets are a set of bucket counts, encoded in a contiguous array + // of counts. + message Buckets { + // Offset is the bucket index of the first entry in the bucket_counts array. + // + // Note: This uses a varint encoding as a simple form of compression. + sint32 offset = 1; + + // Count is an array of counts, where count[i] carries the count + // of the bucket at index (offset+i). count[i] is the count of + // values greater than base^(offset+i) and less or equal to than + // base^(offset+i+1). + // + // Note: By contrast, the explicit HistogramDataPoint uses + // fixed64. This field is expected to have many buckets, + // especially zeros, so uint64 has been selected to ensure + // varint encoding. + repeated uint64 bucket_counts = 2; + } + + // Flags that apply to this specific data point. See DataPointFlags + // for the available flags and their meaning. + uint32 flags = 10; + + // (Optional) List of exemplars collected from + // measurements that were used to form the data point + repeated Exemplar exemplars = 11; + + // min is the minimum value over (start_time, end_time]. + optional double min = 12; + + // max is the maximum value over (start_time, end_time]. + optional double max = 13; +} + +// SummaryDataPoint is a single data point in a timeseries that describes the +// time-varying values of a Summary metric. +message SummaryDataPoint { + reserved 1; + + // The set of key/value pairs that uniquely identify the timeseries from + // where this point belongs. The list may be empty (may contain 0 elements). + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 7; + + // StartTimeUnixNano is optional but strongly encouraged, see the + // the detailed comments above Metric. + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + // 1970. + fixed64 start_time_unix_nano = 2; + + // TimeUnixNano is required, see the detailed comments above Metric. + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + // 1970. + fixed64 time_unix_nano = 3; + + // count is the number of values in the population. Must be non-negative. + fixed64 count = 4; + + // sum of the values in the population. If count is zero then this field + // must be zero. + // + // Note: Sum should only be filled out when measuring non-negative discrete + // events, and is assumed to be monotonic over the values of these events. + // Negative events *can* be recorded, but sum should not be filled out when + // doing so. This is specifically to enforce compatibility w/ OpenMetrics, + // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#summary + double sum = 5; + + // Represents the value at a given quantile of a distribution. + // + // To record Min and Max values following conventions are used: + // - The 1.0 quantile is equivalent to the maximum value observed. + // - The 0.0 quantile is equivalent to the minimum value observed. + // + // See the following issue for more context: + // https://github.com/open-telemetry/opentelemetry-proto/issues/125 + message ValueAtQuantile { + // The quantile of a distribution. Must be in the interval + // [0.0, 1.0]. + double quantile = 1; + + // The value at the given quantile of a distribution. + // + // Quantile values must NOT be negative. + double value = 2; + } + + // (Optional) list of values at different quantiles of the distribution calculated + // from the current snapshot. The quantiles must be strictly increasing. + repeated ValueAtQuantile quantile_values = 6; + + // Flags that apply to this specific data point. See DataPointFlags + // for the available flags and their meaning. + uint32 flags = 8; +} + +// A representation of an exemplar, which is a sample input measurement. +// Exemplars also hold information about the environment when the measurement +// was recorded, for example the span and trace ID of the active span when the +// exemplar was recorded. +message Exemplar { + reserved 1; + + // The set of key/value pairs that were filtered out by the aggregator, but + // recorded alongside the original measurement. Only key/value pairs that were + // filtered out by the aggregator should be included + repeated opentelemetry.proto.common.v1.KeyValue filtered_attributes = 7; + + // time_unix_nano is the exact time when this exemplar was recorded + // + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + // 1970. + fixed64 time_unix_nano = 2; + + // The value of the measurement that was recorded. An exemplar is + // considered invalid when one of the recognized value fields is not present + // inside this oneof. + oneof value { + double as_double = 3; + sfixed64 as_int = 6; + } + + // (Optional) Span ID of the exemplar trace. + // span_id may be missing if the measurement is not recorded inside a trace + // or if the trace is not sampled. + bytes span_id = 4; + + // (Optional) Trace ID of the exemplar trace. + // trace_id may be missing if the measurement is not recorded inside a trace + // or if the trace is not sampled. + bytes trace_id = 5; +} diff --git a/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/resource/v1/resource.proto b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/resource/v1/resource.proto new file mode 100644 index 000000000000..6637560bc354 --- /dev/null +++ b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/resource/v1/resource.proto @@ -0,0 +1,37 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed 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. + +syntax = "proto3"; + +package opentelemetry.proto.resource.v1; + +import "opentelemetry/proto/common/v1/common.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Resource.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.resource.v1"; +option java_outer_classname = "ResourceProto"; +option go_package = "go.opentelemetry.io/proto/otlp/resource/v1"; + +// Resource information. +message Resource { + // Set of attributes that describe the resource. + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 1; + + // dropped_attributes_count is the number of dropped attributes. If the value is 0, then + // no attributes were dropped. + uint32 dropped_attributes_count = 2; +} diff --git a/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/trace/v1/trace.proto b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/trace/v1/trace.proto new file mode 100644 index 000000000000..5903550742dc --- /dev/null +++ b/test/e2e-v2/java-test-service/opentelemetry-proto/src/main/proto/opentelemetry/proto/trace/v1/trace.proto @@ -0,0 +1,280 @@ +// Copyright 2019, OpenTelemetry Authors +// +// Licensed 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. + +syntax = "proto3"; + +package opentelemetry.proto.trace.v1; + +import "opentelemetry/proto/common/v1/common.proto"; +import "opentelemetry/proto/resource/v1/resource.proto"; + +option csharp_namespace = "OpenTelemetry.Proto.Trace.V1"; +option java_multiple_files = true; +option java_package = "io.opentelemetry.proto.trace.v1"; +option java_outer_classname = "TraceProto"; +option go_package = "go.opentelemetry.io/proto/otlp/trace/v1"; + +// TracesData represents the traces data that can be stored in a persistent storage, +// OR can be embedded by other protocols that transfer OTLP traces data but do +// not implement the OTLP protocol. +// +// The main difference between this message and collector protocol is that +// in this message there will not be any "control" or "metadata" specific to +// OTLP protocol. +// +// When new fields are added into this message, the OTLP request MUST be updated +// as well. +message TracesData { + // An array of ResourceSpans. + // For data coming from a single resource this array will typically contain + // one element. Intermediary nodes that receive data from multiple origins + // typically batch the data before forwarding further and in that case this + // array will contain multiple elements. + repeated ResourceSpans resource_spans = 1; +} + +// A collection of ScopeSpans from a Resource. +message ResourceSpans { + reserved 1000; + + // The resource for the spans in this message. + // If this field is not set then no resource info is known. + opentelemetry.proto.resource.v1.Resource resource = 1; + + // A list of ScopeSpans that originate from a resource. + repeated ScopeSpans scope_spans = 2; + + // This schema_url applies to the data in the "resource" field. It does not apply + // to the data in the "scope_spans" field which have their own schema_url field. + string schema_url = 3; +} + +// A collection of Spans produced by an InstrumentationScope. +message ScopeSpans { + // The instrumentation scope information for the spans in this message. + // Semantically when InstrumentationScope isn't set, it is equivalent with + // an empty instrumentation scope name (unknown). + opentelemetry.proto.common.v1.InstrumentationScope scope = 1; + + // A list of Spans that originate from an instrumentation scope. + repeated Span spans = 2; + + // This schema_url applies to all spans and span events in the "spans" field. + string schema_url = 3; +} + +// A Span represents a single operation performed by a single component of the system. +// +// The next available field id is 17. +message Span { + // A unique identifier for a trace. All spans from the same trace share + // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes + // is considered invalid. + // + // This field is semantically required. Receiver should generate new + // random trace_id if empty or invalid trace_id was received. + // + // This field is required. + bytes trace_id = 1; + + // A unique identifier for a span within a trace, assigned when the span + // is created. The ID is an 8-byte array. An ID with all zeroes is considered + // invalid. + // + // This field is semantically required. Receiver should generate new + // random span_id if empty or invalid span_id was received. + // + // This field is required. + bytes span_id = 2; + + // trace_state conveys information about request position in multiple distributed tracing graphs. + // It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header + // See also https://github.com/w3c/distributed-tracing for more details about this field. + string trace_state = 3; + + // The `span_id` of this span's parent span. If this is a root span, then this + // field must be empty. The ID is an 8-byte array. + bytes parent_span_id = 4; + + // A description of the span's operation. + // + // For example, the name can be a qualified method name or a file name + // and a line number where the operation is called. A best practice is to use + // the same display name at the same call point in an application. + // This makes it easier to correlate spans in different traces. + // + // This field is semantically required to be set to non-empty string. + // Empty value is equivalent to an unknown span name. + // + // This field is required. + string name = 5; + + // SpanKind is the type of span. Can be used to specify additional relationships between spans + // in addition to a parent/child relationship. + enum SpanKind { + // Unspecified. Do NOT use as default. + // Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED. + SPAN_KIND_UNSPECIFIED = 0; + + // Indicates that the span represents an internal operation within an application, + // as opposed to an operation happening at the boundaries. Default value. + SPAN_KIND_INTERNAL = 1; + + // Indicates that the span covers server-side handling of an RPC or other + // remote network request. + SPAN_KIND_SERVER = 2; + + // Indicates that the span describes a request to some remote service. + SPAN_KIND_CLIENT = 3; + + // Indicates that the span describes a producer sending a message to a broker. + // Unlike CLIENT and SERVER, there is often no direct critical path latency relationship + // between producer and consumer spans. A PRODUCER span ends when the message was accepted + // by the broker while the logical processing of the message might span a much longer time. + SPAN_KIND_PRODUCER = 4; + + // Indicates that the span describes consumer receiving a message from a broker. + // Like the PRODUCER kind, there is often no direct critical path latency relationship + // between producer and consumer spans. + SPAN_KIND_CONSUMER = 5; + } + + // Distinguishes between spans generated in a particular context. For example, + // two spans with the same name may be distinguished using `CLIENT` (caller) + // and `SERVER` (callee) to identify queueing latency associated with the span. + SpanKind kind = 6; + + // start_time_unix_nano is the start time of the span. On the client side, this is the time + // kept by the local machine where the span execution starts. On the server side, this + // is the time when the server's application handler starts running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + fixed64 start_time_unix_nano = 7; + + // end_time_unix_nano is the end time of the span. On the client side, this is the time + // kept by the local machine where the span execution ends. On the server side, this + // is the time when the server application handler stops running. + // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + // + // This field is semantically required and it is expected that end_time >= start_time. + fixed64 end_time_unix_nano = 8; + + // attributes is a collection of key/value pairs. Note, global attributes + // like server name can be set using the resource API. Examples of attributes: + // + // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + // "/http/server_latency": 300 + // "abc.com/myattribute": true + // "abc.com/score": 10.239 + // + // The OpenTelemetry API specification further restricts the allowed value types: + // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 9; + + // dropped_attributes_count is the number of attributes that were discarded. Attributes + // can be discarded because their keys are too long or because there are too many + // attributes. If this value is 0, then no attributes were dropped. + uint32 dropped_attributes_count = 10; + + // Event is a time-stamped annotation of the span, consisting of user-supplied + // text description and key-value pairs. + message Event { + // time_unix_nano is the time the event occurred. + fixed64 time_unix_nano = 1; + + // name of the event. + // This field is semantically required to be set to non-empty string. + string name = 2; + + // attributes is a collection of attribute key/value pairs on the event. + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 3; + + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + uint32 dropped_attributes_count = 4; + } + + // events is a collection of Event items. + repeated Event events = 11; + + // dropped_events_count is the number of dropped events. If the value is 0, then no + // events were dropped. + uint32 dropped_events_count = 12; + + // A pointer from the current span to another span in the same trace or in a + // different trace. For example, this can be used in batching operations, + // where a single batch handler processes multiple requests from different + // traces or when the handler receives a request from a different project. + message Link { + // A unique identifier of a trace that this linked span is part of. The ID is a + // 16-byte array. + bytes trace_id = 1; + + // A unique identifier for the linked span. The ID is an 8-byte array. + bytes span_id = 2; + + // The trace_state associated with the link. + string trace_state = 3; + + // attributes is a collection of attribute key/value pairs on the link. + // Attribute keys MUST be unique (it is not allowed to have more than one + // attribute with the same key). + repeated opentelemetry.proto.common.v1.KeyValue attributes = 4; + + // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // then no attributes were dropped. + uint32 dropped_attributes_count = 5; + } + + // links is a collection of Links, which are references from this span to a span + // in the same or different trace. + repeated Link links = 13; + + // dropped_links_count is the number of dropped links after the maximum size was + // enforced. If this value is 0, then no links were dropped. + uint32 dropped_links_count = 14; + + // An optional final status for this span. Semantically when Status isn't set, it means + // span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0). + Status status = 15; +} + +// The Status type defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. +message Status { + reserved 1; + + // A developer-facing human readable error message. + string message = 2; + + // For the semantics of status codes see + // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status + enum StatusCode { + // The default status. + STATUS_CODE_UNSET = 0; + // The Span has been validated by an Application developer or Operator to + // have completed successfully. + STATUS_CODE_OK = 1; + // The Span contains an error. + STATUS_CODE_ERROR = 2; + }; + + // The status code. + StatusCode code = 3; +} diff --git a/test/e2e-v2/java-test-service/pom.xml b/test/e2e-v2/java-test-service/pom.xml index 21f40eee3122..9dd474d28824 100644 --- a/test/e2e-v2/java-test-service/pom.xml +++ b/test/e2e-v2/java-test-service/pom.xml @@ -32,6 +32,7 @@ e2e-service-consumer e2e-mock-sender e2e-protocol + opentelemetry-proto From 802b4690a287e841c9bc795f2c033b8130910585 Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sat, 24 Dec 2022 13:03:38 +0800 Subject: [PATCH 02/13] update ui template --- .../aws_eks/aws_eks-cluster.json | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json index ab5b52b7dd5a..22fc6c274389 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json @@ -238,8 +238,8 @@ "metrics": [ "eks_cluster_node_cpu_utilization", "eks_cluster_node_memory_utilization", - "eks_cluster_node_disk_io_write", - "eks_cluster_node_fs_utilization" + "eks_cluster_node_network_tx_errors", + "eks_cluster_node_network_rx_errors" ], "metricTypes": [ "readMetricsValues", @@ -254,9 +254,19 @@ "calculation": "average" }, { - "label": "memory Usage", + "label": "Memory Usage", "unit": "%", "calculation": "average" + }, + { + "label": "Network TX Errors", + "unit": "count/s", + "calculation": "average" + }, + { + "label": "Network RX Errors", + "unit": "count/s", + "calculation": "average" } ], "moved": false @@ -281,9 +291,13 @@ }, "metrics": [ "eks_cluster_service_pod_cpu_utilization", - "eks_cluster_service_pod_memory_utilization" + "eks_cluster_service_pod_memory_utilization", + "eks_cluster_service_pod_net_tx_error", + "eks_cluster_service_pod_net_rx_error" ], "metricTypes": [ + "readMetricsValues", + "readMetricsValues", "readMetricsValues", "readMetricsValues" ], @@ -294,9 +308,19 @@ "calculation": "average" }, { - "label": "memory Usage", + "label": "Memory Usage", "unit": "%", "calculation": "average" + }, + { + "label": "Network TX Errors", + "unit": "count/s", + "calculation": "average" + }, + { + "label": "Network RX Errors", + "unit": "count/s", + "calculation": "average" } ] } From 3e63170e0d030ce07971408244d293a0ce18d415 Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sat, 24 Dec 2022 21:45:55 +0800 Subject: [PATCH 03/13] update doc --- .../backend/backend-aws-eks-monitoring.md | 270 +++++++++++++++--- .../setup/backend/opentelemetry-receiver.md | 3 + .../otel-rules/aws-eks/eks-node.yaml | 3 - 3 files changed, 238 insertions(+), 38 deletions(-) diff --git a/docs/en/setup/backend/backend-aws-eks-monitoring.md b/docs/en/setup/backend/backend-aws-eks-monitoring.md index a465f9d042d9..1b6046f7b5e5 100644 --- a/docs/en/setup/backend/backend-aws-eks-monitoring.md +++ b/docs/en/setup/backend/backend-aws-eks-monitoring.md @@ -1,24 +1,23 @@ # AWS Cloud EKS monitoring -## APISIX performance from `apisix prometheus plugin` -SkyWalking leverages OpenTelemetry Collector to transfer the metrics to +SkyWalking leverages OpenTelemetry Collector with [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) to transfer the metrics to [OpenTelemetry receiver](opentelemetry-receiver.md) and into the [Meter System](./../../concepts-and-designs/meter.md). ### Data flow -1. OpenTelemetry Collector fetches metrics from EKS via [awscontainerinsightreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) and pushes metrics to SkyWalking OAP Server via the OpenCensus gRPC Exporter or OpenTelemetry gRPC exporter. +1. OpenTelemetry Collector fetches metrics from EKS via [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) and pushes metrics to SkyWalking OAP Server via the OpenCensus gRPC Exporter or OpenTelemetry gRPC exporter. 2. The SkyWalking OAP Server parses the expression with [MAL](../../concepts-and-designs/mal.md) to filter/calculate/aggregate and store the results. ### Set up 1. Deploy [amazon/aws-otel-collector](https://hub.docker.com/r/amazon/aws-otel-collector) as `DaemonSet` to EKS 3. Config SkyWalking [OpenTelemetry receiver](opentelemetry-receiver.md). -### APISIX Monitoring -[APISIX prometheus plugin](https://apisix.apache.org/docs/apisix/plugins/prometheus/) provide multiple dimensions metrics for APISIX server , upstream , route , etc. -Accordingly, SkyWalking observes the status, payload, and latency of the APISIX server, which is cataloged as a `LAYER: APISIX` `Service` in the OAP. Meanwhile, the instances would be recognized as `LAYER: APISIX` `instance`s. The route rules and nodes would be recognized as `endpoint`s with `route/` and `upstream/` prefixes. +### EKS Monitoring +[AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) provide multiple dimensions metrics for EKS cluster, node , service , etc. +Accordingly, SkyWalking observes the status, payload of EKS cluster, which is cataloged as a `LAYER: AWS_EKS` `Service` in the OAP. Meanwhile, the k8s nodes would be recognized as `LAYER: AWS_EKS` `instance`s. The k8s service would be recognized as `endpoint`s. #### Specify Job Name -SkyWalking distinguishes AWS Cloud EKS metrics by attributes `job_name`, which value is `aws-cloud-eks-monitoring` -You could leverage OTEL Collector processor to add `job_name` attribute , as following : +SkyWalking distinguishes AWS Cloud EKS metrics by attributes `job_name`, which value is `aws-cloud-eks-monitoring`. +You could leverage OTEL Collector processor to add the attribute as following : ```yaml processors: @@ -32,33 +31,234 @@ processors: Notice , if you don't specify `job_name` attribute, SkyWalking OAP will ignore the metrics #### Supported Metrics -| Monitoring Panel | Unit | Metric Name | Catalog | Description | Data Source | -|-------------------------------------|------|----------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------------|--------------------------| -| HTTP status | | meter_apisix_sv_http_status | Service | The increment rate of the status of HTTP requests | APISIX Prometheus plugin | -| HTTP latency | | meter_apisix_sv_http_latency | Service | The increment rate of the latency of HTTP requests | APISIX Prometheus plugin | -| HTTP bandwidth | KB | meter_apisix_sv_bandwidth | Service | The increment rate of the bandwidth of HTTP requests | APISIX Prometheus plugin | -| HTTP status of non-matched requests | | meter_apisix_sv_http_status | Service | The increment rate of the status of HTTP requests, which don't match any route | APISIX Prometheus plugin | -| HTTP latency non-matched requests | | meter_apisix_sv_http_latency | Service | The increment rate of the latency of HTTP requests, which don't match any route | APISIX Prometheus plugin | -| HTTP bandwidth non-matched requests | KB | meter_apisix_sv_bandwidth | Service | The increment rate of the bandwidth of HTTP requests ,which don't match any route | APISIX Prometheus plugin | -| HTTP connection | | meter_apisix_sv_http_connections | Service | The avg number of the connections | APISIX Prometheus plugin | -| HTTP Request Trend | | meter_apisix_http_requests | Service | The increment rate of HTTP requests | APISIX Prometheus plugin | -| HTTP status | | meter_apisix_instance_http_status | Instance | The increment rate of the status of HTTP requests | APISIX Prometheus plugin | -| HTTP latency | | meter_apisix_instance_http_latency | Instance | The increment rate of the latency of HTTP requests | APISIX Prometheus plugin | -| HTTP bandwidth | KB | meter_apisix_instance_bandwidth | Instance | The increment rate of the bandwidth of HTTP requests | APISIX Prometheus plugin | -| HTTP status of non-matched requests | | meter_apisix_instance_http_status | Instance | The increment rate of the status of HTTP requests, which don't match any route | APISIX Prometheus plugin | -| HTTP latency non-matched requests | | meter_apisix_instance_http_latency | Instance | The increment rate of the latency of HTTP requests, which don't match any route | APISIX Prometheus plugin | -| HTTP bandwidth non-matched requests | KB | meter_apisix_instance_bandwidth | Instance | The increment rate of the bandwidth of HTTP requests ,which don't match any route | APISIX Prometheus plugin | -| HTTP connection | | meter_apisix_instance_http_connections | Instance | The avg number of the connections | APISIX Prometheus plugin | -| HTTP Request Trend | | meter_apisix_instance_http_requests | Instance | The increment rate of HTTP requests | APISIX Prometheus plugin | -| Shared dict capacity | MB | meter_apisix_instance_shared_dict_capacity_bytes | Instance | The avg capacity of shared dict capacity | APISIX Prometheus plugin | -| Shared free space | MB | meter_apisix_instance_shared_dict_free_space_bytes | Instance | The avg free space of shared dict capacity | APISIX Prometheus plugin | -| etcd index | | meter_apisix_instance_sv_etcd_indexes | Instance | etcd modify index for APISIX keys | APISIX Prometheus plugin | -| etcd latest reachability | | meter_apisix_instance_sv_etcd_reachable | Instance | etcd latest reachable , Refer to [APISIX Prometheus plugin](https://apisix.apache.org/docs/apisix/plugins/prometheus/) | APISIX Prometheus plugin | -| HTTP status | | meter_apisix_endpoint_node_http_status | Endpoint | The increment rate of the status of HTTP requests | APISIX Prometheus plugin | -| HTTP latency | | meter_apisix_endpoint_node_http_latency | Endpoint | The increment rate of the latency of HTTP requests | APISIX Prometheus plugin | -| HTTP bandwidth | KB | meter_apisix_endpoint_node_bandwidth | Endpoint | The increment rate of the bandwidth of HTTP requests | APISIX Prometheus plugin | +| Monitoring Panel | Unit | Metric Name | Catalog | Description | Data Source | +|---------------------------------------|---------|--------------------------------------------|------------|---------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Node Count | | eks_cluster_node_count | Service | The node count of the EKS cluster | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Failed Node Count | | eks_cluster_failed_node_count | Service | The failed node count of the EKS cluster | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Pod Count (namespace dimension) | | eks_cluster_namespace_count | Service | The count of pod in this EKS cluster(namespace dimension) | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Pod Count (service dimension) | | eks_cluster_service_count | Service | The count of pod in this EKS cluster(service dimension) | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Dropped Count (per second) | count/s | eks_cluster_net_rx_dropped | Service | The count of Network RX Dropped per second | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Error Count (per second) | count/s | eks_cluster_net_rx_error | Service | The count of Network RX Error per second | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Dropped Count (per second) | count/s | eks_cluster_net_rx_dropped | Service | The count of Network TX Dropped per second | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Error Count (per second) | count/s | eks_cluster_net_rx_error | Service | The count of Network TX Error per second | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Pod Count | | eks_cluster_node_pod_number | Instance | The count of Pods running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| CPU Utilization | percent | eks_cluster_node_cpu_utilization | Instance | The CPU Utilization of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Memory Utilization | percent | eks_cluster_node_memory_utilization | Instance | The Memory Utilization of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX | bytes/s | eks_cluster_node_net_rx_bytes | Instance | Network RX bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Error Count | count/s | eks_cluster_node_net_rx_bytes | Instance | Network RX error count of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX | bytes/s | eks_cluster_node_net_rx_bytes | Instance | Network TX bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Error Count | count/s | eks_cluster_node_net_rx_bytes | Instance | Network TX error count of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Disk IO Write | bytes/s | eks_cluster_node_net_rx_bytes | Instance | The IO write bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Disk IO Read | bytes/s | eks_cluster_node_net_rx_bytes | Instance | The IO read bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| FS Utilization | percent | eks_cluster_node_net_rx_bytes | Instance | The filesystem utilization of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| CPU Utilization | percent | eks_cluster_node_pod_cpu_utilization | Instance | The CPU Utilization of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Memory Utilization | percent | eks_cluster_node_pod_memory_utilization | Instance | The Memory Utilization of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX | bytes/s | eks_cluster_node_pod_net_rx_bytes | Instance | Network RX bytes of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Error Count | count/s | eks_cluster_node_pod_net_rx_error | Instance | Network RX error count of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX | bytes/s | eks_cluster_node_pod_net_tx_bytes | Instance | Network RX bytes of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Error Count | count/s | eks_cluster_node_pod_net_tx_error | Instance | Network RX error count of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| CPU Utilization | percent | eks_cluster_service_pod_cpu_utilization | Endpoint | The CPU Utilization of Pods that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Memory Utilization | percent | eks_cluster_service_pod_memory_utilization | Endpoint | The Memory Utilization of Pods that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX | bytes/s | eks_cluster_service_pod_net_rx_bytes | Endpoint | Network RX bytes of the Pod that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Error Count | count/s | eks_cluster_service_pod_net_rx_error | Endpoint | Network TX error count of the Pod that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX | bytes/s | eks_cluster_service_pod_net_tx_bytes | Endpoint | Network TX bytes of the Pod that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Error Count | count/s | eks_cluster_node_pod_net_tx_error | Endpoint | Network TX error count of the Pod that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | ### Customizations You can customize your own metrics/expression/dashboard panel. -The metrics definition and expression rules are found in `/config/otel-rules/apisix.yaml`. -The APISIX dashboard panel configurations are found in `/config/ui-initialized-templates/apisix`. \ No newline at end of file +The metrics definition and expression rules are found in `/config/otel-rules/aws-eks/`. +The AWS Cloud EKS dashboard panel configurations are found in `/config/ui-initialized-templates/aws_eks`. + +### AWS Container Insights Receiver Deploy Example + +```yaml +# create service account and role binding +apiVersion: v1 +kind: ServiceAccount +metadata: + name: aws-otel-sa + namespace: aws-otel-eks +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: aoc-agent-role +rules: + - apiGroups: [""] + resources: ["pods", "nodes", "endpoints"] + verbs: ["list", "watch"] + - apiGroups: ["apps"] + resources: ["replicasets"] + verbs: ["list", "watch"] + - apiGroups: ["batch"] + resources: ["jobs"] + verbs: ["list", "watch"] + - apiGroups: [""] + resources: ["nodes/proxy"] + verbs: ["get"] + - apiGroups: [""] + resources: ["nodes/stats", "configmaps", "events"] + verbs: ["create", "get"] + - apiGroups: [""] + resources: ["configmaps"] + resourceNames: ["otel-container-insight-clusterleader"] + verbs: ["get","update"] + - apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["create","get","update"] +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: aoc-agent-role-binding +subjects: + - kind: ServiceAccount + name: aws-otel-sa + namespace: aws-otel-eks +roleRef: + kind: ClusterRole + name: aoc-agent-role + apiGroup: rbac.authorization.k8s.io +--- +# OTEL configuration that specify OAP address("oap-service:11800") as exporter +apiVersion: v1 +kind: ConfigMap +metadata: + name: otel-agent-conf + namespace: aws-otel-eks + labels: + app: opentelemetry + component: otel-agent-conf +data: + otel-agent-config: | + extensions: + health_check: + + receivers: + awscontainerinsightreceiver: + + processors: + resource/job-name: + attributes: + - key: job_name + value: aws-cloud-eks-monitoring + action: insert + + exporters: + otlp: + endpoint: oap-service:11800 + tls: + insecure: true + logging: + loglevel: debug + + service: + pipelines: + metrics: + receivers: [awscontainerinsightreceiver] + processors: [resource/job-name] + exporters: [otlp,logging] + extensions: [health_check] +--- +# AWS OTEL DaemonSet +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: aws-otel-eks-ci + namespace: aws-otel-eks +spec: + selector: + matchLabels: + name: aws-otel-eks-ci + template: + metadata: + labels: + name: aws-otel-eks-ci + spec: + containers: + - name: aws-otel-collector + image: amazon/aws-otel-collector:v0.23.0 + env: + - name: AWS_REGION + value: "ap-northeast-1" + - name: K8S_NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: HOST_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: HOST_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: K8S_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + imagePullPolicy: Always + command: + - "/awscollector" + - "--config=/conf/otel-agent-config.yaml" + volumeMounts: + - name: rootfs + mountPath: /rootfs + readOnly: true + - name: dockersock + mountPath: /var/run/docker.sock + readOnly: true + - name: varlibdocker + mountPath: /var/lib/docker + readOnly: true + - name: containerdsock + mountPath: /run/containerd/containerd.sock + readOnly: true + - name: sys + mountPath: /sys + readOnly: true + - name: devdisk + mountPath: /dev/disk + readOnly: true + - name: otel-agent-config-vol + mountPath: /conf + - name: otel-output-vol + mountPath: /otel-output + resources: + limits: + cpu: 200m + memory: 200Mi + requests: + cpu: 200m + memory: 200Mi + volumes: + - configMap: + name: otel-agent-conf + items: + - key: otel-agent-config + path: otel-agent-config.yaml + name: otel-agent-config-vol + - name: rootfs + hostPath: + path: / + - name: dockersock + hostPath: + path: /var/run/docker.sock + - name: varlibdocker + hostPath: + path: /var/lib/docker + - name: containerdsock + hostPath: + path: /run/containerd/containerd.sock + - name: sys + hostPath: + path: /sys + - name: devdisk + hostPath: + path: /dev/disk/ + - name: otel-output-vol + hostPath: + path: /otel-output + serviceAccountName: aws-otel-sa +``` +Refer to [ContainerInsights](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContainerInsights.html) for more information diff --git a/docs/en/setup/backend/opentelemetry-receiver.md b/docs/en/setup/backend/opentelemetry-receiver.md index 255529907e5d..41acc4cd3f67 100644 --- a/docs/en/setup/backend/opentelemetry-receiver.md +++ b/docs/en/setup/backend/opentelemetry-receiver.md @@ -40,5 +40,8 @@ for identification of the metric data. | Metrics of MYSQL| otel-rules/mysql.yaml | prometheus/mysqld_exporter -> OpenTelemetry Collector -- OC/OTLP exporter --> SkyWalking OAP Server | | Metrics of PostgreSQL| otel-rules/postgresql.yaml | postgres_exporter -> OpenTelemetry Collector -- OC/OTLP exporter --> SkyWalking OAP Server | | Metrics of Apache APISIX| otel-rules/apisix.yaml | apisix prometheus plugin -> OpenTelemetry Collector -- OC/OTLP exporter --> SkyWalking OAP Server | +| Metrics of AWS Cloud EKS| otel-rules/aws-eks/eks-cluster.yaml |AWS Container Insights Receiver -> OpenTelemetry Collector -- OC/OTLP exporter --> SkyWalking OAP Server | +| Metrics of AWS Cloud EKS| otel-rules/aws-eks/eks-service.yaml |AWS Container Insights Receiver -> OpenTelemetry Collector -- OC/OTLP exporter --> SkyWalking OAP Server | +| Metrics of AWS Cloud EKS| otel-rules/aws-eks/eks-node.yaml |AWS Container Insights Receiver -> OpenTelemetry Collector -- OC/OTLP exporter --> SkyWalking OAP Server | **Note**: You can also use OpenTelemetry exporter to transport the metrics to SkyWalking OAP directly. See [OpenTelemetry Exporter](./backend-meter.md#opentelemetry-exporter). diff --git a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-node.yaml b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-node.yaml index 90debc1e4dd7..7d27617ca80c 100644 --- a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-node.yaml +++ b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-node.yaml @@ -38,9 +38,6 @@ metricsRules: exp: pod_number_of_containers.downsampling(SUM) - name: cpu_utilization exp: node_cpu_utilization - - - - name: memory_utilization exp: node_memory_utilization - name: net_rx_bytes From b063d9eee321c734a20447f7f77f4755bd9c1fac Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sat, 24 Dec 2022 21:58:35 +0800 Subject: [PATCH 04/13] update EKS MAL --- .../src/main/resources/otel-rules/aws-eks/eks-service.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml index d2fbd229f7ab..bdfb5df8abc8 100644 --- a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml +++ b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml @@ -30,7 +30,8 @@ # filter: "{ tags -> tags.job_name == 'aws-cloud-eks-monitoring' && tags.Service?.trim() }" # The OpenTelemetry job name -expSuffix: tag({tags -> tags.cluster = 'aws-eks-cluster::' + tags.ClusterName}).endpoint(['cluster'],['Service'], Layer.AWS_EKS) +expPrefix: tag({tags -> tags.cluster = 'aws-eks-cluster::' + tags.ClusterName}) +expSuffix: endpoint(['cluster'],['Service'], Layer.AWS_EKS) metricPrefix: eks_cluster_service metricsRules: - name: pod_number From 9da631c1d5b892d5c6cf46c2949864f718d66c76 Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sun, 25 Dec 2022 14:55:37 +0800 Subject: [PATCH 05/13] add associate --- .../aws_eks/aws_eks-cluster.json | 216 +++++++- .../aws_eks/aws_eks-node.json | 472 +++++++++++++++++- .../aws_eks/aws_eks-service.json | 121 ++++- 3 files changed, 788 insertions(+), 21 deletions(-) diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json index 22fc6c274389..9458ace1b5c2 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json @@ -43,6 +43,32 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + } ] }, { @@ -68,6 +94,32 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + } ] }, { @@ -93,6 +145,32 @@ ], "metricTypes": [ "readLabeledMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + } ] }, { @@ -118,6 +196,32 @@ ], "metricTypes": [ "readLabeledMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + } ] }, { @@ -125,7 +229,7 @@ "y": 13, "w": 6, "h": 13, - "i": "8", + "i": "5", "type": "Widget", "widget": { "title": "Network RX Dropped Count (per second)" @@ -143,6 +247,32 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + } ] }, { @@ -150,7 +280,7 @@ "y": 13, "w": 6, "h": 13, - "i": "9", + "i": "6", "type": "Widget", "widget": { "title": "Network RX Error Count (per second)" @@ -168,6 +298,32 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + } ] }, { @@ -175,7 +331,7 @@ "y": 13, "w": 6, "h": 13, - "i": "10", + "i": "7", "type": "Widget", "widget": { "title": "Network TX Dropped Count (per second)" @@ -193,6 +349,32 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + } ] }, { @@ -200,7 +382,7 @@ "y": 13, "w": 6, "h": 13, - "i": "11", + "i": "8", "type": "Widget", "widget": { "title": "Network TX Error Count (per second)" @@ -218,6 +400,32 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + } ] }, { diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-node.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-node.json index 5fef6fbe77c8..9f1cd5858d22 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-node.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-node.json @@ -36,7 +36,7 @@ "y": 0, "w": 6, "h": 13, - "i": "3", + "i": "1", "type": "Widget", "widget": { "title": "Pod Count" @@ -54,6 +54,38 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] }, { @@ -61,7 +93,7 @@ "y": 0, "w": 6, "h": 13, - "i": "6", + "i": "2", "type": "Widget", "widget": { "title": "CPU Utilization (%)" @@ -79,6 +111,38 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] }, { @@ -86,7 +150,7 @@ "y": 0, "w": 6, "h": 13, - "i": "7", + "i": "3", "type": "Widget", "widget": { "title": "Memory Utilization (%)" @@ -104,6 +168,38 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] }, @@ -112,7 +208,7 @@ "y": 0, "w": 6, "h": 13, - "i": "8", + "i": "4", "type": "Widget", "widget": { "title": "Network RX (KB per second)" @@ -135,6 +231,38 @@ { "calculation": "byteToKB" } + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] }, { @@ -142,7 +270,7 @@ "y": 13, "w": 6, "h": 13, - "i": "9", + "i": "5", "type": "Widget", "widget": { "title": "Network RX Error Count (per second)" @@ -160,6 +288,38 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] }, { @@ -167,7 +327,7 @@ "y": 13, "w": 6, "h": 13, - "i": "10", + "i": "6", "type": "Widget", "widget": { "title": "Network TX (KB per second)" @@ -190,6 +350,38 @@ { "calculation": "byteToKB" } + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] }, { @@ -197,7 +389,7 @@ "y": 13, "w": 6, "h": 13, - "i": "11", + "i": "7", "type": "Widget", "widget": { "title": "Network TX Error Count (per second)" @@ -215,6 +407,38 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] }, { @@ -222,7 +446,7 @@ "y": 13, "w": 6, "h": 13, - "i": "12", + "i": "8", "type": "Widget", "widget": { "title": "Disk IO Write (byte per second)" @@ -240,6 +464,38 @@ ], "metricTypes": [ "readLabeledMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "6" + }, + { + "widgetId": "5" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] }, { @@ -247,7 +503,7 @@ "y": 26, "w": 6, "h": 13, - "i": "13", + "i": "9", "type": "Widget", "widget": { "title": "Disk IO Read (byte per second)" @@ -265,6 +521,38 @@ ], "metricTypes": [ "readLabeledMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] }, { @@ -272,7 +560,7 @@ "y": 26, "w": 6, "h": 13, - "i": "14", + "i": "10", "type": "Widget", "widget": { "title": "FS Utilization (%)" @@ -290,6 +578,38 @@ ], "metricTypes": [ "readLabeledMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + }, + { + "widgetId": "7" + }, + { + "widgetId": "8" + }, + { + "widgetId": "9" + }, + { + "widgetId": "10" + } ] } ] @@ -302,7 +622,7 @@ "y": 0, "w": 6, "h": 13, - "i": "1", + "i": "11", "type": "Widget", "widget": { "title": "CPU Utilization" @@ -320,6 +640,26 @@ ], "metricTypes": [ "readLabeledMetricsValues" + ], + "associate": [ + { + "widgetId": "11" + }, + { + "widgetId": "12" + }, + { + "widgetId": "13" + }, + { + "widgetId": "14" + }, + { + "widgetId": "15" + }, + { + "widgetId": "16" + } ] }, { @@ -327,7 +667,7 @@ "y": 0, "w": 6, "h": 13, - "i": "2", + "i": "12", "type": "Widget", "widget": { "title": "Memory Utilization" @@ -345,6 +685,26 @@ ], "metricTypes": [ "readLabeledMetricsValues" + ], + "associate": [ + { + "widgetId": "11" + }, + { + "widgetId": "12" + }, + { + "widgetId": "13" + }, + { + "widgetId": "14" + }, + { + "widgetId": "15" + }, + { + "widgetId": "16" + } ] }, { @@ -352,7 +712,7 @@ "y": 0, "w": 6, "h": 13, - "i": "3", + "i": "13", "type": "Widget", "widget": { "title": "Network RX (KB per second)" @@ -375,6 +735,26 @@ { "calculation": "byteToKB" } + ], + "associate": [ + { + "widgetId": "11" + }, + { + "widgetId": "12" + }, + { + "widgetId": "13" + }, + { + "widgetId": "14" + }, + { + "widgetId": "15" + }, + { + "widgetId": "16" + } ] }, { @@ -382,7 +762,7 @@ "y": 0, "w": 6, "h": 13, - "i": "4", + "i": "14", "type": "Widget", "widget": { "title": "Network RX Error Count (per second)" @@ -400,6 +780,26 @@ ], "metricTypes": [ "readLabeledMetricsValues" + ], + "associate": [ + { + "widgetId": "11" + }, + { + "widgetId": "12" + }, + { + "widgetId": "13" + }, + { + "widgetId": "14" + }, + { + "widgetId": "15" + }, + { + "widgetId": "16" + } ] }, { @@ -407,7 +807,7 @@ "y": 13, "w": 6, "h": 13, - "i": "5", + "i": "15", "type": "Widget", "widget": { "title": "Network TX (KB per second)" @@ -430,6 +830,26 @@ { "calculation": "byteToKB" } + ], + "associate": [ + { + "widgetId": "11" + }, + { + "widgetId": "12" + }, + { + "widgetId": "13" + }, + { + "widgetId": "14" + }, + { + "widgetId": "15" + }, + { + "widgetId": "16" + } ] }, { @@ -437,7 +857,7 @@ "y": 13, "w": 6, "h": 13, - "i": "6", + "i": "16", "type": "Widget", "widget": { "title": "Network TX Error Count (per second)" @@ -455,6 +875,26 @@ ], "metricTypes": [ "readLabeledMetricsValues" + ], + "associate": [ + { + "widgetId": "11" + }, + { + "widgetId": "12" + }, + { + "widgetId": "13" + }, + { + "widgetId": "14" + }, + { + "widgetId": "15" + }, + { + "widgetId": "16" + } ] } diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-service.json index b9153666d7dd..efe85d71748c 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-service.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-service.json @@ -54,6 +54,26 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + } ] }, { @@ -79,6 +99,26 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + } ] }, { @@ -109,6 +149,26 @@ { "calculation": "byteToKB" } + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + } ] }, { @@ -134,6 +194,26 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + } ] }, { @@ -164,6 +244,26 @@ { "calculation": "byteToKB" } + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + } ] }, { @@ -189,11 +289,30 @@ ], "metricTypes": [ "readMetricsValues" + ], + "associate": [ + { + "widgetId": "1" + }, + { + "widgetId": "2" + }, + { + "widgetId": "3" + }, + { + "widgetId": "4" + }, + { + "widgetId": "5" + }, + { + "widgetId": "6" + } ] } ] } - ] } From 7f520c24eb1aebb02a6d00eb819d3c9f4f583a21 Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sun, 25 Dec 2022 16:59:28 +0800 Subject: [PATCH 06/13] revert log4j.xml, update changes.md --- docs/en/changes/changes.md | 4 ++++ .../server-starter/src/main/resources/log4j2.xml | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index 7369362497ae..3bfe56f87db0 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -63,12 +63,16 @@ * Fix the meter value are not correct when using `sumPerMinLabeld` or `sumHistogramPercentile` MAL function. * Fix cannot display attached events when using Zipkin Lens UI query traces. * Remove `time_bucket` for both Stream and Measure kinds in BanyanDB plugin. +* Support monitoring AWS Cloud EKS #### UI * Add Zipkin Lens UI to webapp, and proxy it to context path `/zipkin`. * Migrate the build tool from vue cli to Vite4. * Fix Instance Relation and Endpoint Relation dashboards show up. +* Add Micrometer icon +* Update MySQL UI to support MariaDB +* Add AWS menu for supporting AWS monitoring #### Documentation diff --git a/oap-server/server-starter/src/main/resources/log4j2.xml b/oap-server/server-starter/src/main/resources/log4j2.xml index 0702a7e77dcc..6cbaa5c9dd0e 100644 --- a/oap-server/server-starter/src/main/resources/log4j2.xml +++ b/oap-server/server-starter/src/main/resources/log4j2.xml @@ -17,7 +17,7 @@ ~ --> - + @@ -32,15 +32,15 @@ - + - - + + - - + + From 79bb353b11df111df877c0dfbafff120dd2a050d Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sun, 25 Dec 2022 17:11:31 +0800 Subject: [PATCH 07/13] update comment --- .../org/apache/skywalking/oap/server/core/analysis/Layer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java index d13c393ce182..daaa9f04e363 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java @@ -139,7 +139,7 @@ public enum Layer { APISIX(21, true), /** - * Apache APISIX is an open source, dynamic, scalable, and high-performance cloud native API gateway. + * EKS (Amazon Elastic Kubernetes Service) is k8s service provided by AWS Cloud */ AWS_EKS(22, true); From 0c5cbe73b77ea623960bcce63d10a11cb8c48b4b Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sun, 25 Dec 2022 17:20:33 +0800 Subject: [PATCH 08/13] remove useless mal --- .../src/main/resources/otel-rules/aws-eks/eks-service.yaml | 2 -- .../e2e-mock-sender/src/main/resources/application.yml | 1 - 2 files changed, 3 deletions(-) diff --git a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml index bdfb5df8abc8..f9727b9445cc 100644 --- a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml +++ b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-service.yaml @@ -34,8 +34,6 @@ expPrefix: tag({tags -> tags.cluster = 'aws-eks-cluster::' + tags.ClusterName}) expSuffix: endpoint(['cluster'],['Service'], Layer.AWS_EKS) metricPrefix: eks_cluster_service metricsRules: - - name: pod_number - exp: pod_number_of_containers - name: pod_cpu_utilization exp: pod_cpu_utilization - name: pod_memory_utilization diff --git a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml index 69fb5a9d5133..116b35982a10 100644 --- a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml +++ b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml @@ -26,4 +26,3 @@ e2e: zipkin-kafka-bootstrapServers: ${ZIPKIN_KAFKA_BOOTSTRAP_SERVERS:127.0.0.1:9092} zipkin-kafka-groupId: ${ZIPKIN_KAFKA_GROUPID:zipkin} zipkin-kafka-topic: ${ZIPKIN_KAFKA_TOPIC:zipkin} - otel-metrics-template: ${OTEL_METRICS_TEMPLATE:null} From 6b58bb6f2f14e746c6acb8e495775d96b511c7e2 Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sun, 25 Dec 2022 17:55:08 +0800 Subject: [PATCH 09/13] update doc --- .../backend/backend-aws-eks-monitoring.md | 71 ++++++++++--------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/docs/en/setup/backend/backend-aws-eks-monitoring.md b/docs/en/setup/backend/backend-aws-eks-monitoring.md index 1b6046f7b5e5..c059ca6cb893 100644 --- a/docs/en/setup/backend/backend-aws-eks-monitoring.md +++ b/docs/en/setup/backend/backend-aws-eks-monitoring.md @@ -7,8 +7,8 @@ SkyWalking leverages OpenTelemetry Collector with [AWS Container Insights Receiv 2. The SkyWalking OAP Server parses the expression with [MAL](../../concepts-and-designs/mal.md) to filter/calculate/aggregate and store the results. ### Set up -1. Deploy [amazon/aws-otel-collector](https://hub.docker.com/r/amazon/aws-otel-collector) as `DaemonSet` to EKS -3. Config SkyWalking [OpenTelemetry receiver](opentelemetry-receiver.md). +1. Deploy [amazon/aws-otel-collector](https://hub.docker.com/r/amazon/aws-otel-collector) with [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) to EKS +2. Config SkyWalking [OpenTelemetry receiver](opentelemetry-receiver.md). ### EKS Monitoring [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) provide multiple dimensions metrics for EKS cluster, node , service , etc. @@ -31,38 +31,38 @@ processors: Notice , if you don't specify `job_name` attribute, SkyWalking OAP will ignore the metrics #### Supported Metrics -| Monitoring Panel | Unit | Metric Name | Catalog | Description | Data Source | -|---------------------------------------|---------|--------------------------------------------|------------|---------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Node Count | | eks_cluster_node_count | Service | The node count of the EKS cluster | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Failed Node Count | | eks_cluster_failed_node_count | Service | The failed node count of the EKS cluster | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Pod Count (namespace dimension) | | eks_cluster_namespace_count | Service | The count of pod in this EKS cluster(namespace dimension) | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Pod Count (service dimension) | | eks_cluster_service_count | Service | The count of pod in this EKS cluster(service dimension) | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network RX Dropped Count (per second) | count/s | eks_cluster_net_rx_dropped | Service | The count of Network RX Dropped per second | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network RX Error Count (per second) | count/s | eks_cluster_net_rx_error | Service | The count of Network RX Error per second | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network TX Dropped Count (per second) | count/s | eks_cluster_net_rx_dropped | Service | The count of Network TX Dropped per second | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network TX Error Count (per second) | count/s | eks_cluster_net_rx_error | Service | The count of Network TX Error per second | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Pod Count | | eks_cluster_node_pod_number | Instance | The count of Pods running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| CPU Utilization | percent | eks_cluster_node_cpu_utilization | Instance | The CPU Utilization of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Memory Utilization | percent | eks_cluster_node_memory_utilization | Instance | The Memory Utilization of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network RX | bytes/s | eks_cluster_node_net_rx_bytes | Instance | Network RX bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network RX Error Count | count/s | eks_cluster_node_net_rx_bytes | Instance | Network RX error count of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network TX | bytes/s | eks_cluster_node_net_rx_bytes | Instance | Network TX bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network TX Error Count | count/s | eks_cluster_node_net_rx_bytes | Instance | Network TX error count of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Disk IO Write | bytes/s | eks_cluster_node_net_rx_bytes | Instance | The IO write bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Disk IO Read | bytes/s | eks_cluster_node_net_rx_bytes | Instance | The IO read bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| FS Utilization | percent | eks_cluster_node_net_rx_bytes | Instance | The filesystem utilization of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| CPU Utilization | percent | eks_cluster_node_pod_cpu_utilization | Instance | The CPU Utilization of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Memory Utilization | percent | eks_cluster_node_pod_memory_utilization | Instance | The Memory Utilization of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network RX | bytes/s | eks_cluster_node_pod_net_rx_bytes | Instance | Network RX bytes of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network RX Error Count | count/s | eks_cluster_node_pod_net_rx_error | Instance | Network RX error count of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network TX | bytes/s | eks_cluster_node_pod_net_tx_bytes | Instance | Network RX bytes of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network TX Error Count | count/s | eks_cluster_node_pod_net_tx_error | Instance | Network RX error count of the Pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| CPU Utilization | percent | eks_cluster_service_pod_cpu_utilization | Endpoint | The CPU Utilization of Pods that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Memory Utilization | percent | eks_cluster_service_pod_memory_utilization | Endpoint | The Memory Utilization of Pods that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network RX | bytes/s | eks_cluster_service_pod_net_rx_bytes | Endpoint | Network RX bytes of the Pod that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network RX Error Count | count/s | eks_cluster_service_pod_net_rx_error | Endpoint | Network TX error count of the Pod that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network TX | bytes/s | eks_cluster_service_pod_net_tx_bytes | Endpoint | Network TX bytes of the Pod that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network TX Error Count | count/s | eks_cluster_node_pod_net_tx_error | Endpoint | Network TX error count of the Pod that belong to this service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Monitoring Panel | Unit | Metric Name | Catalog | Description | Data Source | +|---------------------------------------|---------|--------------------------------------------|------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Node Count | | eks_cluster_node_count | Service | The node count of the EKS cluster | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Failed Node Count | | eks_cluster_failed_node_count | Service | The failed node count of the EKS cluster | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Pod Count (namespace dimension) | | eks_cluster_namespace_count | Service | The count of pod in the EKS cluster(namespace dimension) | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Pod Count (service dimension) | | eks_cluster_service_count | Service | The count of pod in the EKS cluster(service dimension) | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Dropped Count (per second) | count/s | eks_cluster_net_rx_dropped | Service | Network RX dropped count | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Error Count (per second) | count/s | eks_cluster_net_rx_error | Service | Network RX error count | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Dropped Count (per second) | count/s | eks_cluster_net_rx_dropped | Service | Network TX dropped count | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Error Count (per second) | count/s | eks_cluster_net_rx_error | Service | Network TX error count | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Pod Count | | eks_cluster_node_pod_number | Instance | The count of pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| CPU Utilization | percent | eks_cluster_node_cpu_utilization | Instance | The CPU Utilization of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Memory Utilization | percent | eks_cluster_node_memory_utilization | Instance | The Memory Utilization of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX | bytes/s | eks_cluster_node_net_rx_bytes | Instance | Network RX bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Error Count | count/s | eks_cluster_node_net_rx_bytes | Instance | Network RX error count of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX | bytes/s | eks_cluster_node_net_rx_bytes | Instance | Network TX bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Error Count | count/s | eks_cluster_node_net_rx_bytes | Instance | Network TX error count of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Disk IO Write | bytes/s | eks_cluster_node_net_rx_bytes | Instance | The IO write bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Disk IO Read | bytes/s | eks_cluster_node_net_rx_bytes | Instance | The IO read bytes of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| FS Utilization | percent | eks_cluster_node_net_rx_bytes | Instance | The filesystem utilization of the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| CPU Utilization | percent | eks_cluster_node_pod_cpu_utilization | Instance | The CPU Utilization of the pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Memory Utilization | percent | eks_cluster_node_pod_memory_utilization | Instance | The Memory Utilization of the pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX | bytes/s | eks_cluster_node_pod_net_rx_bytes | Instance | Network RX bytes of the pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Error Count | count/s | eks_cluster_node_pod_net_rx_error | Instance | Network RX error count of the pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX | bytes/s | eks_cluster_node_pod_net_tx_bytes | Instance | Network RX bytes of the pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Error Count | count/s | eks_cluster_node_pod_net_tx_error | Instance | Network RX error count of the pod running on the node | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| CPU Utilization | percent | eks_cluster_service_pod_cpu_utilization | Endpoint | The CPU Utilization of pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Memory Utilization | percent | eks_cluster_service_pod_memory_utilization | Endpoint | The Memory Utilization of pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX | bytes/s | eks_cluster_service_pod_net_rx_bytes | Endpoint | Network RX bytes of the pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Error Count | count/s | eks_cluster_service_pod_net_rx_error | Endpoint | Network TX error count of the pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX | bytes/s | eks_cluster_service_pod_net_tx_bytes | Endpoint | Network TX bytes of the pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Error Count | count/s | eks_cluster_node_pod_net_tx_error | Endpoint | Network TX error count of the pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | ### Customizations You can customize your own metrics/expression/dashboard panel. @@ -120,7 +120,7 @@ roleRef: name: aoc-agent-role apiGroup: rbac.authorization.k8s.io --- -# OTEL configuration that specify OAP address("oap-service:11800") as exporter +# OTEL configuration that specify OAP address("oap-service:11800") as otlp exporter address apiVersion: v1 kind: ConfigMap metadata: @@ -179,6 +179,7 @@ spec: - name: aws-otel-collector image: amazon/aws-otel-collector:v0.23.0 env: + # Specify aws region - name: AWS_REGION value: "ap-northeast-1" - name: K8S_NODE_NAME From 87b3c83c6315ba664c31c32783e0b0833c85f713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=99=9F=20Wu=20Sheng?= Date: Sun, 25 Dec 2022 19:17:29 +0800 Subject: [PATCH 10/13] Update backend-aws-eks-monitoring.md --- docs/en/setup/backend/backend-aws-eks-monitoring.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/en/setup/backend/backend-aws-eks-monitoring.md b/docs/en/setup/backend/backend-aws-eks-monitoring.md index c059ca6cb893..146ad62f3a33 100644 --- a/docs/en/setup/backend/backend-aws-eks-monitoring.md +++ b/docs/en/setup/backend/backend-aws-eks-monitoring.md @@ -11,13 +11,13 @@ SkyWalking leverages OpenTelemetry Collector with [AWS Container Insights Receiv 2. Config SkyWalking [OpenTelemetry receiver](opentelemetry-receiver.md). ### EKS Monitoring -[AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) provide multiple dimensions metrics for EKS cluster, node , service , etc. -Accordingly, SkyWalking observes the status, payload of EKS cluster, which is cataloged as a `LAYER: AWS_EKS` `Service` in the OAP. Meanwhile, the k8s nodes would be recognized as `LAYER: AWS_EKS` `instance`s. The k8s service would be recognized as `endpoint`s. +[AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) provides multiple dimensions metrics for EKS cluster, node, service, etc. +Accordingly, SkyWalking observes the status, and payload of the EKS cluster, which is cataloged as a `LAYER: AWS_EKS` `Service` in the OAP. Meanwhile, the k8s nodes would be recognized as `LAYER: AWS_EKS` `instance`s. The k8s service would be recognized as `endpoint`s. #### Specify Job Name SkyWalking distinguishes AWS Cloud EKS metrics by attributes `job_name`, which value is `aws-cloud-eks-monitoring`. -You could leverage OTEL Collector processor to add the attribute as following : +You could leverage OTEL Collector processor to add the attribute as follows: ```yaml processors: @@ -28,7 +28,7 @@ processors: action: insert ``` -Notice , if you don't specify `job_name` attribute, SkyWalking OAP will ignore the metrics +Notice, if you don't specify `job_name` attribute, SkyWalking OAP will ignore the metrics #### Supported Metrics | Monitoring Panel | Unit | Metric Name | Catalog | Description | Data Source | @@ -60,9 +60,9 @@ Notice , if you don't specify `job_name` attribute, SkyWalking OAP will ignore t | CPU Utilization | percent | eks_cluster_service_pod_cpu_utilization | Endpoint | The CPU Utilization of pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | | Memory Utilization | percent | eks_cluster_service_pod_memory_utilization | Endpoint | The Memory Utilization of pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | | Network RX | bytes/s | eks_cluster_service_pod_net_rx_bytes | Endpoint | Network RX bytes of the pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network RX Error Count | count/s | eks_cluster_service_pod_net_rx_error | Endpoint | Network TX error count of the pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network RX Error Count | count/s | eks_cluster_service_pod_net_rx_error | Endpoint | Network TX error count of the pod that belongs to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | | Network TX | bytes/s | eks_cluster_service_pod_net_tx_bytes | Endpoint | Network TX bytes of the pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | -| Network TX Error Count | count/s | eks_cluster_node_pod_net_tx_error | Endpoint | Network TX error count of the pod that belong to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | +| Network TX Error Count | count/s | eks_cluster_node_pod_net_tx_error | Endpoint | Network TX error count of the pod that belongs to the service | [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) | ### Customizations You can customize your own metrics/expression/dashboard panel. From 8e6af0fce1f058107f6d79e94d1bbbb888054f63 Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Mon, 26 Dec 2022 20:53:08 +0800 Subject: [PATCH 11/13] update otel mock api --- test/e2e-v2/cases/aws/eks/docker-compose.yml | 2 + test/e2e-v2/cases/aws/eks/e2e.yaml | 2 +- .../cases/aws/eks/expected/instance.yml | 2 +- .../aws/eks/mock-data/otel-mock-metrics.json | 279 ++++++++++++++++++ .../java-test-service/e2e-mock-sender/pom.xml | 20 +- .../skywalking/e2e/E2EConfiguration.java | 1 + .../controller/AwsEKSOtelMetricsSender.java | 191 ------------ .../e2e/controller/OtelMetricsSender.java | 129 ++++++++ .../src/main/resources/application.yml | 1 + 9 files changed, 429 insertions(+), 198 deletions(-) create mode 100644 test/e2e-v2/cases/aws/eks/mock-data/otel-mock-metrics.json delete mode 100644 test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/AwsEKSOtelMetricsSender.java create mode 100644 test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/OtelMetricsSender.java diff --git a/test/e2e-v2/cases/aws/eks/docker-compose.yml b/test/e2e-v2/cases/aws/eks/docker-compose.yml index d75634329fc3..dcd2cfc5af6f 100644 --- a/test/e2e-v2/cases/aws/eks/docker-compose.yml +++ b/test/e2e-v2/cases/aws/eks/docker-compose.yml @@ -29,10 +29,12 @@ services: image: "eclipse-temurin:8-jre" volumes: - ./../../../java-test-service/e2e-mock-sender/target/e2e-mock-sender-2.0.0.jar:/e2e-mock-sender-2.0.0.jar + - ./mock-data:/data/otel-metrics command: [ "java", "-jar", "/e2e-mock-sender-2.0.0.jar" ] environment: OAP_HOST: oap OAP_GRPC_PORT: 11800 + OTEL_METRICS_DATA_PATH: /data/otel-metrics networks: - e2e ports: diff --git a/test/e2e-v2/cases/aws/eks/e2e.yaml b/test/e2e-v2/cases/aws/eks/e2e.yaml index 76f85d3c2785..7eb0bdabb526 100644 --- a/test/e2e-v2/cases/aws/eks/e2e.yaml +++ b/test/e2e-v2/cases/aws/eks/e2e.yaml @@ -32,7 +32,7 @@ trigger: action: http interval: 3s times: 10 - url: http://localhost:9093/aws/otel/eks/send + url: http://localhost:9093/otel-metrics/send method: GET verify: diff --git a/test/e2e-v2/cases/aws/eks/expected/instance.yml b/test/e2e-v2/cases/aws/eks/expected/instance.yml index 89127279b042..9864ca783084 100644 --- a/test/e2e-v2/cases/aws/eks/expected/instance.yml +++ b/test/e2e-v2/cases/aws/eks/expected/instance.yml @@ -15,7 +15,7 @@ {{- contains . }} - id: {{ notEmpty .id }} - name: ip-172-31-23-33.ap-northeast-1.compute.internal + name: ip-172-31-10-158.ap-northeast-1.compute.internal instanceuuid: {{ notEmpty .instanceuuid }} attributes: [] language: UNKNOWN diff --git a/test/e2e-v2/cases/aws/eks/mock-data/otel-mock-metrics.json b/test/e2e-v2/cases/aws/eks/mock-data/otel-mock-metrics.json new file mode 100644 index 000000000000..892cb4a75b3c --- /dev/null +++ b/test/e2e-v2/cases/aws/eks/mock-data/otel-mock-metrics.json @@ -0,0 +1,279 @@ +{ + "resourceMetrics": [ + { + "resource": { + "attributes": [ + { + "key": "AutoScalingGroupName", + "value": { + "stringValue": "eks-node-2-46c25931-6b80-2e04-5023-cca9e97c589d" + } + }, + { + "key": "ClusterName", + "value": { + "stringValue": "SkyWalking" + } + }, + { + "key": "Type", + "value": { + "stringValue": "Node" + } + }, + { + "key": "NodeName", + "value": { + "stringValue": "ip-172-31-10-158.ap-northeast-1.compute.internal" + } + }, + { + "key": "InstanceId", + "value": { + "stringValue": "i-06c02c575d866b59b" + } + }, + { + "key": "InstanceType", + "value": { + "stringValue": "t3.medium" + } + }, + { + "key": "kubernetes", + "value": { + "stringValue": "{\"host\":\"ip-172-31-10-158.ap-northeast-1.compute.internal\"}" + } + }, + { + "key": "Sources", + "value": { + "stringValue": "[\"cadvisor\",\"/proc\",\"pod\",\"calculated\"]" + } + }, + { + "key": "Timestamp", + "value": { + "stringValue": "1669442689514" + } + }, + { + "key": "Version", + "value": { + "stringValue": "0" + } + }, + { + "key": "job_name", + "value": { + "stringValue": "aws-cloud-eks-monitoring" + } + } + ] + }, + "scopeMetrics": [ + { + "scope": {}, + "metrics": [ + { + "name": "node_memory_utilization", + "unit": "Percent", + "gauge": { + "dataPoints": [ + { + "timeUnixNano": "1669442689514625306", + "asDouble": 16.00333280879926 + } + ] + } + } + ] + } + ] + }, + { + "resource": { + "attributes": [ + { + "key": "NodeName", + "value": { + "stringValue": "ip-172-31-10-158.ap-northeast-1.compute.internal" + } + }, + { + "key": "Sources", + "value": { + "stringValue": "[\"apiserver\"]" + } + }, + { + "key": "Type", + "value": { + "stringValue": "Cluster" + } + }, + { + "key": "Version", + "value": { + "stringValue": "0" + } + }, + { + "key": "ClusterName", + "value": { + "stringValue": "SkyWalking" + } + }, + { + "key": "Timestamp", + "value": { + "stringValue": "1669442693795" + } + }, + { + "key": "job_name", + "value": { + "stringValue": "aws-cloud-eks-monitoring" + } + } + ] + }, + "scopeMetrics": [ + { + "scope": {}, + "metrics": [ + { + "name": "cluster_node_count", + "unit": "Count", + "gauge": { + "dataPoints": [ + { + "timeUnixNano": "1669442693795487301", + "asInt": "1" + } + ] + } + } + ] + } + ] + }, + { + "resource": { + "attributes": [ + { + "key": "Version", + "value": { + "stringValue": "0" + } + }, + { + "key": "InstanceId", + "value": { + "stringValue": "i-06c02c575d866b59b" + } + }, + { + "key": "InstanceType", + "value": { + "stringValue": "t3.medium" + } + }, + { + "key": "AutoScalingGroupName", + "value": { + "stringValue": "eks-node-2-46c25931-6b80-2e04-5023-cca9e97c589d" + } + }, + { + "key": "PodName", + "value": { + "stringValue": "eks-sample-linux-deployment" + } + }, + { + "key": "Type", + "value": { + "stringValue": "Pod" + } + }, + { + "key": "NodeName", + "value": { + "stringValue": "ip-172-31-10-158.ap-northeast-1.compute.internal" + } + }, + { + "key": "ClusterName", + "value": { + "stringValue": "SkyWalking" + } + }, + { + "key": "pod_status", + "value": { + "stringValue": "Running" + } + }, + { + "key": "kubernetes", + "value": { + "stringValue": "{\"host\":\"ip-172-31-10-158.ap-northeast-1.compute.internal\",\"labels\":{\"app\":\"eks-sample-linux-app\",\"pod-template-hash\":\"764959fd66\"},\"namespace_name\":\"default\",\"pod_id\":\"52c5847b-f68c-4d4b-ae9e-e85f95f972bf\",\"pod_name\":\"eks-sample-linux-deployment-764959fd66-fql4v\",\"pod_owners\":[{\"owner_kind\":\"Deployment\",\"owner_name\":\"eks-sample-linux-deployment\"}]}" + } + }, + { + "key": "Sources", + "value": { + "stringValue": "[\"cadvisor\",\"pod\",\"calculated\"]" + } + }, + { + "key": "Namespace", + "value": { + "stringValue": "default" + } + }, + { + "key": "Timestamp", + "value": { + "stringValue": "1669442684150" + } + }, + { + "key": "Service", + "value": { + "stringValue": "kube-dns" + } + }, + { + "key": "job_name", + "value": { + "stringValue": "aws-cloud-eks-monitoring" + } + } + ] + }, + "scopeMetrics": [ + { + "scope": {}, + "metrics": [ + { + "name": "pod_network_rx_bytes", + "unit": "Bytes/Second", + "gauge": { + "dataPoints": [ + { + "timeUnixNano": "1669442684150753695", + "asDouble": 0 + } + ] + } + } + ] + } + ] + } + + ] +} + diff --git a/test/e2e-v2/java-test-service/e2e-mock-sender/pom.xml b/test/e2e-v2/java-test-service/e2e-mock-sender/pom.xml index 41c1bb89d49f..922f7ed5e230 100644 --- a/test/e2e-v2/java-test-service/e2e-mock-sender/pom.xml +++ b/test/e2e-v2/java-test-service/e2e-mock-sender/pom.xml @@ -39,11 +39,6 @@ e2e-protocol ${project.version} - - org.apache.skywalking - opentelemetry-proto - ${project.version} - org.apache.kafka kafka-clients @@ -53,6 +48,21 @@ zipkin 2.23.16 + + org.apache.skywalking + opentelemetry-proto + ${project.version} + + + com.google.protobuf + protobuf-java-util + 3.21.12 + + + com.jayway.jsonpath + json-path + 2.7.0 + diff --git a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/E2EConfiguration.java b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/E2EConfiguration.java index 7099c2b88b2a..8593014e2b1a 100644 --- a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/E2EConfiguration.java +++ b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/E2EConfiguration.java @@ -31,4 +31,5 @@ public class E2EConfiguration { private String zipkinKafkaBootstrapServers; private String zipkinKafkaGroupId; private String zipkinKafkaTopic; + private String otelMetricsDataPath; } diff --git a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/AwsEKSOtelMetricsSender.java b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/AwsEKSOtelMetricsSender.java deleted file mode 100644 index 2ab6b8e97ac2..000000000000 --- a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/AwsEKSOtelMetricsSender.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * 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.e2e.controller; - -import io.grpc.ManagedChannel; -import io.grpc.internal.DnsNameResolverProvider; -import io.grpc.netty.NettyChannelBuilder; -import io.grpc.stub.StreamObserver; -import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest; -import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse; -import io.opentelemetry.proto.collector.metrics.v1.MetricsServiceGrpc; -import io.opentelemetry.proto.common.v1.AnyValue; -import io.opentelemetry.proto.common.v1.KeyValue; -import io.opentelemetry.proto.metrics.v1.Gauge; -import io.opentelemetry.proto.metrics.v1.Metric; -import io.opentelemetry.proto.metrics.v1.NumberDataPoint; -import io.opentelemetry.proto.metrics.v1.ResourceMetrics; -import io.opentelemetry.proto.resource.v1.Resource; -import lombok.extern.slf4j.Slf4j; -import org.apache.skywalking.e2e.E2EConfiguration; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@Slf4j -@RestController -@RequestMapping("/aws/otel/eks") -public class AwsEKSOtelMetricsSender { - private static final int MAX_INBOUND_MESSAGE_SIZE = 1024 * 1024 * 50; - private final MetricsServiceGrpc.MetricsServiceStub metricsServiceStub; - private static final String JOB_NAME = "aws-cloud-eks-monitoring"; - - public AwsEKSOtelMetricsSender(final E2EConfiguration configuration) { - final ManagedChannel channel = NettyChannelBuilder.forAddress( - configuration.getOapHost(), Integer.parseInt(configuration.getOapGrpcPort())) - .nameResolverFactory(new DnsNameResolverProvider()) - .maxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE) - .usePlaintext() - .build(); - this.metricsServiceStub = MetricsServiceGrpc.newStub(channel); - } - - @GetMapping("send") - public String sendMetricsByTemplate() { - final ExportMetricsServiceRequest.Builder builder = ExportMetricsServiceRequest.newBuilder(); - addClusterMetrics(builder.addResourceMetricsBuilder()); - addNodeMemoryMetrics(builder.addResourceMetricsBuilder()); - addPodMemoryMetrics(builder.addResourceMetricsBuilder()); - - this.metricsServiceStub.export(builder.build(), new StreamObserver() { - @Override - public void onNext(final ExportMetricsServiceResponse exportMetricsServiceResponse) { - - } - - @Override - public void onError(final Throwable throwable) { - log.error("sendOtelMetrics by template error ", throwable); - } - - @Override - public void onCompleted() { - - } - }); - return "ok"; - } - - private void addPodMemoryMetrics(final ResourceMetrics.Builder resourceMetricsBuilder) { - final Resource.Builder builder = createPodResourceBuilder(System.currentTimeMillis()); - resourceMetricsBuilder.setResource(builder.build()); - final long timeInNano = System.nanoTime(); - resourceMetricsBuilder.addScopeMetricsBuilder().addMetrics( - Metric.newBuilder() - .setName("pod_network_rx_bytes") - .setUnit("Count") - .setGauge(Gauge.newBuilder().addDataPoints(intDataPointBuilder(timeInNano, 8000L)).build()) - .build()); - } - - private void addNodeMemoryMetrics(final ResourceMetrics.Builder resourceMetricsBuilder) { - final Resource.Builder builder = createNodeResourceBuilder(System.currentTimeMillis()); - resourceMetricsBuilder.setResource(builder.build()); - final long timeInNano = System.nanoTime(); - resourceMetricsBuilder.addScopeMetricsBuilder().addMetrics( - Metric.newBuilder() - .setName("node_memory_utilization") - .setUnit("Count") - .setGauge(Gauge.newBuilder().addDataPoints(intDataPointBuilder(timeInNano, 800L)).build()) - .build()); - } - - private void addClusterMetrics(ResourceMetrics.Builder resourceMetricsBuilder) { - final Resource.Builder builder = createClusterResourceBuilder(System.currentTimeMillis()); - resourceMetricsBuilder.setResource(builder.build()); - - final long timeInNano = System.nanoTime(); - - resourceMetricsBuilder.addScopeMetricsBuilder().addMetrics( - Metric.newBuilder() - .setName("cluster_node_count") - .setUnit("Count") - .setGauge(Gauge.newBuilder().addDataPoints(intDataPointBuilder(timeInNano, 8L)).build()) - .build()); - } - - private Resource.Builder createClusterResourceBuilder(Long timestamp) { - final Resource.Builder builder = Resource.newBuilder(); - builder.addAttributes(keyValue("ClusterName", "SkyWalking")); - builder.addAttributes(keyValue("NodeName", "ip-172-31-23-33.ap-northeast-1.compute.internal")); - builder.addAttributes(keyValue("Timestamp", timestamp + "")); - builder.addAttributes(keyValue("Type", "Cluster")); - builder.addAttributes(keyValue("Version", "0")); - builder.addAttributes(keyValue("job_name", JOB_NAME)); - return builder; - } - - private Resource.Builder createNodeResourceBuilder(Long timestamp) { - final Resource.Builder builder = Resource.newBuilder(); - builder.addAttributes(keyValue("AutoScalingGroupName", "eks-node-1-52c27f89-29fe-e08d-a931-8270467a8803")); - builder.addAttributes(keyValue("ClusterName", "SkyWalking")); - builder.addAttributes(keyValue("InstanceId", "i-0afe883d89558b631")); - builder.addAttributes(keyValue("InstanceType", "t3.medium")); - builder.addAttributes(keyValue("NodeName", "ip-172-31-23-33.ap-northeast-1.compute.internal")); - builder.addAttributes(keyValue("Sources", "[\"cadvisor\",\"pod\",\"calculated\"]")); - builder.addAttributes(keyValue("Timestamp", timestamp + "")); - builder.addAttributes(keyValue("Type", "Node")); - builder.addAttributes(keyValue("Version", "0")); - builder.addAttributes(keyValue("job_name", JOB_NAME)); - builder.addAttributes(keyValue( - "kubernetes", - "{\"host\":\"ip-172-31-23-33.ap-northeast-1.compute.internal\"}" - )); - builder.addAttributes(keyValue("pod_status", "Running")); - return builder; - } - - private Resource.Builder createPodResourceBuilder(Long timestamp) { - final Resource.Builder builder = Resource.newBuilder(); - builder.addAttributes(keyValue("AutoScalingGroupName", "eks-node-1-52c27f89-29fe-e08d-a931-8270467a8803")); - builder.addAttributes(keyValue("ClusterName", "SkyWalking")); - builder.addAttributes(keyValue("InstanceId", "i-0afe883d89558b631")); - builder.addAttributes(keyValue("InstanceType", "t3.medium")); - builder.addAttributes(keyValue("Namespace", "aws-otel-eks")); - builder.addAttributes(keyValue("NodeName", "ip-172-31-23-33.ap-northeast-1.compute.internal")); - builder.addAttributes(keyValue("PodName", "aws-otel-eks-ci")); - builder.addAttributes(keyValue("Sources", "[\"cadvisor\",\"pod\",\"calculated\"]")); - builder.addAttributes(keyValue("Timestamp", timestamp + "")); - builder.addAttributes(keyValue("Type", "Pod")); - builder.addAttributes(keyValue("Version", "0")); - builder.addAttributes(keyValue("job_name", JOB_NAME)); - builder.addAttributes(keyValue("Service", "kube-dns")); - builder.addAttributes(keyValue( - "kubernetes", - "{\"host\":\"ip-172-31-23-33.ap-northeast-1.compute.internal\",\"labels\":{\"controller-revision-hash\":\"7b5f4f4fff\",\"name\":\"aws-otel-eks-ci\",\"pod-template-generation\":\"1\"},\"namespace_name\":\"aws-otel-eks\",\"pod_id\":\"3a3e479b-986a-40d5-9023-f4c6a259b6ba\",\"pod_name\":\"aws-otel-eks-ci-lzbr8\",\"pod_owners\":[{\"owner_kind\":\"DaemonSet\",\"owner_name\":\"aws-otel-eks-ci\"}]}" - )); - builder.addAttributes(keyValue("pod_status", "Running")); - return builder; - } - - private NumberDataPoint.Builder intDataPointBuilder(long timeNano, long value) { - final NumberDataPoint.Builder numberDataPointBuilder = NumberDataPoint.newBuilder(); - numberDataPointBuilder.setTimeUnixNano(System.nanoTime()); - numberDataPointBuilder.setAsInt(value); - return numberDataPointBuilder; - } - - private KeyValue keyValue(String k, String v) { - return KeyValue.newBuilder() - .setKey(k) - .setValue(AnyValue.newBuilder().setStringValue(v).build()) - .build(); - } - -} diff --git a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/OtelMetricsSender.java b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/OtelMetricsSender.java new file mode 100644 index 000000000000..9f741b72a5dc --- /dev/null +++ b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/java/org/apache/skywalking/e2e/controller/OtelMetricsSender.java @@ -0,0 +1,129 @@ +/* + * 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.e2e.controller; + +import com.google.protobuf.util.JsonFormat; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.DocumentContext; +import com.jayway.jsonpath.EvaluationListener; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Option; +import io.grpc.ManagedChannel; +import io.grpc.internal.DnsNameResolverProvider; +import io.grpc.netty.NettyChannelBuilder; +import io.grpc.stub.StreamObserver; +import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest; +import io.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse; +import io.opentelemetry.proto.collector.metrics.v1.MetricsServiceGrpc; +import java.io.File; +import java.io.IOException; +import lombok.extern.slf4j.Slf4j; +import org.apache.skywalking.e2e.E2EConfiguration; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Slf4j +@RestController +@RequestMapping("/otel-metrics") +public class OtelMetricsSender { + private static final int MAX_INBOUND_MESSAGE_SIZE = 1024 * 1024 * 50; + private final MetricsServiceGrpc.MetricsServiceStub metricsServiceStub; + private final String otelMetricsDataPath; + + public OtelMetricsSender(final E2EConfiguration configuration) { + final ManagedChannel channel = NettyChannelBuilder.forAddress( + configuration.getOapHost(), Integer.parseInt(configuration.getOapGrpcPort())) + .nameResolverFactory(new DnsNameResolverProvider()) + .maxInboundMessageSize(MAX_INBOUND_MESSAGE_SIZE) + .usePlaintext() + .build(); + this.metricsServiceStub = MetricsServiceGrpc.newStub(channel); + this.otelMetricsDataPath = configuration.getOtelMetricsDataPath(); + } + + /** + * Send otel metrics data that base on JSON formatted file to OAP + * + * This method will detect files whose name end with '.json' in the directory specified by + * `org.apache.skywalking.e2e.E2EConfiguration#otelMetricsDataPath`, and send the data in the file to OAP. Also + * rewrite field which path is '$..startTimeUnixNano', '$..timeUnixNano' to current time in nano + */ + @GetMapping("send") + public String sendMetricsByTemplate() throws IOException { + File otelData = new File(this.otelMetricsDataPath); + if (!otelData.exists() || !otelData.isDirectory()) { + String msg = "The path must be a folder : " + this.otelMetricsDataPath; + log.error(msg); + return msg; + } + final File[] files = findJSONFiles(otelData); + if (files.length == 0) { + String msg = "The folder doesn't contain any json file : " + this.otelMetricsDataPath; + log.error(msg); + return msg; + } + for (File file : files) { + final ExportMetricsServiceRequest.Builder builder = ExportMetricsServiceRequest.newBuilder(); + String jsonData = rewriteTimeField(file); + JsonFormat.parser().merge(jsonData, builder); + sendReq(builder); + } + return "ok"; + } + + private String rewriteTimeField(File file) throws IOException { + final long nanoTime = System.nanoTime(); + final Configuration configuration = Configuration.builder() + .options(Option.SUPPRESS_EXCEPTIONS) + .evaluationListener(found -> { + log.info("rewrite json field: {}, {}->{}", found.path(), + found.result(), nanoTime + ); + return EvaluationListener.EvaluationContinuation.CONTINUE; + }).build(); + final DocumentContext documentContext = JsonPath.using(configuration).parse(file); + documentContext.set("$..timeUnixNano", nanoTime); + documentContext.set("$..startTimeUnixNano", nanoTime); + return documentContext.jsonString(); + } + + private void sendReq(final ExportMetricsServiceRequest.Builder builder) { + this.metricsServiceStub.export(builder.build(), new StreamObserver() { + @Override + public void onNext(final ExportMetricsServiceResponse exportMetricsServiceResponse) { + + } + + @Override + public void onError(final Throwable throwable) { + log.error("sendOtelMetrics by template error ", throwable); + } + + @Override + public void onCompleted() { + + } + }); + } + + private File[] findJSONFiles(final File otelData) { + return otelData.listFiles((dir, name) -> name.endsWith(".json")); + } +} diff --git a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml index 116b35982a10..d1308017dedd 100644 --- a/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml +++ b/test/e2e-v2/java-test-service/e2e-mock-sender/src/main/resources/application.yml @@ -26,3 +26,4 @@ e2e: zipkin-kafka-bootstrapServers: ${ZIPKIN_KAFKA_BOOTSTRAP_SERVERS:127.0.0.1:9092} zipkin-kafka-groupId: ${ZIPKIN_KAFKA_GROUPID:zipkin} zipkin-kafka-topic: ${ZIPKIN_KAFKA_TOPIC:zipkin} + otel-metrics-data-path: ${OTEL_METRICS_DATA_PATH:/data/otel-metrics/} From cf5911a7a0193b44c3da6fae0b4691a05e176bc0 Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sat, 31 Dec 2022 15:55:50 +0800 Subject: [PATCH 12/13] net metric use AVG --- .../main/resources/otel-rules/aws-eks/eks-cluster.yaml | 8 ++++---- .../ui-initialized-templates/aws_eks/aws_eks-cluster.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-cluster.yaml b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-cluster.yaml index 73e2fa860970..a0cd0fcfc839 100644 --- a/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-cluster.yaml +++ b/oap-server/server-starter/src/main/resources/otel-rules/aws-eks/eks-cluster.yaml @@ -43,10 +43,10 @@ metricsRules: - name: service_count exp: service_number_of_running_pods.sum(['Service','cluster']) - name: net_rx_dropped - exp: node_network_rx_dropped.downsampling(SUM) + exp: node_network_rx_dropped - name: net_rx_error - exp: node_network_rx_errors.downsampling(SUM) + exp: node_network_rx_errors - name: net_tx_dropped - exp: node_network_tx_dropped.downsampling(SUM) + exp: node_network_tx_dropped - name: net_tx_error - exp: node_network_tx_errors.downsampling(SUM) + exp: node_network_tx_errors diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json index 9458ace1b5c2..f558b56b6af7 100644 --- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json +++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/aws_eks/aws_eks-cluster.json @@ -232,7 +232,7 @@ "i": "5", "type": "Widget", "widget": { - "title": "Network RX Dropped Count (per second)" + "title": "Network RX Dropped Count (per second, per node)" }, "graph": { "type": "Line", @@ -283,7 +283,7 @@ "i": "6", "type": "Widget", "widget": { - "title": "Network RX Error Count (per second)" + "title": "Network RX Error Count (per second, per node)" }, "graph": { "type": "Line", @@ -334,7 +334,7 @@ "i": "7", "type": "Widget", "widget": { - "title": "Network TX Dropped Count (per second)" + "title": "Network TX Dropped Count (per second, per node)" }, "graph": { "type": "Line", @@ -385,7 +385,7 @@ "i": "8", "type": "Widget", "widget": { - "title": "Network TX Error Count (per second)" + "title": "Network TX Error Count (per second, per node)" }, "graph": { "type": "Line", From 30d1b4c80483913df178a84a61e0929d6661968f Mon Sep 17 00:00:00 2001 From: "pg.yang" Date: Sat, 31 Dec 2022 16:33:52 +0800 Subject: [PATCH 13/13] Update EKS monitoring doc --- .../backend/backend-aws-eks-monitoring.md | 227 +++--------------- 1 file changed, 31 insertions(+), 196 deletions(-) diff --git a/docs/en/setup/backend/backend-aws-eks-monitoring.md b/docs/en/setup/backend/backend-aws-eks-monitoring.md index 146ad62f3a33..319b3bb45374 100644 --- a/docs/en/setup/backend/backend-aws-eks-monitoring.md +++ b/docs/en/setup/backend/backend-aws-eks-monitoring.md @@ -21,11 +21,11 @@ You could leverage OTEL Collector processor to add the attribute as follows: ```yaml processors: - resource/job-name: - attributes: - - key: job_name - value: aws-cloud-eks-monitoring - action: insert + resource/job-name: + attributes: + - key: job_name + value: aws-cloud-eks-monitoring + action: insert ``` Notice, if you don't specify `job_name` attribute, SkyWalking OAP will ignore the metrics @@ -69,197 +69,32 @@ You can customize your own metrics/expression/dashboard panel. The metrics definition and expression rules are found in `/config/otel-rules/aws-eks/`. The AWS Cloud EKS dashboard panel configurations are found in `/config/ui-initialized-templates/aws_eks`. -### AWS Container Insights Receiver Deploy Example +### OTEL Configuration Sample With AWS Container Insights Receiver ```yaml -# create service account and role binding -apiVersion: v1 -kind: ServiceAccount -metadata: - name: aws-otel-sa - namespace: aws-otel-eks ---- -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: aoc-agent-role -rules: - - apiGroups: [""] - resources: ["pods", "nodes", "endpoints"] - verbs: ["list", "watch"] - - apiGroups: ["apps"] - resources: ["replicasets"] - verbs: ["list", "watch"] - - apiGroups: ["batch"] - resources: ["jobs"] - verbs: ["list", "watch"] - - apiGroups: [""] - resources: ["nodes/proxy"] - verbs: ["get"] - - apiGroups: [""] - resources: ["nodes/stats", "configmaps", "events"] - verbs: ["create", "get"] - - apiGroups: [""] - resources: ["configmaps"] - resourceNames: ["otel-container-insight-clusterleader"] - verbs: ["get","update"] - - apiGroups: ["coordination.k8s.io"] - resources: ["leases"] - verbs: ["create","get","update"] ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: aoc-agent-role-binding -subjects: - - kind: ServiceAccount - name: aws-otel-sa - namespace: aws-otel-eks -roleRef: - kind: ClusterRole - name: aoc-agent-role - apiGroup: rbac.authorization.k8s.io ---- -# OTEL configuration that specify OAP address("oap-service:11800") as otlp exporter address -apiVersion: v1 -kind: ConfigMap -metadata: - name: otel-agent-conf - namespace: aws-otel-eks - labels: - app: opentelemetry - component: otel-agent-conf -data: - otel-agent-config: | - extensions: - health_check: - - receivers: - awscontainerinsightreceiver: - - processors: - resource/job-name: - attributes: - - key: job_name - value: aws-cloud-eks-monitoring - action: insert - - exporters: - otlp: - endpoint: oap-service:11800 - tls: - insecure: true - logging: - loglevel: debug - - service: - pipelines: - metrics: - receivers: [awscontainerinsightreceiver] - processors: [resource/job-name] - exporters: [otlp,logging] - extensions: [health_check] ---- -# AWS OTEL DaemonSet -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: aws-otel-eks-ci - namespace: aws-otel-eks -spec: - selector: - matchLabels: - name: aws-otel-eks-ci - template: - metadata: - labels: - name: aws-otel-eks-ci - spec: - containers: - - name: aws-otel-collector - image: amazon/aws-otel-collector:v0.23.0 - env: - # Specify aws region - - name: AWS_REGION - value: "ap-northeast-1" - - name: K8S_NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - - name: HOST_IP - valueFrom: - fieldRef: - fieldPath: status.hostIP - - name: HOST_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - - name: K8S_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - imagePullPolicy: Always - command: - - "/awscollector" - - "--config=/conf/otel-agent-config.yaml" - volumeMounts: - - name: rootfs - mountPath: /rootfs - readOnly: true - - name: dockersock - mountPath: /var/run/docker.sock - readOnly: true - - name: varlibdocker - mountPath: /var/lib/docker - readOnly: true - - name: containerdsock - mountPath: /run/containerd/containerd.sock - readOnly: true - - name: sys - mountPath: /sys - readOnly: true - - name: devdisk - mountPath: /dev/disk - readOnly: true - - name: otel-agent-config-vol - mountPath: /conf - - name: otel-output-vol - mountPath: /otel-output - resources: - limits: - cpu: 200m - memory: 200Mi - requests: - cpu: 200m - memory: 200Mi - volumes: - - configMap: - name: otel-agent-conf - items: - - key: otel-agent-config - path: otel-agent-config.yaml - name: otel-agent-config-vol - - name: rootfs - hostPath: - path: / - - name: dockersock - hostPath: - path: /var/run/docker.sock - - name: varlibdocker - hostPath: - path: /var/lib/docker - - name: containerdsock - hostPath: - path: /run/containerd/containerd.sock - - name: sys - hostPath: - path: /sys - - name: devdisk - hostPath: - path: /dev/disk/ - - name: otel-output-vol - hostPath: - path: /otel-output - serviceAccountName: aws-otel-sa +extensions: + health_check: +receivers: + awscontainerinsightreceiver: +processors: + resource/job-name: + attributes: + - key: job_name + value: aws-cloud-eks-monitoring + action: insert +exporters: + otlp: + endpoint: oap-service:11800 + tls: + insecure: true + logging: + loglevel: debug +service: + pipelines: + metrics: + receivers: [awscontainerinsightreceiver] + processors: [resource/job-name] + exporters: [otlp,logging] + extensions: [health_check] ``` -Refer to [ContainerInsights](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContainerInsights.html) for more information +Refer to [AWS Container Insights Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/awscontainerinsightreceiver/README.md) for more information