diff --git a/CHANGES.md b/CHANGES.md index b9152c22cc..e4ffa9da0e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ Release Notes. * Fix potential NPE in OAL string match and a bug when right-hand-side variable includes double quotes. * Bump up Armeria version to fix CVE. * Polish ETCD cluster config environment variables. +* Add the analysis of metrics in Satellite MetricsService. #### UI diff --git a/oap-server/server-starter/src/main/resources/meter-analyzer-config/satellite.yaml b/oap-server/server-starter/src/main/resources/meter-analyzer-config/satellite.yaml new file mode 100644 index 0000000000..0222bf1f87 --- /dev/null +++ b/oap-server/server-starter/src/main/resources/meter-analyzer-config/satellite.yaml @@ -0,0 +1,34 @@ +# 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. + +expSuffix: tag({tags -> tags.service = 'satellite::' + tags.service}).instance(['service'], ['instance']) +metricPrefix: satellite +metricsRules: + - name: instance_receive_event_count + exp: sw_stl_gatherer_receive_count.sum(["pipe", "status", "service", "instance"]).increase("PT1M") + - name: instance_fetch_event_count + exp: sw_stl_gatherer_fetch_count.sum(["pipe", "status", "service", "instance"]).increase("PT1M") + - name: instance_queue_input_count + exp: sw_stl_queue_output_count.sum(["pipe", "status", "service", "instance"]).increase("PT1M") + - name: instance_send_event_count + exp: sw_stl_sender_output_count.sum(["pipe", "status", "service", "instance"]).increase("PT1M") + - name: instance_queue_total_capacity + exp: sw_stl_pipeline_queue_total_capacity.sum(["pipeline", "service", "instance"]) + - name: instance_queue_used_count + exp: sw_stl_pipeline_queue_partition_size.sum(["pipeline", "service", "instance"]) + - name: instance_server_cpu_utilization + exp: sw_stl_grpc_server_cpu_gauge + - name: instance_grpc_connect_count + exp: sw_stl_grpc_server_connection_count \ No newline at end of file diff --git a/test/e2e-v2/cases/kafka/log/satellite_config.yaml b/test/e2e-v2/cases/kafka/log/satellite_config.yaml index 01aca88f45..a282b70403 100644 --- a/test/e2e-v2/cases/kafka/log/satellite_config.yaml +++ b/test/e2e-v2/cases/kafka/log/satellite_config.yaml @@ -24,6 +24,7 @@ telemetry: cluster: cluster1 service: service1 instance: instance1 + export_type: none sharing: common_config: diff --git a/test/e2e-v2/cases/satellite/Dockerfile.satellite b/test/e2e-v2/cases/satellite/Dockerfile.satellite index 43865f126b..583c862ffc 100644 --- a/test/e2e-v2/cases/satellite/Dockerfile.satellite +++ b/test/e2e-v2/cases/satellite/Dockerfile.satellite @@ -21,4 +21,4 @@ FROM alpine:3.10 COPY --from=base /skywalking-satellite /sw-satellite COPY --from=base /skywalking/configs /skywalking/ -ENTRYPOINT ["/sw-satellite", "start", "--config", "/skywalking/configs/satellite_config.yaml"] \ No newline at end of file +ENTRYPOINT ["/sw-satellite", "start", "--config", "/skywalking/satellite_config.yaml"] \ No newline at end of file diff --git a/test/e2e-v2/cases/satellite/native-protocols/docker-compose.yml b/test/e2e-v2/cases/satellite/native-protocols/docker-compose.yml index b427ca9d14..6b2306ae80 100644 --- a/test/e2e-v2/cases/satellite/native-protocols/docker-compose.yml +++ b/test/e2e-v2/cases/satellite/native-protocols/docker-compose.yml @@ -67,8 +67,7 @@ services: SATELLITE_GRPC_CLIENT: oap:11800 SATELLITE_LOGPIPE_SENDER_MIN_FLUSH_EVENTS: 1 SW_AGENT_SATELLITE_COMMIT: ${SW_AGENT_SATELLITE_COMMIT} - volumes: - - ./satellite_config.yaml:/skywalking/configs/satellite_config.yaml + SATELLITE_GRPC_ACCEPT_LIMIT_CPU_UTILIZATION: 100 networks: - e2e healthcheck: diff --git a/test/e2e-v2/cases/satellite/native-protocols/e2e.yaml b/test/e2e-v2/cases/satellite/native-protocols/e2e.yaml index 20a7afde8a..4fb4c7ca01 100644 --- a/test/e2e-v2/cases/satellite/native-protocols/e2e.yaml +++ b/test/e2e-v2/cases/satellite/native-protocols/e2e.yaml @@ -76,7 +76,7 @@ verify: expected: expected/trace-info-detail.yml # native meter: instance meter - - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name meter_jvm_classes_loaded --instance-name=provider1 --service-name=e2e-service-provider |yq e 'to_entries' - + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name meter_jvm_memory_used --instance-name=provider1 --service-name=e2e-service-provider |yq e 'to_entries' - expected: expected/metrics-has-value.yml # native event: event list diff --git a/test/e2e-v2/cases/satellite/native-protocols/satellite_config.yaml b/test/e2e-v2/cases/satellite/native-protocols/satellite_config.yaml deleted file mode 100644 index b61c265a8a..0000000000 --- a/test/e2e-v2/cases/satellite/native-protocols/satellite_config.yaml +++ /dev/null @@ -1,249 +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. -# - -# The logger configuration. -logger: - # The log format pattern configuration. - log_pattern: ${SATELLITE_LOGGER_LOG_PATTERN:%time [%level][%field] - %msg} - # The time format pattern configuration. - time_pattern: ${SATELLITE_LOGGER_TIME_PATTERN:2006-01-02 15:04:05.000} - # The lowest level of printing allowed. - level: ${SATELLITE_LOGGER_LEVEL:info} - -# The Satellite self telemetry configuration. -telemetry: - # The space concept for the deployment, such as the namespace concept in the Kubernetes. - cluster: ${SATELLITE_TELEMETRY_CLUSTER:satellite-cluster} - # The group concept for the deployment, such as the service resource concept in the Kubernetes. - service: ${SATELLITE_TELEMETRY_SERVICE:satellite-service} - # The minimum running unit, such as the pod concept in the Kubernetes. - instance: ${SATELLITE_TELEMETRY_SERVICE:satellite-instance} - -# The sharing plugins referenced by the specific plugins in the different pipes. -sharing: - clients: - - plugin_name: "grpc-client" - # The gRPC server address (default localhost:11800). - server_addr: ${SATELLITE_GRPC_CLIENT:127.0.0.1:11800} - # The TLS switch - enable_TLS: ${SATELLITE_GRPC_ENABLE_TLS:false} - # The file path of client.pem. The config only works when opening the TLS switch. - client_pem_path: ${SATELLITE_GRPC_CLIENT_PEM_PATH:"client.pem"} - # The file path of client.key. The config only works when opening the TLS switch. - client_key_path: ${SATELLITE_GRPC_CLIENT_KEY_PATH:"client.key"} - # InsecureSkipVerify controls whether a client verifies the server's certificate chain and host name. - insecure_skip_verify: ${SATELLITE_GRPC_INSECURE_SKIP_VERIFY:false} - # The file path oca.pem. The config only works when opening the TLS switch. - ca_pem_path: ${SATELLITE_grpc_CA_PEM_PATH:"ca.pem"} - # How frequently to check the connection(second) - check_period: ${SATELLITE_GRPC_CHECK_PERIOD:5} - # The auth value when send request - authentication: ${SATELLITE_GRPC_AUTHENTICATION:""} - servers: - - plugin_name: "grpc-server" - # The address of grpc server. - address: ${SATELLITE_GRPC_ADDRESS:":11800"} - # The TLS cert file path. - tls_cert_file: ${SATELLITE_GRPC_TLS_KEY_FILE:""} - # The TLS key file path. - tls_key_file: ${SATELLITE_GRPC_TLS_KEY_FILE:""} - - plugin_name: "prometheus-server" - # The prometheus server address. - address: ${SATELLITE_PROMETHEUS_ADDRESS:":1234"} - # The prometheus server metrics endpoint. - endpoint: ${SATELLITE_PROMETHEUS_ENDPOINT:"/metrics"} - -# The working pipe configurations. -pipes: - - common_config: - pipe_name: logpipe - gatherer: - server_name: "grpc-server" - receiver: - plugin_name: "grpc-nativelog-receiver" - queue: - plugin_name: "memory-queue" - # The maximum buffer event size. - event_buffer_size: ${SATELLITE_QUEUE_EVENT_BUFFER_SIZE:5000} - processor: - filters: - sender: - fallbacker: - plugin_name: none-fallbacker - # The time interval between two flush operations. And the time unit is millisecond. - flush_time: ${SATELLITE_LOGPIPE_SENDER_FLUSH_TIME:1000} - # The maximum buffer elements. - max_buffer_size: ${SATELLITE_LOGPIPE_SENDER_MAX_BUFFER_SIZE:200} - # The minimum flush elements. - min_flush_events: ${SATELLITE_LOGPIPE_SENDER_MIN_FLUSH_EVENTS:100} - client_name: grpc-client - forwarders: - - plugin_name: nativelog-grpc-forwarder - - common_config: - pipe_name: managementpipe - gatherer: - server_name: "grpc-server" - receiver: - plugin_name: "grpc-nativemanagement-receiver" - queue: - plugin_name: "memory-queue" - # The maximum buffer event size. - event_buffer_size: ${SATELLITE_QUEUE_EVENT_BUFFER_SIZE:5000} - processor: - filters: - sender: - fallbacker: - plugin_name: none-fallbacker - # The time interval between two flush operations. And the time unit is millisecond. - flush_time: ${SATELLITE_LOGMANAGEMENT_SENDER_FLUSH_TIME:1000} - # The maximum buffer elements. - max_buffer_size: ${SATELLITE_LOGMANAGEMENT_SENDER_MAX_BUFFER_SIZE:20} - # The minimum flush elements. - min_flush_events: ${SATELLITE_LOGMANAGEMENT_SENDER_MIN_FLUSH_EVENTS:1} - client_name: grpc-client - forwarders: - - plugin_name: nativemanagement-grpc-forwarder - - common_config: - pipe_name: tracingpipe - gatherer: - server_name: "grpc-server" - receiver: - plugin_name: "grpc-nativetracing-receiver" - queue: - plugin_name: "memory-queue" - # The maximum buffer event size. - event_buffer_size: ${SATELLITE_QUEUE_EVENT_BUFFER_SIZE:5000} - processor: - filters: - sender: - fallbacker: - plugin_name: none-fallbacker - # The time interval between two flush operations. And the time unit is millisecond. - flush_time: ${SATELLITE_TRACINGPIPE_SENDER_FLUSH_TIME:1000} - # The maximum buffer elements. - max_buffer_size: ${SATELLITE_TRACINGPIPE_SENDER_MAX_BUFFER_SIZE:200} - # The minimum flush elements. - min_flush_events: ${SATELLITE_TRACINGPIPE_SENDER_MIN_FLUSH_EVENTS:1} - client_name: grpc-client - forwarders: - - plugin_name: nativetracing-grpc-forwarder - - common_config: - pipe_name: profilepipe - gatherer: - server_name: "grpc-server" - receiver: - plugin_name: "grpc-nativeprofile-receiver" - queue: - plugin_name: "memory-queue" - # The maximum buffer event size. - event_buffer_size: ${SATELLITE_QUEUE_EVENT_BUFFER_SIZE:5000} - processor: - filters: - sender: - fallbacker: - plugin_name: none-fallbacker - # The time interval between two flush operations. And the time unit is millisecond. - flush_time: ${SATELLITE_PROFILEPIPE_SENDER_FLUSH_TIME:1000} - # The maximum buffer elements. - max_buffer_size: ${SATELLITE_PROFILEPIPE_SENDER_MAX_BUFFER_SIZE:200} - # The minimum flush elements. - min_flush_events: ${SATELLITE_PROFILEPIPE_SENDER_MIN_FLUSH_EVENTS:1} - client_name: grpc-client - forwarders: - - plugin_name: nativeprofile-grpc-forwarder - - common_config: - pipe_name: cdspipe - gatherer: - server_name: "grpc-server" - receiver: - plugin_name: "grpc-nativecds-receiver" - queue: - plugin_name: "none-queue" - processor: - filters: - sender: - fallbacker: - plugin_name: none-fallbacker - client_name: grpc-client - forwarders: - - plugin_name: nativecds-grpc-forwarder - - common_config: - pipe_name: eventpipe - gatherer: - server_name: "grpc-server" - receiver: - plugin_name: "grpc-nativeevent-receiver" - queue: - plugin_name: "memory-queue" - processor: - filters: - sender: - fallbacker: - plugin_name: none-fallbacker - # The time interval between two flush operations. And the time unit is millisecond. - flush_time: ${SATELLITE_EVENTPIPE_SENDER_FLUSH_TIME:1000} - # The maximum buffer elements. - max_buffer_size: ${SATELLITE_EVENTPIPE_SENDER_MAX_BUFFER_SIZE:200} - # The minimum flush elements. - min_flush_events: ${SATELLITE_EVENTPIPE_SENDER_MIN_FLUSH_EVENTS:1} - client_name: grpc-client - forwarders: - - plugin_name: nativeevent-grpc-forwarder - - common_config: - pipe_name: jvmpipe - gatherer: - server_name: "grpc-server" - receiver: - plugin_name: "grpc-nativejvm-receiver" - queue: - plugin_name: "memory-queue" - processor: - filters: - sender: - fallbacker: - plugin_name: none-fallbacker - # The time interval between two flush operations. And the time unit is millisecond. - flush_time: ${SATELLITE_JVMPIPE_SENDER_FLUSH_TIME:1000} - # The maximum buffer elements. - max_buffer_size: ${SATELLITE_JVMPIPE_SENDER_MAX_BUFFER_SIZE:200} - # The minimum flush elements. - min_flush_events: ${SATELLITE_JVMPIPE_SENDER_MIN_FLUSH_EVENTS:1} - client_name: grpc-client - forwarders: - - plugin_name: nativejvm-grpc-forwarder - - common_config: - pipe_name: meterpipe - gatherer: - server_name: "grpc-server" - receiver: - plugin_name: "grpc-nativemeter-receiver" - queue: - plugin_name: "memory-queue" - processor: - filters: - sender: - fallbacker: - plugin_name: none-fallbacker - # The time interval between two flush operations. And the time unit is millisecond. - flush_time: ${SATELLITE_METERPIPE_SENDER_FLUSH_TIME:1000} - # The maximum buffer elements. - max_buffer_size: ${SATELLITE_METERPIPE_SENDER_MAX_BUFFER_SIZE:200} - # The minimum flush elements. - min_flush_events: ${SATELLITE_METERPIPE_SENDER_MIN_FLUSH_EVENTS:1} - client_name: grpc-client - forwarders: - - plugin_name: nativemeter-grpc-forwarder diff --git a/test/e2e-v2/cases/so11y/docker-compose.yml b/test/e2e-v2/cases/so11y/docker-compose.yml index dfcbb49d2e..ba86f2c179 100644 --- a/test/e2e-v2/cases/so11y/docker-compose.yml +++ b/test/e2e-v2/cases/so11y/docker-compose.yml @@ -23,6 +23,7 @@ services: environment: SW_PROMETHEUS_FETCHER: "default" SW_TELEMETRY: prometheus + SW_METER_ANALYZER_ACTIVE_FILES: satellite ports: - 12800 @@ -32,9 +33,13 @@ services: service: provider ports: - 9090 + environment: + SW_AGENT_COLLECTOR_BACKEND_SERVICES: satellite:11800 depends_on: oap: condition: service_healthy + satellite: + condition: service_healthy consumer: extends: @@ -42,9 +47,38 @@ services: service: consumer ports: - 9092 + environment: + SW_AGENT_COLLECTOR_BACKEND_SERVICES: satellite:11800 depends_on: provider: condition: service_healthy + satellite: + build: + context: ../satellite + dockerfile: Dockerfile.satellite + args: + - SW_AGENT_SATELLITE_COMMIT=${SW_AGENT_SATELLITE_COMMIT} + expose: + - 11800 + environment: + SATELLITE_GRPC_CLIENT: oap:11800 + SATELLITE_LOGPIPE_SENDER_MIN_FLUSH_EVENTS: 1 + SW_AGENT_SATELLITE_COMMIT: ${SW_AGENT_SATELLITE_COMMIT} + SATELLITE_TELEMETRY_EXPORT_TYPE: metrics_service + SATELLITE_TELEMETRY_METRICS_SERVICE_INTERVAL: 2 + SATELLITE_GRPC_ACCEPT_LIMIT_CPU_UTILIZATION: 100 + SATELLITE_TELEMETRY_METRICS_SERVICE_METRIC_PREFIX: sw_stl_ + networks: + - e2e + healthcheck: + test: [ "CMD", "sh", "-c", "nc -zn 127.0.0.1 11800" ] + interval: 5s + timeout: 60s + retries: 120 + depends_on: + oap: + condition: service_healthy + networks: e2e: diff --git a/test/e2e-v2/cases/so11y/e2e.yaml b/test/e2e-v2/cases/so11y/e2e.yaml index 6adde1cd92..6185f90805 100644 --- a/test/e2e-v2/cases/so11y/e2e.yaml +++ b/test/e2e-v2/cases/so11y/e2e.yaml @@ -43,4 +43,5 @@ verify: cases: - includes: - so11y-cases.yaml + - satellite-cases.yaml diff --git a/test/e2e-v2/cases/so11y/expected/satellite-service-instance.yml b/test/e2e-v2/cases/so11y/expected/satellite-service-instance.yml new file mode 100644 index 0000000000..049b017fdf --- /dev/null +++ b/test/e2e-v2/cases/so11y/expected/satellite-service-instance.yml @@ -0,0 +1,24 @@ +# Licensed to 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. Apache Software Foundation (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 "satellite::satellite-service" }}.1_{{ b64enc "satellite-instance" }} + name: satellite-instance + attributes: [] + language: UNKNOWN + instanceuuid: {{ b64enc "satellite::satellite-service" }}.1_{{ b64enc "satellite-instance" }} +{{- end}} \ No newline at end of file diff --git a/test/e2e-v2/cases/so11y/expected/satellite-service.yml b/test/e2e-v2/cases/so11y/expected/satellite-service.yml new file mode 100644 index 0000000000..13cf8cd67c --- /dev/null +++ b/test/e2e-v2/cases/so11y/expected/satellite-service.yml @@ -0,0 +1,20 @@ +# 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 "satellite::satellite-service" }}.1 + name: satellite::satellite-service + group: "" +{{- end }} \ No newline at end of file diff --git a/test/e2e-v2/cases/so11y/satellite-cases.yaml b/test/e2e-v2/cases/so11y/satellite-cases.yaml new file mode 100644 index 0000000000..a381a6ca71 --- /dev/null +++ b/test/e2e-v2/cases/so11y/satellite-cases.yaml @@ -0,0 +1,27 @@ +# 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. + + cases: + # service list + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls + expected: expected/satellite-service.yml + # service instance list + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql instance list --service-name=satellite::satellite-service + expected: expected/satellite-service-instance.yml + # service instance metrics + - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=satellite_instance_server_cpu_utilization --instance-name=satellite-instance --service-name=satellite::satellite-service |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=satellite_instance_grpc_connect_count --instance-name=satellite-instance --service-name=satellite::satellite-service |yq e 'to_entries' - + expected: expected/metrics-has-value.yml \ No newline at end of file diff --git a/test/e2e-v2/script/env b/test/e2e-v2/script/env index b08c955fbe..e3c2aee459 100644 --- a/test/e2e-v2/script/env +++ b/test/e2e-v2/script/env @@ -14,7 +14,7 @@ # limitations under the License. SW_AGENT_JAVA_COMMIT=fbdfc42b4d825ba33205d646ddaaaad20c005cb8 -SW_AGENT_SATELLITE_COMMIT=1f3c08a5af19f8522f2a40d9339c45fa816bfe07 +SW_AGENT_SATELLITE_COMMIT=1987e1d566ac90f6b58a45fd9bfa27bf8faad635 SW_AGENT_NGINX_LUA_COMMIT=c3cee4841798a147d83b96a10914d4ac0e11d0aa SW_AGENT_NODEJS_COMMIT=e755659c7f308d3b5589619778c8360308cb14f8 SW_AGENT_GO_COMMIT=4af380c2db6243106b0fc650b6003ce3b3eb82a0