skywalking 0.0.0.beta1 → 0.1.0
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/.gitignore +2 -1
- data/CHANGELOG.md +2 -1
- data/CONTRIBUTING.md +51 -0
- data/Makefile +38 -0
- data/README.md +6 -0
- data/docs/en/agent/plugins.md +7 -5
- data/docs/en/development-and-contribution/how-to-release.md +14 -12
- data/docs/en/setup/quick-start.md +24 -1
- data/lib/skywalking/configuration.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 +1 -1
- data/lib/skywalking/plugins/redis5.rb +5 -1
- data/lib/skywalking/plugins/sinatra.rb +4 -3
- data/lib/skywalking/plugins_manager.rb +1 -1
- data/lib/skywalking/tracing/carrier.rb +1 -1
- data/lib/skywalking/tracing/constants.rb +3 -1
- data/lib/skywalking/tracing/segment.rb +1 -1
- data/lib/skywalking/tracing/span.rb +1 -0
- data/lib/skywalking/tracing/span_context.rb +2 -2
- data/lib/skywalking/tracing/tag.rb +14 -0
- data/lib/skywalking/version.rb +1 -1
- data/skywalking.gemspec +1 -4
- data/spec/scenarios/common/compose_context.rb +1 -1
- 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
- metadata +18 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61f4463e396a77b2dbf283cf793f868755b8e350e69bd92246bb1d0ca284655c
|
4
|
+
data.tar.gz: 66371e9c08dcdaf408f43830b2ccfd71673516dc90b4ad620e92c1e5a32b8b0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 438ded62f2650740a7b7806b0b38fc3bcc93ca252162ea3b5e579ef06e4c6b1f05c6116bfb715c93609942a1f05e3581294a27c94bce2fdece3847033b339a03
|
7
|
+
data.tar.gz: eb3ad2986b8f2b31d225ade8a4602220b3b5cf25f6818a0031cf9ba04d0fb2b519d56b4215071d0e94f41d622c4f9130643163a675c451685357d8b64558537a
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -7,12 +7,13 @@ Release Notes.
|
|
7
7
|
#### Features
|
8
8
|
- Initialize the ruby agent core.
|
9
9
|
- Implement e2e tests.
|
10
|
-
- Add docs.
|
11
10
|
|
12
11
|
#### Plugins
|
13
12
|
* Support [Sinatra](https://github.com/sinatra/sinatra)
|
14
13
|
* Support [redis-rb](https://github.com/redis/redis-rb)
|
15
14
|
* Support [net-http](https://github.com/ruby/net-http)
|
15
|
+
* Support [memcached](https://github.com/petergoldstein/dalli)
|
16
|
+
* Support [elasticsearch](https://github.com/elastic/elasticsearch-ruby)
|
16
17
|
|
17
18
|
#### Documentation
|
18
19
|
* Initialize the documentation.
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Contributing to Apache SkyWalking Ruby
|
2
|
+
|
3
|
+
Firstly, thanks for your interest in contributing! We hope that this will be a pleasant experience for you,
|
4
|
+
so that you will return to continue contributing.
|
5
|
+
|
6
|
+
## Code of Conduct
|
7
|
+
|
8
|
+
The project and everyone participating in it is governed by the Apache software Foundation's [Code of Conduct](http://www.apache.org/foundation/policies/conduct.html).
|
9
|
+
By participating, you are expected to adhere to this code. If you are aware of unacceptable behavior, please visit the [Reporting Guidelines page](http://www.apache.org/foundation/policies/conduct.html#reporting-guidelines)
|
10
|
+
and follow the instructions there.
|
11
|
+
|
12
|
+
## Contribute
|
13
|
+
|
14
|
+
Most of the contributions that we receive are code contributions, but you can also contribute to the documentation or simply report solid bugs for us to fix.
|
15
|
+
|
16
|
+
## Report a bug
|
17
|
+
|
18
|
+
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/apache/skywalking/issues).
|
19
|
+
|
20
|
+
* If you're unable to find an issue addressing the problem, [open a new one](https://github.com/apache/skywalking/issues/new).
|
21
|
+
Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not happening.
|
22
|
+
|
23
|
+
## Compiling and building
|
24
|
+
|
25
|
+
We recommend using a Ruby base image of at least 3.0 to build skywalking-ruby project
|
26
|
+
|
27
|
+
```shell
|
28
|
+
docker run -it --rm -v $(pwd)/skywalking-ruby:/workspace -w /workspace ruby:3.0 bash
|
29
|
+
```
|
30
|
+
|
31
|
+
Then run the following commands to build the project:
|
32
|
+
|
33
|
+
```shell
|
34
|
+
gem build skywalking.gemspec
|
35
|
+
```
|
36
|
+
|
37
|
+
## Add a new feature or enhance an existing one
|
38
|
+
|
39
|
+
_Before making any significant changes, please [open an issue](https://github.com/apache/skywalking/issues)._
|
40
|
+
Discussing your proposed changes ahead of time will make the contribution process smooth for everyone.
|
41
|
+
|
42
|
+
Once we've discussed your changes and you've got your code ready, make sure that tests are passing and open your pull request. Your PR is most likely to be accepted if it:
|
43
|
+
|
44
|
+
* Update the README.md with details of changes to the interface.
|
45
|
+
* Includes tests for new functionality.
|
46
|
+
* References the original issue in description, e.g. "Resolves #123", "Closes #123", or "Fixes #123", etc.
|
47
|
+
* Has a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
48
|
+
|
49
|
+
## Questions about the source code
|
50
|
+
|
51
|
+
* Join `#skywalking` channel at [Apache Slack](https://s.apache.org/slack-invite)
|
data/Makefile
ADDED
@@ -0,0 +1,38 @@
|
|
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
|
+
.PHONY: license
|
18
|
+
license: license
|
19
|
+
docker run -it --rm -v $(shell pwd):/github/workspace ghcr.io/apache/skywalking-eyes/license-eye:20da317d1ad158e79e24355fdc28f53370e94c8a header check
|
20
|
+
|
21
|
+
.PHONY: clean
|
22
|
+
clean:
|
23
|
+
rm -rf skywalking-ruby*.tgz*
|
24
|
+
rm -rf skywalking*.gem
|
25
|
+
|
26
|
+
.PHONY: release
|
27
|
+
release: clean
|
28
|
+
tar -zcvf "skywalking-ruby-src-${VERSION}.tgz" \
|
29
|
+
--exclude .git \
|
30
|
+
--exclude .idea \
|
31
|
+
--exclude .cache \
|
32
|
+
--exclude .DS_Store \
|
33
|
+
--exclude .github \
|
34
|
+
--exclude .gitignore \
|
35
|
+
--exclude .gitmodules \
|
36
|
+
--exclude "skywalking-ruby-*.tgz*" *
|
37
|
+
gpg --batch --yes --armor --detach-sig skywalking-ruby-src-${VERSION}.tgz
|
38
|
+
shasum -a 512 skywalking-ruby-src-${VERSION}.tgz > skywalking-ruby-src-${VERSION}.tgz.sha512
|
data/README.md
CHANGED
@@ -8,6 +8,12 @@ Apache SkyWalking Ruby Agent
|
|
8
8
|
**SkyWalking**: an APM(application performance monitor) system, especially designed for
|
9
9
|
microservices, cloud native and container-based (Docker, Kubernetes, Mesos) architectures.
|
10
10
|
|
11
|
+
## Documentation
|
12
|
+
- [Official documentation](https://skywalking.apache.org/docs/#RubyAgent)
|
13
|
+
|
14
|
+
## Contributing
|
15
|
+
Before submitting a pull request or pushing a commit, please read our [contributing](CONTRIBUTING.md).
|
16
|
+
|
11
17
|
## Contact Us
|
12
18
|
* Submit [an issue](https://github.com/apache/skywalking/issues/new) by using [Ruby] as title prefix.
|
13
19
|
* Mail list: **dev@skywalking.apache.org**. Mail to `dev-subscribe@skywalking.apache.org`, follow the reply to subscribe the mail list.
|
data/docs/en/agent/plugins.md
CHANGED
@@ -3,8 +3,10 @@
|
|
3
3
|
The following plugins provide the distributed tracing capability, and the OAP backend would analyze the topology and
|
4
4
|
metrics based on the tracing data.
|
5
5
|
|
6
|
-
| Library
|
7
|
-
|
8
|
-
| [redis](https://github.com/redis/redis-rb)
|
9
|
-
| [net-http](https://github.com/ruby/net-http)
|
10
|
-
| [sinatra](https://github.com/sinatra/sinatra)
|
6
|
+
| Library | Version | Plugin Name |
|
7
|
+
|:---------------------------------------------------------------|:---------|:----------------|
|
8
|
+
| [redis](https://github.com/redis/redis-rb) | ~> 5.0 | `redis5` |
|
9
|
+
| [net-http](https://github.com/ruby/net-http) | ~> 0.6.0 | `net_http` |
|
10
|
+
| [sinatra](https://github.com/sinatra/sinatra) | ~> 4.1 | `sinatra` |
|
11
|
+
| [memcached](https://github.com/petergoldstein/dalli) | ~> 3.2 | `memcached` |
|
12
|
+
| [elasticsearch](https://github.com/elastic/elasticsearch-ruby) | ~> 8.0.0 | `elasticsearch` |
|
@@ -25,7 +25,7 @@ export VERSION=<the version to release>
|
|
25
25
|
git clone --recurse-submodules git@github.com:apache/skywalking-ruby && cd skywalking-ruby
|
26
26
|
git tag -a "v$VERSION" -m "Release Apache SkyWalking-Ruby $VERSION"
|
27
27
|
git push --tags
|
28
|
-
|
28
|
+
make release
|
29
29
|
```
|
30
30
|
|
31
31
|
## Upload to Apache svn
|
@@ -37,11 +37,17 @@ cp skywalking-ruby/skywalking*.tgz release/skywalking/ruby/"$VERSION"
|
|
37
37
|
cp skywalking-ruby/skywalking*.tgz.asc release/skywalking/ruby/"$VERSION"
|
38
38
|
cp skywalking-ruby/skywalking*.tgz.sha512 release/skywalking/ruby/"$VERSION"
|
39
39
|
|
40
|
-
cd release/skywalking && svn add
|
40
|
+
cd release/skywalking/ruby && svn add $VERSION && svn commit -m "Draft Apache SkyWalking-Ruby release $VERSION"
|
41
41
|
```
|
42
42
|
|
43
43
|
## Call for vote in dev@ mailing list
|
44
44
|
|
45
|
+
First, generate a sha512sum for the source code package generated in last step:
|
46
|
+
|
47
|
+
```shell
|
48
|
+
sha512sum release/skywalking/ruby/"$VERSION"/skywalking-ruby-src-"$VERSION".tgz
|
49
|
+
```
|
50
|
+
|
45
51
|
Call for vote in `dev@skywalking.apache.org`.
|
46
52
|
|
47
53
|
```text
|
@@ -52,6 +58,9 @@ Content:
|
|
52
58
|
Hi the SkyWalking Community:
|
53
59
|
This is a call for vote to release Apache SkyWalking Ruby version $VERSION.
|
54
60
|
|
61
|
+
We welcome any comments you may have, and will take all feedback into
|
62
|
+
account if a quality vote is called for this build.
|
63
|
+
|
55
64
|
Release notes:
|
56
65
|
|
57
66
|
* https://github.com/apache/skywalking-ruby/blob/v$VERSION/CHANGELOG.md
|
@@ -76,17 +85,10 @@ Keys to verify the Release Candidate :
|
|
76
85
|
|
77
86
|
Guide to build the release from source :
|
78
87
|
|
79
|
-
* https://github.com/apache/skywalking-ruby/blob/
|
80
|
-
|
81
|
-
Voting will start now and will remain open for at least 72 hours, all PMC members are required to give their votes.
|
82
|
-
|
83
|
-
[ ] +1 Release this package.
|
84
|
-
[ ] +0 No opinion.
|
85
|
-
[ ] -1 Do not release this package because....
|
86
|
-
|
87
|
-
Thanks.
|
88
|
+
* https://github.com/apache/skywalking-ruby/blob/main/CONTRIBUTING.md#compiling-and-building
|
88
89
|
|
89
|
-
|
90
|
+
A vote regarding the quality of this test build will be initiated
|
91
|
+
within the next couple of days.
|
90
92
|
```
|
91
93
|
|
92
94
|
## Vote Check
|
@@ -19,6 +19,29 @@ gem "skywalking"
|
|
19
19
|
|
20
20
|
Besides, you can also make installation as simple as `gem install skywalking`.
|
21
21
|
|
22
|
+
## Installing from Source Code
|
23
|
+
|
24
|
+
**Download the source tar from the [official website](http://skywalking.apache.org/downloads/), and run the following commands to build from source**
|
25
|
+
|
26
|
+
**Make sure you have Ruby 3.0+ and the `gem` command available**
|
27
|
+
|
28
|
+
~~~shell
|
29
|
+
tar -zxf skywalking-ruby-src-<version>.tgz
|
30
|
+
cd skywalking-ruby-src-<version>
|
31
|
+
gem build skywalking.gemspec
|
32
|
+
~~~
|
33
|
+
|
34
|
+
If successful, the following will be displayed:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
Successfully built RubyGem
|
38
|
+
Name: skywalking
|
39
|
+
Version: <version>
|
40
|
+
File: skywalking-<version>.gem
|
41
|
+
```
|
42
|
+
|
43
|
+
Then you can use `skywalking-<version>.gem` to your gemfile.
|
44
|
+
|
22
45
|
## Getting started with Rails
|
23
46
|
|
24
47
|
You need to manually add `Skywalking.start` under config/initializers directory.
|
@@ -97,7 +120,7 @@ The following lists all the configuration options:
|
|
97
120
|
| log_file_name | SW_AGENT_LOG_FILE_NAME | skywalking | The name of the log file. |
|
98
121
|
| log_file_path | SW_AGENT_LOG_FILE_PATH | Not set | The path to the log file. |
|
99
122
|
| log_level | SW_AGENT_LOG_LEVEL | info | The log level. |
|
100
|
-
| disable_plugins | SW_AGENT_DISABLE_PLUGINS | Not set | The plugins to disable.
|
123
|
+
| disable_plugins | SW_AGENT_DISABLE_PLUGINS | Not set | The plugins to disable, multiple names should be split by comma, e.g. 'redis5,elasticsearch'. |
|
101
124
|
| report_protocol | SW_AGENT_REPORT_PROTOCOL | grpc | The protocol to use for reporting. |
|
102
125
|
| re_ignore_operation | SW_AGENT_RE_IGNORE_OPERATION | Not set | Ignore specific URL paths. |
|
103
126
|
| instance_properties_json | SW_AGENT_INSTANCE_PROPERTIES_JSON | Not set | A custom JSON string to be reported as service instance properties, e.g. `{"key": "value"}`. |
|
@@ -67,7 +67,7 @@ module Skywalking
|
|
67
67
|
:disable_plugins => {
|
68
68
|
type: :string,
|
69
69
|
default: '',
|
70
|
-
desc:
|
70
|
+
desc: "The plugins to disable, multiple names should be split by comma, e.g. 'redis5,elasticsearch'"
|
71
71
|
},
|
72
72
|
:report_protocol => {
|
73
73
|
type: :string,
|
@@ -0,0 +1,61 @@
|
|
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
|
+
module Skywalking
|
17
|
+
module Plugins
|
18
|
+
class Elasticsearch < PluginsManager::SWPlugin
|
19
|
+
def plugin_valid?
|
20
|
+
defined?(::Elasticsearch)
|
21
|
+
end
|
22
|
+
|
23
|
+
def install
|
24
|
+
inst_target = if defined?(::Elastic::Transport::Client)
|
25
|
+
::Elastic::Transport::Client
|
26
|
+
elsif defined?(::Elasticsearch::Transport::Client)
|
27
|
+
::Elasticsearch::Transport::Client
|
28
|
+
end
|
29
|
+
|
30
|
+
inst_target.class_eval do
|
31
|
+
def perform_request_with_skywalking(method, path, *args, &block)
|
32
|
+
peer_info = transport.hosts.first
|
33
|
+
db_statement = [{ params: args&.[](0) }]
|
34
|
+
unless args[1].nil? || args[1].empty?
|
35
|
+
db_statement << { body: args[1] }
|
36
|
+
end
|
37
|
+
|
38
|
+
Tracing::ContextManager.new_exit_span(
|
39
|
+
operation: "Elasticsearch/#{method}/#{path}",
|
40
|
+
peer: "#{peer_info[:protocol]}://#{peer_info[:host]}:#{peer_info[:port]}",
|
41
|
+
component: Tracing::Component::Elasticsearch
|
42
|
+
) do |span|
|
43
|
+
span&.tag(Tracing::TagDbType.new("Elasticsearch"))
|
44
|
+
span&.tag(Tracing::TagDbStatement.new(db_statement))
|
45
|
+
span&.layer = Tracing::Layer::Database
|
46
|
+
|
47
|
+
zuper_perform_request(method, path, *args, &block)
|
48
|
+
rescue
|
49
|
+
span&.error_occurred = true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
alias_method :zuper_perform_request, :perform_request
|
54
|
+
alias_method :perform_request, :perform_request_with_skywalking
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
register :elasticsearch
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,74 @@
|
|
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
|
+
module Skywalking
|
17
|
+
module Plugins
|
18
|
+
module MemcachedIntercept
|
19
|
+
def self.included(klass)
|
20
|
+
supported_method =
|
21
|
+
[:add, :append, :delete, :cas, :incr, :increment, :prepend, :replace, :set, :get, :fetch]
|
22
|
+
.select do |method_name|
|
23
|
+
klass.method_defined?(method_name) || klass.private_method_defined?(method_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
supported_method.each do |method_name|
|
27
|
+
zuper_method = :"zuper_#{method_name}"
|
28
|
+
method_with_skywalking = :"#{method_name}_with_skywalking"
|
29
|
+
|
30
|
+
klass.class_eval do
|
31
|
+
define_method(method_with_skywalking) do |*args, &block|
|
32
|
+
cache_key = args[0].to_s if args.length && !args[0].is_a?(Array)
|
33
|
+
Tracing::ContextManager.new_exit_span(
|
34
|
+
operation: "Memcached/#{method_name}",
|
35
|
+
peer: @normalized_servers.join(','),
|
36
|
+
component: Tracing::Component::Memcached
|
37
|
+
) do |span|
|
38
|
+
span&.layer = Tracing::Layer::Cache
|
39
|
+
span&.tag(Tracing::TagCacheType.new("Memcached"))
|
40
|
+
span&.tag(Tracing::TagCacheKey.new(cache_key))
|
41
|
+
|
42
|
+
resp = __send__(zuper_method, *args, &block)
|
43
|
+
if method_name == :get && args.length && args[0].instance_of?(String)
|
44
|
+
span&.tag(Tracing::TagCacheMiss.new(resp.nil?))
|
45
|
+
end
|
46
|
+
|
47
|
+
resp
|
48
|
+
rescue
|
49
|
+
span&.error_occurred = true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
alias_method zuper_method, method_name
|
54
|
+
alias_method method_name, method_with_skywalking
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class Memcached < PluginsManager::SWPlugin
|
61
|
+
def plugin_valid?
|
62
|
+
defined?(::Dalli::Client)
|
63
|
+
end
|
64
|
+
|
65
|
+
def install
|
66
|
+
::Dalli::Client.class_eval do
|
67
|
+
include Skywalking::Plugins::MemcachedIntercept
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
register :memcached
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -35,7 +35,7 @@ module Skywalking
|
|
35
35
|
Tracing::ContextManager.new_exit_span(
|
36
36
|
operation: "#{method}:#{req_info}",
|
37
37
|
peer: host,
|
38
|
-
component: Tracing::Component::
|
38
|
+
component: Tracing::Component::HttpClient
|
39
39
|
) do |span|
|
40
40
|
span&.tag(Tracing::TagHttpMethod.new(method))
|
41
41
|
span&.tag(Tracing::TagHttpURL.new(uri))
|
@@ -21,13 +21,12 @@ module Skywalking
|
|
21
21
|
req_method = @request.request_method if @request.respond_to?(:request_method)
|
22
22
|
carrier = Tracing::Carrier.new
|
23
23
|
carrier.each do |item|
|
24
|
-
item.
|
24
|
+
item.value = request.env["HTTP_#{item.key.upcase}"]
|
25
25
|
end
|
26
26
|
|
27
27
|
Tracing::ContextManager.new_entry_span(
|
28
28
|
operation: "#{req_method}:#{request.env['REQUEST_URI']}",
|
29
|
-
carrier: carrier
|
30
|
-
inherit: Tracing::Component::General
|
29
|
+
carrier: carrier
|
31
30
|
) do |span|
|
32
31
|
span&.tag(Tracing::TagHttpMethod.new(req_method))
|
33
32
|
span&.tag(Tracing::TagHttpURL.new(request.env['REQUEST_URI']))
|
@@ -36,6 +35,8 @@ module Skywalking
|
|
36
35
|
span&.component = Tracing::Component::Sinatra
|
37
36
|
|
38
37
|
super(*args, &block)
|
38
|
+
rescue
|
39
|
+
span&.error_occurred = true
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
@@ -34,7 +34,7 @@ module Skywalking
|
|
34
34
|
Dir[File.join(__dir__, 'plugins', '*.rb')].each { |file| require file }
|
35
35
|
|
36
36
|
installed_plugins = self.class.installed.keys
|
37
|
-
@enabled_plugins ||= installed_plugins - @config[:disable_plugins].split(',')
|
37
|
+
@enabled_plugins ||= installed_plugins - @config[:disable_plugins].split(',').map(&:to_sym)
|
38
38
|
@enabled_plugins.each do |plugin_name|
|
39
39
|
self.class.installed[plugin_name].try_install(plugin_name)
|
40
40
|
end
|
@@ -21,7 +21,7 @@ module Skywalking
|
|
21
21
|
class Carrier < CarrierItem
|
22
22
|
attr_reader :trace_id, :correlation_carrier, :service_instance,
|
23
23
|
:endpoint, :segment_id, :span_id,
|
24
|
-
:peer, :items, :iter_index
|
24
|
+
:peer, :items, :iter_index, :service
|
25
25
|
|
26
26
|
def initialize(
|
27
27
|
trace_id: '',
|
@@ -201,9 +201,9 @@ module Skywalking
|
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
|
-
def new_exit_span(operation:, peer: nil, component: nil, &block)
|
204
|
+
def new_exit_span(operation:, peer: nil, component: nil, inherit: nil, &block)
|
205
205
|
context = current_context
|
206
|
-
span = context.new_exit_span(operation, peer, component: component)
|
206
|
+
span = context.new_exit_span(operation, peer, component: component, inherit: inherit)
|
207
207
|
span&.start
|
208
208
|
|
209
209
|
begin
|
@@ -53,6 +53,13 @@ module Skywalking
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
class TagDbStatement < Tag
|
57
|
+
def initialize(val)
|
58
|
+
super
|
59
|
+
@key = 'db.statement'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
56
63
|
class TagCacheType < Tag
|
57
64
|
def initialize(val)
|
58
65
|
super
|
@@ -80,5 +87,12 @@ module Skywalking
|
|
80
87
|
@key = 'cache.key'
|
81
88
|
end
|
82
89
|
end
|
90
|
+
|
91
|
+
class TagCacheMiss < Tag
|
92
|
+
def initialize(val)
|
93
|
+
super
|
94
|
+
@key = 'cache.miss'
|
95
|
+
end
|
96
|
+
end
|
83
97
|
end
|
84
98
|
end
|
data/lib/skywalking/version.rb
CHANGED
data/skywalking.gemspec
CHANGED
@@ -42,7 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.require_paths = ['lib']
|
43
43
|
|
44
44
|
# Communication with OAP
|
45
|
-
spec.add_dependency 'grpc', '1.68.
|
45
|
+
spec.add_dependency 'grpc', '~> 1.68.0'
|
46
46
|
|
47
47
|
# Base dev dependency
|
48
48
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
@@ -53,9 +53,6 @@ Gem::Specification.new do |spec|
|
|
53
53
|
spec.add_development_dependency 'bigdecimal', '3.1.5'
|
54
54
|
|
55
55
|
# E2E test dependency
|
56
|
-
spec.add_development_dependency 'redis', '~> 5.0'
|
57
|
-
spec.add_development_dependency 'sinatra', '~> 4.1'
|
58
56
|
spec.add_development_dependency 'testcontainers-compose', '~> 0.2.0'
|
59
57
|
spec.add_development_dependency 'faraday', '~> 2.12'
|
60
|
-
spec.add_development_dependency 'rspec-wait', '~> 1.0'
|
61
58
|
end
|
@@ -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
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skywalking
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Apache SkyWalking Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.68.
|
19
|
+
version: 1.68.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.68.
|
26
|
+
version: 1.68.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,34 +108,6 @@ dependencies:
|
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 3.1.5
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: redis
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '5.0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '5.0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: sinatra
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '4.1'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '4.1'
|
139
111
|
- !ruby/object:Gem::Dependency
|
140
112
|
name: testcontainers-compose
|
141
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,20 +136,6 @@ dependencies:
|
|
164
136
|
- - "~>"
|
165
137
|
- !ruby/object:Gem::Version
|
166
138
|
version: '2.12'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: rspec-wait
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - "~>"
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '1.0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - "~>"
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '1.0'
|
181
139
|
description: The Ruby Agent for Apache SkyWalking
|
182
140
|
email:
|
183
141
|
- dev@skywalking.apache.org
|
@@ -197,8 +155,10 @@ files:
|
|
197
155
|
- ".rubocop.yml"
|
198
156
|
- CHANGELOG.md
|
199
157
|
- CODE_OF_CONDUCT.md
|
158
|
+
- CONTRIBUTING.md
|
200
159
|
- Gemfile
|
201
160
|
- LICENSE
|
161
|
+
- Makefile
|
202
162
|
- NOTICE
|
203
163
|
- README.md
|
204
164
|
- Rakefile
|
@@ -214,6 +174,8 @@ files:
|
|
214
174
|
- lib/skywalking/configuration.rb
|
215
175
|
- lib/skywalking/environment.rb
|
216
176
|
- lib/skywalking/log/logger.rb
|
177
|
+
- lib/skywalking/plugins/elasticsearch.rb
|
178
|
+
- lib/skywalking/plugins/memcached.rb
|
217
179
|
- lib/skywalking/plugins/net_http.rb
|
218
180
|
- lib/skywalking/plugins/redis5.rb
|
219
181
|
- lib/skywalking/plugins/sinatra.rb
|
@@ -287,6 +249,14 @@ files:
|
|
287
249
|
- spec/scenarios/common/common_spec_helper.rb
|
288
250
|
- spec/scenarios/common/compose_context.rb
|
289
251
|
- spec/scenarios/common/validator.rb
|
252
|
+
- spec/scenarios/elasticsearch/docker-compose.yml
|
253
|
+
- spec/scenarios/elasticsearch/elasticsearch.rb
|
254
|
+
- spec/scenarios/elasticsearch/elasticsearch_spec.rb
|
255
|
+
- spec/scenarios/elasticsearch/expected.yml
|
256
|
+
- spec/scenarios/memcached/docker-compose.yml
|
257
|
+
- spec/scenarios/memcached/expected.yml
|
258
|
+
- spec/scenarios/memcached/memcached.rb
|
259
|
+
- spec/scenarios/memcached/memcached_spec.rb
|
290
260
|
- spec/scenarios/net_http/docker-compose.yml
|
291
261
|
- spec/scenarios/net_http/expected.yml
|
292
262
|
- spec/scenarios/net_http/net_http.rb
|