skywalking 0.0.0.alpha → 0.0.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.dockerignore +19 -0
- data/.github/PULL_REQUEST_TEMPLATE +42 -0
- data/.github/workflows/ci.yml +70 -0
- data/.github/workflows/e2e.yml +73 -0
- data/.gitignore +80 -0
- data/.gitmodules +18 -0
- data/.licenserc.yaml +36 -0
- data/.rspec +1 -2
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +20 -0
- data/NOTICE +1 -1
- data/README.md +3 -0
- data/docs/README.md +7 -0
- data/docs/en/agent/plugins.md +12 -0
- data/docs/{How-to-release.md → en/development-and-contribution/how-to-release.md} +6 -5
- data/docs/en/setup/quick-start.md +106 -0
- data/docs/menu.yml +31 -0
- data/lib/rails/generators/skywalking/start_generator.rb +47 -0
- data/{examples/rails-demo/config/initializers/skywalking_ruby.rb → lib/rails/generators/skywalking/templates/skywalking_initializer.rb} +0 -2
- data/lib/skywalking/agent.rb +5 -5
- data/lib/skywalking/configuration.rb +55 -34
- data/lib/skywalking/environment.rb +103 -11
- data/lib/skywalking/log/logger.rb +1 -1
- data/lib/skywalking/plugins/elasticsearch.rb +61 -0
- data/lib/skywalking/plugins/memcached.rb +74 -0
- data/lib/skywalking/plugins/net_http.rb +73 -0
- data/lib/skywalking/plugins/redis5.rb +8 -3
- data/lib/skywalking/plugins/sinatra.rb +6 -5
- data/lib/skywalking/plugins_manager.rb +1 -1
- data/lib/skywalking/reporter/buffer_trigger.rb +1 -1
- data/lib/skywalking/reporter/client/grpc_client.rb +2 -2
- data/lib/skywalking/reporter/report.rb +1 -1
- data/lib/skywalking/tracing/carrier.rb +9 -8
- data/lib/skywalking/tracing/constants.rb +13 -18
- data/lib/skywalking/tracing/exit_span.rb +1 -1
- data/lib/skywalking/tracing/noop_span.rb +1 -1
- data/lib/skywalking/tracing/segment.rb +1 -1
- data/lib/skywalking/tracing/span.rb +2 -1
- data/lib/skywalking/tracing/span_context.rb +6 -6
- data/lib/skywalking/tracing/tag.rb +50 -1
- data/lib/skywalking/version.rb +1 -1
- data/skywalking.gemspec +58 -0
- data/spec/fixtures/agent.yaml +33 -0
- data/spec/scenarios/common/Dockerfile.agent +26 -0
- data/spec/scenarios/common/base-compose.yml +46 -0
- data/spec/scenarios/common/common_spec_helper.rb +40 -0
- data/spec/scenarios/common/compose_context.rb +39 -0
- data/spec/scenarios/common/validator.rb +41 -0
- data/spec/scenarios/elasticsearch/docker-compose.yml +72 -0
- data/spec/scenarios/elasticsearch/elasticsearch.rb +54 -0
- data/spec/scenarios/elasticsearch/elasticsearch_spec.rb +29 -0
- data/spec/scenarios/elasticsearch/expected.yml +94 -0
- data/spec/scenarios/memcached/docker-compose.yml +67 -0
- data/spec/scenarios/memcached/expected.yml +81 -0
- data/spec/scenarios/memcached/memcached.rb +31 -0
- data/spec/scenarios/memcached/memcached_spec.rb +29 -0
- data/spec/scenarios/net_http/docker-compose.yml +49 -0
- data/spec/scenarios/net_http/expected.yml +39 -0
- data/spec/scenarios/net_http/net_http.rb +33 -0
- data/spec/scenarios/net_http/net_http_spec.rb +43 -0
- data/spec/scenarios/redis/docker-compose.yml +67 -0
- data/spec/scenarios/redis/expected.yml +66 -0
- data/{examples/sinatra-demo/sinatra-demo.rb → spec/scenarios/redis/redis.rb} +8 -10
- data/spec/scenarios/redis/redis_spec.rb +29 -0
- data/spec/scenarios/sinatra/docker-compose.yml +54 -0
- data/spec/scenarios/sinatra/expected.yml +38 -0
- data/spec/scenarios/sinatra/sinatra.rb +26 -0
- data/spec/scenarios/sinatra/sinatra_spec.rb +29 -0
- data/spec/skywalking/config_spec.rb +41 -0
- data/spec/skywalking/utils/id_gen_spec.rb +26 -0
- data/spec/spec_helper.rb +115 -0
- metadata +102 -143
- data/examples/rails-demo/.dockerignore +0 -47
- data/examples/rails-demo/.gitattributes +0 -9
- data/examples/rails-demo/.gitignore +0 -34
- data/examples/rails-demo/.kamal/hooks/docker-setup.sample +0 -3
- data/examples/rails-demo/.kamal/hooks/post-deploy.sample +0 -14
- data/examples/rails-demo/.kamal/hooks/post-proxy-reboot.sample +0 -3
- data/examples/rails-demo/.kamal/hooks/pre-build.sample +0 -51
- data/examples/rails-demo/.kamal/hooks/pre-connect.sample +0 -47
- data/examples/rails-demo/.kamal/hooks/pre-deploy.sample +0 -109
- data/examples/rails-demo/.kamal/hooks/pre-proxy-reboot.sample +0 -3
- data/examples/rails-demo/.kamal/secrets +0 -17
- data/examples/rails-demo/.rubocop.yml +0 -8
- data/examples/rails-demo/.ruby-version +0 -1
- data/examples/rails-demo/Dockerfile +0 -72
- data/examples/rails-demo/Gemfile +0 -64
- data/examples/rails-demo/README.md +0 -24
- data/examples/rails-demo/Rakefile +0 -6
- data/examples/rails-demo/app/assets/images/.keep +0 -0
- data/examples/rails-demo/app/assets/stylesheets/application.css +0 -10
- data/examples/rails-demo/app/controllers/application_controller.rb +0 -4
- data/examples/rails-demo/app/controllers/concerns/.keep +0 -0
- data/examples/rails-demo/app/helpers/application_helper.rb +0 -2
- data/examples/rails-demo/app/javascript/application.js +0 -3
- data/examples/rails-demo/app/javascript/controllers/application.js +0 -9
- data/examples/rails-demo/app/javascript/controllers/hello_controller.js +0 -7
- data/examples/rails-demo/app/javascript/controllers/index.js +0 -4
- data/examples/rails-demo/app/jobs/application_job.rb +0 -7
- data/examples/rails-demo/app/mailers/application_mailer.rb +0 -4
- data/examples/rails-demo/app/models/application_record.rb +0 -3
- data/examples/rails-demo/app/models/concerns/.keep +0 -0
- data/examples/rails-demo/app/views/layouts/application.html.erb +0 -28
- data/examples/rails-demo/app/views/layouts/mailer.html.erb +0 -13
- data/examples/rails-demo/app/views/layouts/mailer.text.erb +0 -1
- data/examples/rails-demo/app/views/pwa/manifest.json.erb +0 -22
- data/examples/rails-demo/app/views/pwa/service-worker.js +0 -26
- data/examples/rails-demo/bin/brakeman +0 -7
- data/examples/rails-demo/bin/bundle +0 -109
- data/examples/rails-demo/bin/dev +0 -2
- data/examples/rails-demo/bin/docker-entrypoint +0 -14
- data/examples/rails-demo/bin/importmap +0 -4
- data/examples/rails-demo/bin/jobs +0 -6
- data/examples/rails-demo/bin/kamal +0 -27
- data/examples/rails-demo/bin/rails +0 -4
- data/examples/rails-demo/bin/rake +0 -4
- data/examples/rails-demo/bin/rubocop +0 -8
- data/examples/rails-demo/bin/setup +0 -34
- data/examples/rails-demo/bin/thrust +0 -5
- data/examples/rails-demo/config/application.rb +0 -27
- data/examples/rails-demo/config/boot.rb +0 -4
- data/examples/rails-demo/config/cable.yml +0 -17
- data/examples/rails-demo/config/cache.yml +0 -16
- data/examples/rails-demo/config/credentials.yml.enc +0 -1
- data/examples/rails-demo/config/database.yml +0 -41
- data/examples/rails-demo/config/deploy.yml +0 -116
- data/examples/rails-demo/config/environment.rb +0 -5
- data/examples/rails-demo/config/environments/development.rb +0 -72
- data/examples/rails-demo/config/environments/production.rb +0 -90
- data/examples/rails-demo/config/environments/test.rb +0 -53
- data/examples/rails-demo/config/importmap.rb +0 -7
- data/examples/rails-demo/config/initializers/assets.rb +0 -7
- data/examples/rails-demo/config/initializers/content_security_policy.rb +0 -25
- data/examples/rails-demo/config/initializers/filter_parameter_logging.rb +0 -8
- data/examples/rails-demo/config/initializers/inflections.rb +0 -16
- data/examples/rails-demo/config/locales/en.yml +0 -31
- data/examples/rails-demo/config/puma.rb +0 -41
- data/examples/rails-demo/config/queue.yml +0 -18
- data/examples/rails-demo/config/recurring.yml +0 -10
- data/examples/rails-demo/config/routes.rb +0 -14
- data/examples/rails-demo/config/storage.yml +0 -34
- data/examples/rails-demo/config.ru +0 -6
- data/examples/rails-demo/db/cable_schema.rb +0 -11
- data/examples/rails-demo/db/cache_schema.rb +0 -14
- data/examples/rails-demo/db/queue_schema.rb +0 -129
- data/examples/rails-demo/db/seeds.rb +0 -9
- data/examples/rails-demo/lib/tasks/.keep +0 -0
- data/examples/rails-demo/log/.keep +0 -0
- data/examples/rails-demo/public/400.html +0 -114
- data/examples/rails-demo/public/404.html +0 -114
- data/examples/rails-demo/public/406-unsupported-browser.html +0 -114
- data/examples/rails-demo/public/422.html +0 -114
- data/examples/rails-demo/public/500.html +0 -114
- data/examples/rails-demo/public/icon.png +0 -0
- data/examples/rails-demo/public/icon.svg +0 -3
- data/examples/rails-demo/public/robots.txt +0 -1
- data/examples/rails-demo/script/.keep +0 -0
- data/examples/rails-demo/storage/.keep +0 -0
- data/examples/rails-demo/test/application_system_test_case.rb +0 -5
- data/examples/rails-demo/test/controllers/.keep +0 -0
- data/examples/rails-demo/test/fixtures/files/.keep +0 -0
- data/examples/rails-demo/test/helpers/.keep +0 -0
- data/examples/rails-demo/test/integration/.keep +0 -0
- data/examples/rails-demo/test/mailers/.keep +0 -0
- data/examples/rails-demo/test/models/.keep +0 -0
- data/examples/rails-demo/test/system/.keep +0 -0
- data/examples/rails-demo/test/test_helper.rb +0 -15
- data/examples/rails-demo/tmp/.keep +0 -0
- data/examples/rails-demo/tmp/pids/.keep +0 -0
- data/examples/rails-demo/tmp/storage/.keep +0 -0
- data/examples/rails-demo/vendor/.keep +0 -0
- data/examples/rails-demo/vendor/javascript/.keep +0 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
# contributor license agreements. See the NOTICE file distributed with
|
4
|
+
# this work for additional information regarding copyright ownership.
|
5
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
# (the "License"); you may not use this file except in compliance with
|
7
|
+
# the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
version: "2.1"
|
19
|
+
|
20
|
+
services:
|
21
|
+
oap:
|
22
|
+
extends:
|
23
|
+
file: ../common/base-compose.yml
|
24
|
+
service: oap
|
25
|
+
networks:
|
26
|
+
- gem
|
27
|
+
|
28
|
+
elasticsearch:
|
29
|
+
image: elasticsearch:8.0.0
|
30
|
+
hostname: elasticsearch
|
31
|
+
ports:
|
32
|
+
- "9200:9200"
|
33
|
+
environment:
|
34
|
+
- discovery.type=single-node
|
35
|
+
- bootstrap.memory_lock=true
|
36
|
+
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
37
|
+
- xpack.security.enabled=false
|
38
|
+
networks:
|
39
|
+
- gem
|
40
|
+
healthcheck:
|
41
|
+
test: [ "CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1" ]
|
42
|
+
interval: 5s
|
43
|
+
timeout: 60s
|
44
|
+
retries: 120
|
45
|
+
|
46
|
+
service:
|
47
|
+
extends:
|
48
|
+
file: ../common/base-compose.yml
|
49
|
+
service: agent
|
50
|
+
ports:
|
51
|
+
- "8080:8080"
|
52
|
+
volumes:
|
53
|
+
- .:/app/spec/scenarios/elasticsearch
|
54
|
+
environment:
|
55
|
+
SW_AGENT_SERVICE_NAME: "elasticsearch"
|
56
|
+
healthcheck:
|
57
|
+
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/8080" ]
|
58
|
+
interval: 5s
|
59
|
+
timeout: 60s
|
60
|
+
retries: 120
|
61
|
+
entrypoint:
|
62
|
+
- "sh"
|
63
|
+
- "-c"
|
64
|
+
- "gem install sinatra rackup puma elasticsearch && ruby /app/spec/scenarios/elasticsearch/elasticsearch.rb"
|
65
|
+
depends_on:
|
66
|
+
oap:
|
67
|
+
condition: service_healthy
|
68
|
+
networks:
|
69
|
+
- gem
|
70
|
+
|
71
|
+
networks:
|
72
|
+
gem:
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require_relative '../../../lib/skywalking'
|
17
|
+
require 'sinatra'
|
18
|
+
require 'elasticsearch'
|
19
|
+
|
20
|
+
Skywalking.start(disable_plugins: 'net_http')
|
21
|
+
|
22
|
+
def create_index(client)
|
23
|
+
client.indices.create(index: 'test_index', body: { mappings: { properties: { name: { type: 'text' } } } })
|
24
|
+
puts "Index created."
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_document(client, id, name)
|
28
|
+
client.index(index: 'test_index', id: id, body: { name: name })
|
29
|
+
puts "Document added: #{id} => #{name}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_document(client, id)
|
33
|
+
response = client.get(index: 'test_index', id: id)
|
34
|
+
puts "Document retrieved: #{response['_source']}"
|
35
|
+
rescue Elasticsearch::Transport::Transport::Errors::NotFound
|
36
|
+
puts "Document not found."
|
37
|
+
end
|
38
|
+
|
39
|
+
def delete_document(client, id)
|
40
|
+
client.delete(index: 'test_index', id: id)
|
41
|
+
puts "Document deleted: #{id}"
|
42
|
+
end
|
43
|
+
|
44
|
+
get "/execute" do
|
45
|
+
client = Elasticsearch::Client.new(hosts: ['http://elasticsearch:9200'], log: true,
|
46
|
+
transport_options: { request: { timeout: 5 } })
|
47
|
+
create_index(client)
|
48
|
+
add_document(client, '1', 'Document 1')
|
49
|
+
get_document(client, '1')
|
50
|
+
delete_document(client, '1')
|
51
|
+
end
|
52
|
+
|
53
|
+
set :bind, '0.0.0.0'
|
54
|
+
set :port, 8080
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require_relative '../common/common_spec_helper'
|
17
|
+
require_relative '../common/compose_context'
|
18
|
+
|
19
|
+
RSpec.describe "Elasticsearch" do
|
20
|
+
include CommonSpecHelper
|
21
|
+
include_context 'compose'
|
22
|
+
include_context 'scenario value'
|
23
|
+
|
24
|
+
let(:root_dir) { File.expand_path(__dir__) }
|
25
|
+
|
26
|
+
it 'test elasticsearch plugin' do
|
27
|
+
test_plugin('elasticsearch')
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
segmentItems:
|
18
|
+
- serviceName: elasticsearch
|
19
|
+
segmentSize: ge 1
|
20
|
+
segments:
|
21
|
+
- segmentId: not null
|
22
|
+
spans:
|
23
|
+
- operationName: Elasticsearch/PUT/test_index
|
24
|
+
parentSpanId: 0
|
25
|
+
spanId: 1
|
26
|
+
spanLayer: Database
|
27
|
+
startTime: gt 0
|
28
|
+
endTime: gt 0
|
29
|
+
componentId: 47
|
30
|
+
isError: false
|
31
|
+
spanType: Exit
|
32
|
+
peer: http://elasticsearch:9200
|
33
|
+
skipAnalysis: false
|
34
|
+
tags:
|
35
|
+
- { key: db.type, value: Elasticsearch }
|
36
|
+
- { key: db.statement, value: '[{:params=>{}}, {:body=>{:mappings=>{:properties=>{:name=>{:type=>"text"}}}}}]' }
|
37
|
+
- operationName: Elasticsearch/PUT/test_index/_doc/1
|
38
|
+
parentSpanId: 0
|
39
|
+
spanId: 2
|
40
|
+
spanLayer: Database
|
41
|
+
startTime: gt 0
|
42
|
+
endTime: gt 0
|
43
|
+
componentId: 47
|
44
|
+
isError: false
|
45
|
+
spanType: Exit
|
46
|
+
peer: http://elasticsearch:9200
|
47
|
+
skipAnalysis: false
|
48
|
+
tags:
|
49
|
+
- { key: db.type, value: Elasticsearch }
|
50
|
+
- { key: db.statement, value: '[{:params=>{}}, {:body=>{:name=>"Document 1"}}]' }
|
51
|
+
- operationName: Elasticsearch/GET/test_index/_doc/1
|
52
|
+
parentSpanId: 0
|
53
|
+
spanId: 3
|
54
|
+
spanLayer: Database
|
55
|
+
startTime: gt 0
|
56
|
+
endTime: gt 0
|
57
|
+
componentId: 47
|
58
|
+
isError: false
|
59
|
+
spanType: Exit
|
60
|
+
peer: http://elasticsearch:9200
|
61
|
+
skipAnalysis: false
|
62
|
+
tags:
|
63
|
+
- { key: db.type, value: Elasticsearch }
|
64
|
+
- { key: db.statement, value: '[{:params=>{}}]' }
|
65
|
+
- operationName: Elasticsearch/DELETE/test_index/_doc/1
|
66
|
+
parentSpanId: 0
|
67
|
+
spanId: 4
|
68
|
+
spanLayer: Database
|
69
|
+
startTime: gt 0
|
70
|
+
endTime: gt 0
|
71
|
+
componentId: 47
|
72
|
+
isError: false
|
73
|
+
spanType: Exit
|
74
|
+
peer: http://elasticsearch:9200
|
75
|
+
skipAnalysis: false
|
76
|
+
tags:
|
77
|
+
- { key: db.type, value: Elasticsearch }
|
78
|
+
- { key: db.statement, value: '[{:params=>{}}]' }
|
79
|
+
- operationName: GET:/execute
|
80
|
+
parentSpanId: -1
|
81
|
+
spanId: 0
|
82
|
+
spanLayer: Http
|
83
|
+
startTime: gt 0
|
84
|
+
endTime: gt 0
|
85
|
+
componentId: 12001
|
86
|
+
isError: false
|
87
|
+
spanType: Entry
|
88
|
+
peer: localhost:8080
|
89
|
+
skipAnalysis: false
|
90
|
+
tags:
|
91
|
+
- { key: http.method, value: GET }
|
92
|
+
- { key: http.url, value: /execute }
|
93
|
+
meterItems: [ ]
|
94
|
+
logItems: [ ]
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
# contributor license agreements. See the NOTICE file distributed with
|
4
|
+
# this work for additional information regarding copyright ownership.
|
5
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
# (the "License"); you may not use this file except in compliance with
|
7
|
+
# the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
version: "2.1"
|
19
|
+
|
20
|
+
services:
|
21
|
+
oap:
|
22
|
+
extends:
|
23
|
+
file: ../common/base-compose.yml
|
24
|
+
service: oap
|
25
|
+
networks:
|
26
|
+
- gem
|
27
|
+
|
28
|
+
memcached:
|
29
|
+
image: memcached:1.6
|
30
|
+
hostname: memcached
|
31
|
+
ports:
|
32
|
+
- "11211:11211"
|
33
|
+
networks:
|
34
|
+
- gem
|
35
|
+
healthcheck:
|
36
|
+
test: [ "CMD", "nc", "-z", "localhost", "11211" ]
|
37
|
+
interval: 5s
|
38
|
+
timeout: 60s
|
39
|
+
retries: 120
|
40
|
+
|
41
|
+
service:
|
42
|
+
extends:
|
43
|
+
file: ../common/base-compose.yml
|
44
|
+
service: agent
|
45
|
+
ports:
|
46
|
+
- "8080:8080"
|
47
|
+
volumes:
|
48
|
+
- .:/app/spec/scenarios/memcached
|
49
|
+
environment:
|
50
|
+
SW_AGENT_SERVICE_NAME: "memcached"
|
51
|
+
healthcheck:
|
52
|
+
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/8080" ]
|
53
|
+
interval: 5s
|
54
|
+
timeout: 60s
|
55
|
+
retries: 120
|
56
|
+
entrypoint:
|
57
|
+
- "sh"
|
58
|
+
- "-c"
|
59
|
+
- "gem install sinatra rackup puma dalli && ruby /app/spec/scenarios/memcached/memcached.rb"
|
60
|
+
depends_on:
|
61
|
+
oap:
|
62
|
+
condition: service_healthy
|
63
|
+
networks:
|
64
|
+
- gem
|
65
|
+
|
66
|
+
networks:
|
67
|
+
gem:
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
segmentItems:
|
18
|
+
- serviceName: memcached
|
19
|
+
segmentSize: ge 1
|
20
|
+
segments:
|
21
|
+
- segmentId: not null
|
22
|
+
spans:
|
23
|
+
- operationName: Memcached/set
|
24
|
+
parentSpanId: 0
|
25
|
+
spanId: 1
|
26
|
+
spanLayer: Cache
|
27
|
+
startTime: gt 0
|
28
|
+
endTime: gt 0
|
29
|
+
componentId: 20
|
30
|
+
isError: false
|
31
|
+
spanType: Exit
|
32
|
+
peer: memcached:11211
|
33
|
+
skipAnalysis: false
|
34
|
+
tags:
|
35
|
+
- {key: cache.type, value: Memcached}
|
36
|
+
- {key: cache.key, value: sw_key}
|
37
|
+
- operationName: Memcached/get
|
38
|
+
parentSpanId: 0
|
39
|
+
spanId: 2
|
40
|
+
spanLayer: Cache
|
41
|
+
startTime: gt 0
|
42
|
+
endTime: gt 0
|
43
|
+
componentId: 20
|
44
|
+
isError: false
|
45
|
+
spanType: Exit
|
46
|
+
peer: memcached:11211
|
47
|
+
skipAnalysis: false
|
48
|
+
tags:
|
49
|
+
- {key: cache.type, value: Memcached}
|
50
|
+
- {key: cache.key, value: sw_key}
|
51
|
+
- {key: cache.miss, value: 'false'}
|
52
|
+
- operationName: Memcached/delete
|
53
|
+
parentSpanId: 0
|
54
|
+
spanId: 3
|
55
|
+
spanLayer: Cache
|
56
|
+
startTime: gt 0
|
57
|
+
endTime: gt 0
|
58
|
+
componentId: 20
|
59
|
+
isError: false
|
60
|
+
spanType: Exit
|
61
|
+
peer: memcached:11211
|
62
|
+
skipAnalysis: false
|
63
|
+
tags:
|
64
|
+
- {key: cache.type, value: Memcached}
|
65
|
+
- {key: cache.key, value: sw_key}
|
66
|
+
- operationName: GET:/execute
|
67
|
+
parentSpanId: -1
|
68
|
+
spanId: 0
|
69
|
+
spanLayer: Http
|
70
|
+
startTime: gt 0
|
71
|
+
endTime: gt 0
|
72
|
+
componentId: 12001
|
73
|
+
isError: false
|
74
|
+
spanType: Entry
|
75
|
+
peer: localhost:8080
|
76
|
+
skipAnalysis: false
|
77
|
+
tags:
|
78
|
+
- {key: http.method, value: GET}
|
79
|
+
- {key: http.url, value: /execute}
|
80
|
+
meterItems: []
|
81
|
+
logItems: []
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require_relative '../../../lib/skywalking'
|
17
|
+
require 'sinatra'
|
18
|
+
require 'dalli'
|
19
|
+
|
20
|
+
Skywalking.start
|
21
|
+
|
22
|
+
get "/execute" do
|
23
|
+
client = Dalli::Client.new('memcached:11211', { namespace: "sw", compress: true })
|
24
|
+
client.set('sw_key', 'sw_value')
|
25
|
+
value = client.get('sw_key')
|
26
|
+
p "The value for 'sw_key' is: #{value}"
|
27
|
+
client.delete('sw_key')
|
28
|
+
end
|
29
|
+
|
30
|
+
set :bind, '0.0.0.0'
|
31
|
+
set :port, 8080
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require_relative '../common/common_spec_helper'
|
17
|
+
require_relative '../common/compose_context'
|
18
|
+
|
19
|
+
RSpec.describe "Memcached" do
|
20
|
+
include CommonSpecHelper
|
21
|
+
include_context 'compose'
|
22
|
+
include_context 'scenario value'
|
23
|
+
|
24
|
+
let(:root_dir) { File.expand_path(__dir__) }
|
25
|
+
|
26
|
+
it 'test memcached plugin' do
|
27
|
+
test_plugin('memcached')
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
# contributor license agreements. See the NOTICE file distributed with
|
4
|
+
# this work for additional information regarding copyright ownership.
|
5
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
# (the "License"); you may not use this file except in compliance with
|
7
|
+
# the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
version: "2.1"
|
19
|
+
|
20
|
+
services:
|
21
|
+
oap:
|
22
|
+
extends:
|
23
|
+
file: ../common/base-compose.yml
|
24
|
+
service: oap
|
25
|
+
networks:
|
26
|
+
- gem
|
27
|
+
|
28
|
+
service:
|
29
|
+
extends:
|
30
|
+
file: ../common/base-compose.yml
|
31
|
+
service: agent
|
32
|
+
ports:
|
33
|
+
- "8080:8080"
|
34
|
+
volumes:
|
35
|
+
- .:/app/spec/scenarios/net_http
|
36
|
+
environment:
|
37
|
+
SW_AGENT_SERVICE_NAME: "NetHttp"
|
38
|
+
entrypoint:
|
39
|
+
- "sh"
|
40
|
+
- "-c"
|
41
|
+
- "ruby /app/spec/scenarios/net_http/net_http.rb"
|
42
|
+
depends_on:
|
43
|
+
oap:
|
44
|
+
condition: service_healthy
|
45
|
+
networks:
|
46
|
+
- gem
|
47
|
+
|
48
|
+
networks:
|
49
|
+
gem:
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
segmentItems:
|
18
|
+
- serviceName: NetHttp
|
19
|
+
segmentSize: ge 1
|
20
|
+
segments:
|
21
|
+
- segmentId: not null
|
22
|
+
spans:
|
23
|
+
- operationName: "GET:/json?a=1"
|
24
|
+
parentSpanId: -1
|
25
|
+
spanId: 0
|
26
|
+
spanLayer: Http
|
27
|
+
startTime: gt 0
|
28
|
+
endTime: gt 0
|
29
|
+
componentId: 2
|
30
|
+
isError: false
|
31
|
+
spanType: Exit
|
32
|
+
peer: httpbin.org
|
33
|
+
skipAnalysis: false
|
34
|
+
tags:
|
35
|
+
- { key: http.method, value: GET }
|
36
|
+
- { key: http.url, value: "http://httpbin.org/json?a=1" }
|
37
|
+
- { key: http.status_code, value: "200" }
|
38
|
+
meterItems: [ ]
|
39
|
+
logItems: [ ]
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require_relative '../../../lib/skywalking'
|
17
|
+
require 'net/http'
|
18
|
+
require 'uri'
|
19
|
+
require 'json'
|
20
|
+
|
21
|
+
Skywalking.start
|
22
|
+
|
23
|
+
url = URI.parse('http://httpbin.org/json?a=1')
|
24
|
+
|
25
|
+
response = Net::HTTP.get_response(url)
|
26
|
+
|
27
|
+
if response.is_a?(Net::HTTPSuccess)
|
28
|
+
puts JSON.pretty_generate(JSON.parse(response.body))
|
29
|
+
else
|
30
|
+
puts "Error..."
|
31
|
+
end
|
32
|
+
|
33
|
+
sleep 10
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require_relative '../common/common_spec_helper'
|
17
|
+
require_relative '../common/compose_context'
|
18
|
+
|
19
|
+
RSpec.describe 'NetHttp' do
|
20
|
+
include CommonSpecHelper
|
21
|
+
include_context 'scenario value'
|
22
|
+
|
23
|
+
let(:root_dir) { File.expand_path(__dir__) }
|
24
|
+
|
25
|
+
let(:compose) do
|
26
|
+
Testcontainers::ComposeContainer.new(
|
27
|
+
filepath: root_dir,
|
28
|
+
compose_filenames: ["docker-compose.yml"]
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
before(:each) do
|
33
|
+
compose.start
|
34
|
+
end
|
35
|
+
|
36
|
+
after(:each) do
|
37
|
+
compose.stop
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'test the net_http plugin' do
|
41
|
+
test_plugin('net_http')
|
42
|
+
end
|
43
|
+
end
|