Skip to content

Commit

Permalink
enable e2e test for pvm
Browse files Browse the repository at this point in the history
  • Loading branch information
jiang1997 committed Oct 2, 2022
1 parent aab88f1 commit d09adf8
Show file tree
Hide file tree
Showing 7 changed files with 584 additions and 11 deletions.
9 changes: 0 additions & 9 deletions skywalking/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,6 @@ def __init_threading():
__meter_report_thread = Thread(name='MeterReportThread', target=__report_meter, daemon=True)
__meter_report_thread.start()

if config.pvm_meter_reporter_active:
from skywalking.meter.pvm.cpu_usage import CPUUsageDataSource
from skywalking.meter.pvm.gc_data import GCDataSource
from skywalking.meter.pvm.mem_usage import MEMUsageDataSource

MEMUsageDataSource().registry()
CPUUsageDataSource().registry()
GCDataSource().registry()

if config.log_reporter_active:
__log_queue = Queue(maxsize=config.log_reporter_max_buffer_size)
__log_report_thread = Thread(name='LogReportThread', target=__report_log, daemon=True)
Expand Down
11 changes: 11 additions & 0 deletions skywalking/meter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

from skywalking import config

_meter_service = None


Expand All @@ -27,3 +29,12 @@ def init():

_meter_service = MeterService()
_meter_service.start()

if config.pvm_meter_reporter_active:
from skywalking.meter.pvm.cpu_usage import CPUUsageDataSource
from skywalking.meter.pvm.gc_data import GCDataSource
from skywalking.meter.pvm.mem_usage import MEMUsageDataSource

MEMUsageDataSource().registry()
CPUUsageDataSource().registry()
GCDataSource().registry()
16 changes: 16 additions & 0 deletions skywalking/meter/pvm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# 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.
#
5 changes: 5 additions & 0 deletions tests/e2e/base/docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ services:
expose:
- 11800 # gRPC
- 12800 # HTTP
volumes: # only for temporary use and should be removed after related backend PR accepted
- ./tmp/python.yaml:/skywalking/config/meter-analyzer-config/python.yaml
- ./tmp/application.yml:/skywalking/config/application.yml
networks:
- e2e
healthcheck: # python base image has no nc command
Expand All @@ -46,6 +49,8 @@ services:
SW_AGENT_LOG_REPORTER_ACTIVE: "True"
SW_AGENT_LOG_REPORTER_LEVEL: WARNING
SW_AGENT_LOG_REPORTER_SAFE_MODE: "True"
SW_AGENT_METER_REPORTER_ACTIVE: "True"
SW_AGENT_PVM_METER_REPORTER_ACTIVE: "True"
healthcheck:
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9090" ]
interval: 5s
Expand Down
514 changes: 514 additions & 0 deletions tests/e2e/base/tmp/application.yml

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions tests/e2e/base/tmp/python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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: instance(['service'], ['instance'], Layer.GENERAL)
metricPrefix: meter
metricsRules:
- name: process_cpu_utilization
exp: process_cpu_utilization
- name: process_mem_utilization
exp: process_mem_utilization
- name: total_cpu_utilization
exp: total_cpu_utilization
- name: total_mem_utilization
exp: total_mem_utilization
- name: gc_g0
exp: gc_g0
- name: gc_g1
exp: gc_g1
- name: gc_g2
exp: gc_g2
- name: gc_time
exp: gc_time
- name: thread_active_count
exp: thread_active_count
4 changes: 2 additions & 2 deletions tests/e2e/case/grpc/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ verify:
# TODO: Metric Collection Implementation is not merged https://github.com/apache/skywalking/issues/7084
# service instance pvm metrics TODO: PVM Collection Implementation needed https://github.com/apache/skywalking/issues/5944
# swctl --display yaml --base-url=http://localhost:12800/graphql metrics linear --name instance_jvm_thread_live_count --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 instance_jvm_thread_live_count --instance-name=provider1 --service-name=e2e-service-provider |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 meter_total_cpu_utilization --instance-name=provider1 --service-name=e2e-service-provider |yq e 'to_entries' -
expected: ../expected/metrics-has-value.yml

# trace segment list
- query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql trace ls
Expand Down

0 comments on commit d09adf8

Please sign in to comment.