splunk-otel 1.0.0 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +12 -7
- data/.gitignore +1 -1
- data/.gitlab-ci.yml +2 -1
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTING.md +11 -8
- data/README.md +13 -196
- data/RELEASING.md +19 -0
- data/docs/README.md +1 -3
- data/docs/advanced-config.md +4 -0
- data/examples/rails-7-barebones/Dockerfile +1 -1
- data/examples/sinatra_example/.gitignore +8 -0
- data/examples/sinatra_example/.rubocop.yml +13 -0
- data/examples/sinatra_example/CHANGELOG.md +5 -0
- data/examples/sinatra_example/CODE_OF_CONDUCT.md +84 -0
- data/examples/sinatra_example/Gemfile +19 -0
- data/examples/sinatra_example/README.md +34 -0
- data/examples/sinatra_example/Rakefile +16 -0
- data/examples/sinatra_example/config.ru +14 -0
- data/examples/sinatra_example/docker-compose.yml +11 -0
- data/examples/sinatra_example/lib/sinatra_example/version.rb +5 -0
- data/examples/sinatra_example/lib/sinatra_example.rb +25 -0
- data/examples/sinatra_example/sinatra_example.gemspec +23 -0
- data/lib/splunk/otel/version.rb +1 -1
- data/lib/splunk/otel.rb +1 -1
- data/scripts/install-release-deps.sh +1 -1
- data/scripts/release.sh +4 -2
- data/splunk-otel.gemspec +8 -6
- metadata +55 -18
- data/MIGRATING.md +0 -148
- data/docs/correlating-traces-and-logs.md +0 -23
- data/docs/instrumenting-rails.md +0 -7
- data/docs/troubleshooting.md +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcf4dad70d8a6b71b55f6677d0ce9b159593dca24f132450e8c54e68c07c10b2
|
4
|
+
data.tar.gz: c1e39dd47d8db577649ef2c2512d98ff5ff273737c5c07c018704db6f2682cbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 449588970f19061697f38f64f4d69d53ce1b05fa29c9d0f73aa34d115b42436b98a6470b9107fabe5ad4269344611773466a09fcb41ca122674c6b059df59cd6
|
7
|
+
data.tar.gz: 1b700291e9eb7708a6015915d73b35c38618d64e5cabd89dce20e4ef179a70b646fb08429ee9a70d3ff8095f325912c73929fcbf26d52787cddbe2a473b779a4
|
data/.github/workflows/main.yml
CHANGED
@@ -13,6 +13,7 @@ jobs:
|
|
13
13
|
strategy:
|
14
14
|
matrix:
|
15
15
|
rubygems: [
|
16
|
+
{ ruby: "3.2", appraisal: "rails-7.0" },
|
16
17
|
{ ruby: "3.1", appraisal: "rails-7.0" },
|
17
18
|
{ ruby: "3.0", appraisal: "rails-7.0" },
|
18
19
|
{ ruby: "2.7", appraisal: "rails-7.0" },
|
@@ -21,19 +22,23 @@ jobs:
|
|
21
22
|
]
|
22
23
|
|
23
24
|
steps:
|
24
|
-
- uses: actions/checkout@v3.
|
25
|
+
- uses: actions/checkout@v3.5.2
|
25
26
|
|
26
27
|
- name: Run Collector
|
27
28
|
run: docker-compose up -d
|
28
29
|
|
29
30
|
- name: Set up Ruby ${{ matrix.rubygems.ruby }}
|
30
|
-
uses: ruby/setup-ruby@v1.
|
31
|
+
uses: ruby/setup-ruby@v1.149.0
|
31
32
|
with:
|
32
33
|
ruby-version: ${{ matrix.rubygems.ruby }}
|
33
34
|
- name: Apply RubyGems fixes
|
34
35
|
run: gem update --system
|
36
|
+
- name: Ensure we have modern bundler
|
37
|
+
run: gem install bundler -v '~> 2.3.26'
|
35
38
|
- name: Install dependencies
|
36
|
-
run: bundle
|
39
|
+
run: bundle _2.3.26_
|
40
|
+
- name: Verify nokogiri
|
41
|
+
run: bundle exec nokogiri -v
|
37
42
|
- name: Install appraisal dependencies
|
38
43
|
run: bundle exec appraisal install
|
39
44
|
- name: Rubocop
|
@@ -41,7 +46,7 @@ jobs:
|
|
41
46
|
- name: Run tests
|
42
47
|
run: bundle exec appraisal ${{ matrix.rubygems.appraisal }} rake test
|
43
48
|
- name: Upload coverage to Codecov
|
44
|
-
uses: codecov/codecov-action@v3.1.
|
49
|
+
uses: codecov/codecov-action@v3.1.3
|
45
50
|
- name: Run basic example e2e test
|
46
51
|
run: ruby console.rb
|
47
52
|
working-directory: ./examples/basic/
|
@@ -51,7 +56,7 @@ jobs:
|
|
51
56
|
test-e2e-rails-7-barebones:
|
52
57
|
runs-on: ubuntu-20.04
|
53
58
|
steps:
|
54
|
-
- uses: actions/checkout@v3.
|
59
|
+
- uses: actions/checkout@v3.5.2
|
55
60
|
- name: Run e2e tests via Docker
|
56
61
|
working-directory: ./examples/rails-7-barebones
|
57
62
|
run: docker-compose up --build --exit-code-from tester
|
@@ -59,8 +64,8 @@ jobs:
|
|
59
64
|
linkChecker:
|
60
65
|
runs-on: ubuntu-20.04
|
61
66
|
steps:
|
62
|
-
- uses: actions/checkout@v3.
|
67
|
+
- uses: actions/checkout@v3.5.2
|
63
68
|
- name: Link Checker
|
64
|
-
uses: lycheeverse/lychee-action@v1.
|
69
|
+
uses: lycheeverse/lychee-action@v1.7.0
|
65
70
|
with:
|
66
71
|
fail: true
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,18 @@ and this repository adheres to [Semantic Versioning](https://semver.org/spec/v2.
|
|
7
7
|
|
8
8
|
## Unreleased
|
9
9
|
|
10
|
+
## v1.1.3 - 2023-05-24
|
11
|
+
|
12
|
+
- No changes.
|
13
|
+
|
14
|
+
## v1.1.1 - 2023-05-24
|
15
|
+
|
16
|
+
- No significant changes.
|
17
|
+
|
18
|
+
## v1.1.0 - 2023-01-30
|
19
|
+
|
20
|
+
- fix handling of SPLUNK_ACCESS_TOKEN to check for empty string [#114](https://github.com/signalfx/splunk-otel-ruby/pull/114)
|
21
|
+
|
10
22
|
## v1.0.0 - 2022-09-29
|
11
23
|
|
12
24
|
## v0.3.0 - 2022-09-28
|
data/CONTRIBUTING.md
CHANGED
@@ -33,14 +33,17 @@ See [SECURITY.md](SECURITY.md#reporting-security-issues) for instructions.
|
|
33
33
|
|
34
34
|
## Documentation
|
35
35
|
|
36
|
-
The Splunk Observability documentation is hosted on
|
37
|
-
which contains all the
|
38
|
-
|
39
|
-
|
40
|
-
documentation
|
41
|
-
|
42
|
-
|
43
|
-
|
36
|
+
The Splunk Observability documentation is hosted on the [Splunk Observability
|
37
|
+
Cloud docs site](https://docs.splunk.com/Observability), which contains all the
|
38
|
+
prescriptive guidance for Splunk Observability products. Prescriptive guidance
|
39
|
+
consists of step-by-step instructions, conceptual material, and decision support
|
40
|
+
for customers. Reference documentation and development documentation is still
|
41
|
+
hosted on this repository.
|
42
|
+
|
43
|
+
To contribute documentation for this project, open a pull request in the
|
44
|
+
[public-o11y-docs](https://github.com/splunk/public-o11y-docs) repository. See
|
45
|
+
the [CONTRIBUTING.md](https://github.com/splunk/public-o11y-docs/blob/main/CONTRIBUTING.md)
|
46
|
+
guide of the Splunk Observability Cloud documentation for more information.
|
44
47
|
|
45
48
|
## Contributing via Pull Requests
|
46
49
|
|
data/README.md
CHANGED
@@ -11,8 +11,8 @@
|
|
11
11
|
|
12
12
|
The Splunk Distribution of [OpenTelemetry Instrumentation for
|
13
13
|
Ruby](https://github.com/open-telemetry/opentelemetry-ruby) provides a gem for
|
14
|
-
setup of OpenTelemetry SDK for reporting distributed traces to
|
15
|
-
APM
|
14
|
+
setup of OpenTelemetry SDK for reporting distributed traces to Splunk
|
15
|
+
APM.
|
16
16
|
|
17
17
|
This distribution comes with the following defaults:
|
18
18
|
|
@@ -24,221 +24,39 @@ This distribution comes with the following defaults:
|
|
24
24
|
- Unlimited default limits for [configuration options](#trace-configuration) to
|
25
25
|
support full-fidelity traces.
|
26
26
|
|
27
|
+
If you're using the SignalFx Tracing Library for Ruby and want to migrate to the Splunk Distribution of OpenTelemetry Ruby, see [Migrate from the SignalFx Tracing Library for Ruby](https://quickdraw.splunk.com/redirect/?product=Observability&version=current&location=ruby.migrate) in the official documentation.
|
28
|
+
|
27
29
|
## Requirements
|
28
30
|
|
29
|
-
|
31
|
+
This distribution requires Ruby version 2.6 or higher.
|
30
32
|
|
31
33
|
## Get started
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
- [W3C tracecontext](https://www.w3.org/TR/trace-context/) and [W3C
|
36
|
-
baggage](https://www.w3.org/TR/baggage/) context propagation.
|
37
|
-
- OTLP over HTTP exporter configured to send spans to a locally running [Splunk
|
38
|
-
OpenTelemetry Connector](https://github.com/signalfx/splunk-otel-collector)
|
39
|
-
at http://localhost:4318.
|
40
|
-
- Unlimited default limits for configuration options to support full-fidelity
|
41
|
-
traces.
|
42
|
-
|
43
|
-
Install the gem by adding it to your project's `Gemfile`:
|
44
|
-
|
45
|
-
``` ruby
|
46
|
-
gem "splunk-otel", "~> 0.1"
|
47
|
-
```
|
48
|
-
|
49
|
-
or
|
50
|
-
|
51
|
-
```shell
|
52
|
-
bundle add splunk-otel --version "~> 0.1"
|
53
|
-
```
|
54
|
-
|
55
|
-
Configure OpenTelemetry using the `Splunk::Otel` module from `splunk/otel`:
|
56
|
-
|
57
|
-
``` ruby
|
58
|
-
require "splunk/otel"
|
59
|
-
...
|
60
|
-
Splunk::Otel.configure
|
61
|
-
```
|
62
|
-
|
63
|
-
## Basic configuration
|
64
|
-
|
65
|
-
The `service.name` resource attribute is the only configuration option that
|
66
|
-
needs to be specified, using either the environment variable `OTEL_SERVICE_NAME`
|
67
|
-
or passing as an argument to `configure`:
|
68
|
-
|
69
|
-
``` ruby
|
70
|
-
Splunk::Otel.configure(service_name: "my-service")
|
71
|
-
```
|
72
|
-
|
73
|
-
Other resource attributes are not strictly required, but
|
74
|
-
`deployment.environment` and `service.version` are recommended to be set if they
|
75
|
-
are available. These can be set through the environment variable
|
76
|
-
`OTEL_RESOURCE_ATTRIBUTES`:
|
77
|
-
|
78
|
-
```
|
79
|
-
OTEL_RESOURCE_ATTRIBUTES="service.version=1.2.3,deployment.environment=production"
|
80
|
-
```
|
81
|
-
|
82
|
-
alternatively, if needed, more attributes can be added in code using:
|
83
|
-
|
84
|
-
```ruby
|
85
|
-
Splunk::Otel.configure(service_name: "my-service") do |c|
|
86
|
-
c.resource = OpenTelemetry::SDK::Resources::Resource.create(
|
87
|
-
"key" => "value"
|
88
|
-
)
|
89
|
-
end
|
90
|
-
```
|
35
|
+
For complete instructions on how to get started with the Splunk Distribution of OpenTelemetry Ruby, see [Instrument a Ruby application for Splunk Observability Cloud](https://quickdraw.splunk.com/redirect/?product=Observability&version=current&location=ruby.application) in the official documentation.
|
91
36
|
|
92
37
|
## Advanced configuration
|
93
38
|
|
94
|
-
See [
|
95
|
-
configure the instrumentation.
|
39
|
+
See [Configure the Ruby agent for Splunk Observability Cloud](https://quickdraw.splunk.com/redirect/?product=Observability&version=current&location=ruby.configuration) in the official documentation.
|
96
40
|
|
97
41
|
## Correlate traces and logs
|
98
42
|
|
99
43
|
You can add trace metadata to logs using the OpenTelemetry trace API. Trace
|
100
44
|
metadata lets you explore logs in Splunk Observability Cloud.
|
101
45
|
|
102
|
-
See [
|
46
|
+
See [Connect Ruby trace data with logs for Splunk Observability Cloud](https://quickdraw.splunk.com/redirect/?product=Observability&version=current&location=ruby.trace.logs) in the official documentation.
|
103
47
|
|
104
48
|
## Library instrumentation
|
105
49
|
|
106
50
|
Supported libraries are listed
|
107
51
|
[here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation).
|
108
|
-
|
52
|
+
You can find the corresponding gems for the instrumentation libraries under the
|
109
53
|
[opentelemetry-ruby](https://rubygems.org/profiles/opentelemetry-ruby) profile
|
110
54
|
on [rubygems.org](https://rubygems.org).
|
111
55
|
|
112
|
-
### Automatic instrumentation
|
113
|
-
|
114
|
-
You can enable automatic instrumentation of all libraries used in your project
|
115
|
-
that have corresponding [OpenTelemetry Ruby
|
116
|
-
gems](https://rubygems.org/profiles/opentelemetry-ruby) libraries by installing
|
117
|
-
the
|
118
|
-
[opentelemetry-instrumentation-all](https://rubygems.org/gems/opentelemetry-instrumentation-all)
|
119
|
-
gem in your Gemfile:
|
120
|
-
|
121
|
-
``` ruby
|
122
|
-
gem "opentelemetry-instrumentation-all", "~> 0.23"
|
123
|
-
```
|
124
|
-
|
125
|
-
Enable the instrumentations from the gem by passing `auto_instrument:true` to
|
126
|
-
the `configure` method of `Splunk::Otel`. For example:
|
127
|
-
|
128
|
-
``` ruby
|
129
|
-
require "splunk/otel"
|
130
|
-
|
131
|
-
Splunk::Otel.configure(auto_instrument: true)
|
132
|
-
```
|
133
|
-
|
134
|
-
The gem fetches all instrumentation libraries but only enables those that
|
135
|
-
instrument a dependency in your project. For example, it will fetch
|
136
|
-
`opentelemetry-instrumentation-rack` but only if the `rack` gem is included and
|
137
|
-
used in your project will the instrumentation be enabled.
|
138
|
-
|
139
|
-
`auto_instrument: true` also works if individual instrumentation libraries are
|
140
|
-
installed, like the `opentelemetry-instrumentation-sinatra` gem.
|
141
|
-
|
142
|
-
To set configuration of one or more instrumentation libraries a config hash
|
143
|
-
can be passed to `use_all`:
|
144
|
-
|
145
|
-
``` ruby
|
146
|
-
OpenTelemetry::SDK.configure do |c|
|
147
|
-
config = {'OpenTelemetry::Instrumentation::Redis' => { opt: "value" }}
|
148
|
-
c.use_all(config)
|
149
|
-
end
|
150
|
-
```
|
151
|
-
|
152
|
-
The option `enabled` can be used to disable individual instrumentation libraries
|
153
|
-
when using `opentelemetry-instrumentation-all`:
|
154
|
-
|
155
|
-
``` ruby
|
156
|
-
OpenTelemetry::SDK.configure do |c|
|
157
|
-
config = {'OpenTelemetry::Instrumentation::Redis' => { enabled: false }}
|
158
|
-
c.use_all(config)
|
159
|
-
end
|
160
|
-
```
|
161
|
-
|
162
|
-
To enable instrumentation libraries manually, see [Manual library instrumentation](#manual-library-instrumentation).
|
163
|
-
|
164
|
-
### Manual instrumentation
|
165
|
-
|
166
|
-
Documentation on how to manually instrument a Ruby application is available in the
|
167
|
-
[OpenTelemetry official documentation](https://opentelemetry.io/docs/instrumentation/ruby/manual/).
|
168
|
-
|
169
|
-
To extend the instrumentation with the OpenTelemetry Instrumentation for Ruby,
|
170
|
-
you have to use a compatible API version.
|
171
|
-
|
172
|
-
The Splunk Distribution of OpenTelemetry Ruby is compatible with:
|
173
|
-
|
174
|
-
- OpenTelemetry API version 1.0.0
|
175
|
-
- OpenTelemetry SDK version 1.0.0
|
176
|
-
|
177
|
-
### Manual library instrumentation
|
178
|
-
|
179
|
-
Instrumentation gems can also be installed and enabled individually. This may be
|
180
|
-
preferred in order to control exactly which gems are fetched when building your project.
|
181
|
-
|
182
|
-
Install the instrumentation library by including it in
|
183
|
-
the project's `Gemfile`. For example, to install the
|
184
|
-
[Sinatra](https://rubygems.org/gems/opentelemetry-instrumentation-sinatra)
|
185
|
-
instrumentation:
|
186
|
-
|
187
|
-
```
|
188
|
-
gem "opentelemetry-instrumentation-sinatra", "~> 0.19"
|
189
|
-
```
|
190
|
-
|
191
|
-
In a block passed to `Splunk::Otel.configure` configure the SDK to use
|
192
|
-
each of the instrumentation libraries. In the case of the Sinatra instrumentation,
|
193
|
-
the block would look like the following example:
|
194
|
-
|
195
|
-
``` ruby
|
196
|
-
require "splunk/otel"
|
197
|
-
|
198
|
-
Splunk::Otel.configure do |c|
|
199
|
-
c.use "OpenTelemetry::Instrumentation::Sinatra", { opt: "value" }
|
200
|
-
end
|
201
|
-
```
|
202
|
-
|
203
|
-
### Real User Monitoring
|
204
|
-
|
205
|
-
For [Real User Monitoring
|
206
|
-
(RUM)](https://www.splunk.com/en_us/products/real-user-monitoring.html) a
|
207
|
-
[Rack](https://github.com/rack/rack) middleware is provided which will add trace
|
208
|
-
context to the `Server-Timing` header in the response if there is an active
|
209
|
-
Span. To use the middleware configure `Splunk::Otel` to use the `Rack`
|
210
|
-
instrumentation:
|
211
|
-
|
212
|
-
``` ruby
|
213
|
-
Splunk::Otel.configure do |c|
|
214
|
-
c.use "OpenTelemetry::Instrumentation::Rack"
|
215
|
-
end
|
216
|
-
```
|
217
|
-
|
218
|
-
And add the middleware in `Rack::Builder`:
|
219
|
-
|
220
|
-
``` ruby
|
221
|
-
Rack::Builder.app do
|
222
|
-
use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
|
223
|
-
use Splunk::Otel::Rack::RumMiddleware
|
224
|
-
run ->(_env) { [200, { "content-type" => "text/plain" }, ["OK"]] }
|
225
|
-
end
|
226
|
-
```
|
227
|
-
|
228
|
-
When using [ActionPack](https://rubygems.org/gems/actionpack/), which Rails
|
229
|
-
does, the middleware will be added automatically if the Instrumentation Library
|
230
|
-
for ActionPack, "Splunk::Otel::Instrumentation::ActionPack", is used:
|
231
56
|
|
232
|
-
|
233
|
-
Splunk::Otel.configure do |c|
|
234
|
-
c.use "OpenTelemetry::Instrumentation::ActionPack"
|
235
|
-
c.use "Splunk::Otel::Instrumentation::ActionPack"
|
236
|
-
end
|
237
|
-
```
|
57
|
+
## Manual instrumentation
|
238
58
|
|
239
|
-
|
240
|
-
`SPLUNK_TRACE_RESPONSE_HEADER_ENABLED` can be set to `false`, or pass
|
241
|
-
`trace_response_header_enabled: false` to `Splunk::Otel.configure`.
|
59
|
+
See [Manually instrument Ruby applications for Splunk Observability Cloud](https://quickdraw.splunk.com/redirect/?product=Observability&version=current&location=ruby.manual.instrumentation) for instructions on how to manually instrument Ruby applications.
|
242
60
|
|
243
61
|
## Configure for use with Smart Agent
|
244
62
|
|
@@ -250,11 +68,11 @@ If the `SPLUNK_REALM` or the `OTEL_EXPORTER_JAEGER_ENDPOINT` environmental varia
|
|
250
68
|
|
251
69
|
## Troubleshooting
|
252
70
|
|
253
|
-
For troubleshooting information, see the [
|
71
|
+
For troubleshooting information, see the [Troubleshoot Ruby instrumentation for Splunk Observability Cloud](https://quickdraw.splunk.com/redirect/?product=Observability&version=current&location=ruby.troubleshooting) in the official documentation.
|
254
72
|
|
255
73
|
# License
|
256
74
|
|
257
|
-
The Splunk OpenTelemetry Ruby distribution is
|
75
|
+
The Splunk OpenTelemetry Ruby distribution is licensed under the terms of the
|
258
76
|
Apache Software License version 2.0. For more details, see [the license
|
259
77
|
file](./LICENSE).
|
260
78
|
|
@@ -266,4 +84,3 @@ file](./LICENSE).
|
|
266
84
|
>
|
267
85
|
> 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.
|
268
86
|
|
269
|
-
>ℹ️ SignalFx was acquired by Splunk in October 2019. See [Splunk SignalFx](https://www.splunk.com/en_us/investor-relations/acquisitions/signalfx.html) for more information.
|
data/RELEASING.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Release Process
|
2
|
+
|
3
|
+
## Requirements
|
4
|
+
|
5
|
+
Releases to https://rubygems.org are done through Gitlab CI.
|
6
|
+
|
7
|
+
Scripts for performing the release can be found in `scripts/`. The scripts will
|
8
|
+
both create a draft Github Release and push a Gem.
|
9
|
+
|
10
|
+
## Steps
|
11
|
+
|
12
|
+
- Update `CHANGELOG.md`
|
13
|
+
- Bump version in `lib/splunk/otel/version.rb`
|
14
|
+
- Create PR
|
15
|
+
- Once PR is approved and merged created a tag with the same version as
|
16
|
+
`version.rb` prefixed with `v` and push the tag
|
17
|
+
- Watch Gitlab CI for the `release` job to complete
|
18
|
+
- Update the newly created Github Release notes with the contents of
|
19
|
+
`CHANGELOG.md`
|
data/docs/README.md
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
The
|
2
|
-
|
3
|
-
https://docs.splunk.com/Observability/gdi/get-data-in/application/ruby/get-started.html
|
1
|
+
The documentation for this distribution can be found in the [Splunk Observability Cloud official documentation](https://quickdraw.splunk.com/redirect/?product=Observability&version=current&location=ruby.application).
|
data/docs/advanced-config.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
> The official Splunk documentation for this page is [Configure the Splunk Distribution of OTel Ruby](https://quickdraw.splunk.com/redirect/?product=Observability&version=current&location=ruby.configuration).
|
2
|
+
>
|
3
|
+
> For instructions on how to contribute to the docs, see [CONTRIBUTING.md](../CONTRIBUTING.md#documentation).
|
4
|
+
|
1
5
|
# Advanced configuration
|
2
6
|
|
3
7
|
## Trace exporters
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at tsloughter+work@splunk.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in sinatra_example.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
|
10
|
+
gem "test-unit", "~> 3.0"
|
11
|
+
|
12
|
+
gem "rubocop", "~> 1.7"
|
13
|
+
|
14
|
+
gem "opentelemetry-instrumentation-pg"
|
15
|
+
gem "opentelemetry-instrumentation-sinatra"
|
16
|
+
gem "pg"
|
17
|
+
gem "puma"
|
18
|
+
gem "sinatra", "~> 3.0"
|
19
|
+
gem "splunk-otel"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Sinatra and PG Example
|
2
|
+
|
3
|
+
This example contains a Sinatra webapp that connects to and queries a Postgres
|
4
|
+
database (see the `docker-compose.yml` file for running the database).
|
5
|
+
|
6
|
+
Sinatra and PG are instrumented through OpenTelemetry libraries enabled in
|
7
|
+
`config.ru`:
|
8
|
+
|
9
|
+
``` ruby
|
10
|
+
OpenTelemetry::SDK.configure do |c|
|
11
|
+
c.use 'OpenTelemetry::Instrumentation::Sinatra'
|
12
|
+
c.use 'OpenTelemetry::Instrumentation::PG'
|
13
|
+
end
|
14
|
+
```
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
By default the spans are output to the console but this can be overriden by
|
19
|
+
setting the environment varirable `OTEL_TRACES_EXPORTER`.
|
20
|
+
|
21
|
+
``` shell
|
22
|
+
$ docker-compose up -d
|
23
|
+
|
24
|
+
$ bundle install
|
25
|
+
|
26
|
+
$ bundle exec rackup
|
27
|
+
```
|
28
|
+
|
29
|
+
From a separate shell:
|
30
|
+
|
31
|
+
``` shell
|
32
|
+
$ curl 0.0.0.0:9292
|
33
|
+
query result is [["1", "2", "3"]]
|
34
|
+
```
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler/setup"
|
5
|
+
|
6
|
+
Bundler.require
|
7
|
+
ENV["OTEL_TRACES_EXPORTER"] ||= "console"
|
8
|
+
OpenTelemetry::SDK.configure do |c|
|
9
|
+
c.use "OpenTelemetry::Instrumentation::Sinatra"
|
10
|
+
c.use "OpenTelemetry::Instrumentation::PG"
|
11
|
+
end
|
12
|
+
|
13
|
+
require "./lib/sinatra_example"
|
14
|
+
run SinatraExample::App
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "sinatra_example/version"
|
4
|
+
require "sinatra"
|
5
|
+
require "splunk/otel"
|
6
|
+
|
7
|
+
module SinatraExample
|
8
|
+
class Error < StandardError; end
|
9
|
+
|
10
|
+
# Sinatra example app with postgres query
|
11
|
+
class App < Sinatra::Base
|
12
|
+
set :bind, "0.0.0.0"
|
13
|
+
|
14
|
+
get "/" do
|
15
|
+
conn = PG::Connection.open(host: "localhost",
|
16
|
+
port: "5432",
|
17
|
+
user: "test",
|
18
|
+
dbname: "test",
|
19
|
+
password: "password")
|
20
|
+
r = conn.exec("SELECT 1, 2, 3").values
|
21
|
+
|
22
|
+
"query result is #{r}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/sinatra_example/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "sinatra_example"
|
7
|
+
spec.version = SinatraExample::VERSION
|
8
|
+
spec.authors = ["Tristan Sloughter"]
|
9
|
+
spec.email = ["tsloughter+work@splunk.com"]
|
10
|
+
|
11
|
+
spec.summary = "Example instrumented sinatra app"
|
12
|
+
spec.description = "Example instrumented sinatra app"
|
13
|
+
spec.required_ruby_version = ">= 2.6.0"
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
end
|
data/lib/splunk/otel/version.rb
CHANGED
data/lib/splunk/otel.rb
CHANGED
@@ -124,7 +124,7 @@ module Splunk
|
|
124
124
|
# add the access token header if the env variable is set
|
125
125
|
def set_access_token_header
|
126
126
|
splunk_access_token = ENV.fetch("SPLUNK_ACCESS_TOKEN", nil)
|
127
|
-
return if splunk_access_token.
|
127
|
+
return if splunk_access_token.to_s.empty?
|
128
128
|
|
129
129
|
access_header = "x-sf-token=#{splunk_access_token}"
|
130
130
|
headers = ENV.fetch("OTEL_EXPORTER_OTLP_HEADERS", nil)
|
@@ -15,4 +15,4 @@ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg -
|
|
15
15
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
16
16
|
|
17
17
|
apt-get update
|
18
|
-
apt-get -y install gh
|
18
|
+
apt-get -y install gh
|
data/scripts/release.sh
CHANGED
@@ -31,8 +31,10 @@ create_gh_release() {
|
|
31
31
|
--title "Release $release_tag"
|
32
32
|
}
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
# the gem publish for the tag is the most important so do that first
|
36
35
|
bundle install
|
37
36
|
bundle exec rake build
|
38
37
|
bundle exec gem push pkg/splunk-otel-${release_version}.gem
|
38
|
+
|
39
|
+
create_gh_release
|
40
|
+
|
data/splunk-otel.gemspec
CHANGED
@@ -28,22 +28,24 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_dependency "opentelemetry-api", "~> 1.0"
|
29
29
|
spec.add_dependency "opentelemetry-exporter-jaeger", ">= 0.20.1", "< 0.23.0"
|
30
30
|
spec.add_dependency "opentelemetry-exporter-otlp", ">= 0.21", "< 0.25"
|
31
|
-
spec.add_dependency "opentelemetry-instrumentation-base", "~> 0.21
|
31
|
+
spec.add_dependency "opentelemetry-instrumentation-base", "~> 0.21"
|
32
32
|
spec.add_dependency "opentelemetry-propagator-b3", ">= 0.19.2", "< 0.21.0"
|
33
33
|
spec.add_dependency "opentelemetry-sdk", "~> 1.0"
|
34
34
|
|
35
35
|
# development tooling
|
36
36
|
spec.add_development_dependency "appraisal", "2.4.1"
|
37
|
+
spec.add_development_dependency "bundler", "2.3.26"
|
37
38
|
spec.add_development_dependency "rake", "13.0.6"
|
38
|
-
spec.add_development_dependency "rubocop", "1.
|
39
|
+
spec.add_development_dependency "rubocop", "1.50.2"
|
39
40
|
spec.add_development_dependency "rubocop-rake", "0.6.0"
|
40
|
-
spec.add_development_dependency "simplecov", "0.
|
41
|
+
spec.add_development_dependency "simplecov", "0.22.0"
|
41
42
|
spec.add_development_dependency "simplecov-cobertura", "2.1.0"
|
42
|
-
spec.add_development_dependency "test-unit", "3.5.
|
43
|
+
spec.add_development_dependency "test-unit", "3.5.8"
|
44
|
+
spec.add_development_dependency "tzinfo-data", "1.2023.3"
|
43
45
|
|
44
46
|
# development dependencies for integration testing
|
45
|
-
spec.add_development_dependency "opentelemetry-instrumentation-action_pack", "~> 0.
|
46
|
-
spec.add_development_dependency "opentelemetry-instrumentation-rack", "~> 0.
|
47
|
+
spec.add_development_dependency "opentelemetry-instrumentation-action_pack", "~> 0.5.0"
|
48
|
+
spec.add_development_dependency "opentelemetry-instrumentation-rack", "~> 0.22.1"
|
47
49
|
spec.add_development_dependency "rack", "~> 2.2"
|
48
50
|
spec.add_development_dependency "rack-test", "~> 2.0"
|
49
51
|
spec.add_development_dependency "rails"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splunk-otel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Splunk
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -70,14 +70,14 @@ dependencies:
|
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: 0.21
|
73
|
+
version: '0.21'
|
74
74
|
type: :runtime
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
78
|
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: 0.21
|
80
|
+
version: '0.21'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: opentelemetry-propagator-b3
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,6 +126,20 @@ dependencies:
|
|
126
126
|
- - '='
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: 2.4.1
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: bundler
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - '='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: 2.3.26
|
136
|
+
type: :development
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - '='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 2.3.26
|
129
143
|
- !ruby/object:Gem::Dependency
|
130
144
|
name: rake
|
131
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,14 +160,14 @@ dependencies:
|
|
146
160
|
requirements:
|
147
161
|
- - '='
|
148
162
|
- !ruby/object:Gem::Version
|
149
|
-
version: 1.
|
163
|
+
version: 1.50.2
|
150
164
|
type: :development
|
151
165
|
prerelease: false
|
152
166
|
version_requirements: !ruby/object:Gem::Requirement
|
153
167
|
requirements:
|
154
168
|
- - '='
|
155
169
|
- !ruby/object:Gem::Version
|
156
|
-
version: 1.
|
170
|
+
version: 1.50.2
|
157
171
|
- !ruby/object:Gem::Dependency
|
158
172
|
name: rubocop-rake
|
159
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,14 +188,14 @@ dependencies:
|
|
174
188
|
requirements:
|
175
189
|
- - '='
|
176
190
|
- !ruby/object:Gem::Version
|
177
|
-
version: 0.
|
191
|
+
version: 0.22.0
|
178
192
|
type: :development
|
179
193
|
prerelease: false
|
180
194
|
version_requirements: !ruby/object:Gem::Requirement
|
181
195
|
requirements:
|
182
196
|
- - '='
|
183
197
|
- !ruby/object:Gem::Version
|
184
|
-
version: 0.
|
198
|
+
version: 0.22.0
|
185
199
|
- !ruby/object:Gem::Dependency
|
186
200
|
name: simplecov-cobertura
|
187
201
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,42 +216,56 @@ dependencies:
|
|
202
216
|
requirements:
|
203
217
|
- - '='
|
204
218
|
- !ruby/object:Gem::Version
|
205
|
-
version: 3.5.
|
219
|
+
version: 3.5.8
|
220
|
+
type: :development
|
221
|
+
prerelease: false
|
222
|
+
version_requirements: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - '='
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: 3.5.8
|
227
|
+
- !ruby/object:Gem::Dependency
|
228
|
+
name: tzinfo-data
|
229
|
+
requirement: !ruby/object:Gem::Requirement
|
230
|
+
requirements:
|
231
|
+
- - '='
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: 1.2023.3
|
206
234
|
type: :development
|
207
235
|
prerelease: false
|
208
236
|
version_requirements: !ruby/object:Gem::Requirement
|
209
237
|
requirements:
|
210
238
|
- - '='
|
211
239
|
- !ruby/object:Gem::Version
|
212
|
-
version:
|
240
|
+
version: 1.2023.3
|
213
241
|
- !ruby/object:Gem::Dependency
|
214
242
|
name: opentelemetry-instrumentation-action_pack
|
215
243
|
requirement: !ruby/object:Gem::Requirement
|
216
244
|
requirements:
|
217
245
|
- - "~>"
|
218
246
|
- !ruby/object:Gem::Version
|
219
|
-
version: 0.
|
247
|
+
version: 0.5.0
|
220
248
|
type: :development
|
221
249
|
prerelease: false
|
222
250
|
version_requirements: !ruby/object:Gem::Requirement
|
223
251
|
requirements:
|
224
252
|
- - "~>"
|
225
253
|
- !ruby/object:Gem::Version
|
226
|
-
version: 0.
|
254
|
+
version: 0.5.0
|
227
255
|
- !ruby/object:Gem::Dependency
|
228
256
|
name: opentelemetry-instrumentation-rack
|
229
257
|
requirement: !ruby/object:Gem::Requirement
|
230
258
|
requirements:
|
231
259
|
- - "~>"
|
232
260
|
- !ruby/object:Gem::Version
|
233
|
-
version: 0.
|
261
|
+
version: 0.22.1
|
234
262
|
type: :development
|
235
263
|
prerelease: false
|
236
264
|
version_requirements: !ruby/object:Gem::Requirement
|
237
265
|
requirements:
|
238
266
|
- - "~>"
|
239
267
|
- !ruby/object:Gem::Version
|
240
|
-
version: 0.
|
268
|
+
version: 0.22.1
|
241
269
|
- !ruby/object:Gem::Dependency
|
242
270
|
name: rack
|
243
271
|
requirement: !ruby/object:Gem::Requirement
|
@@ -300,17 +328,14 @@ files:
|
|
300
328
|
- CONTRIBUTING.md
|
301
329
|
- Gemfile
|
302
330
|
- LICENSE
|
303
|
-
- MIGRATING.md
|
304
331
|
- README.md
|
332
|
+
- RELEASING.md
|
305
333
|
- Rakefile
|
306
334
|
- SECURITY.md
|
307
335
|
- conf/otel-collector-config.yaml
|
308
336
|
- docker-compose.yml
|
309
337
|
- docs/README.md
|
310
338
|
- docs/advanced-config.md
|
311
|
-
- docs/correlating-traces-and-logs.md
|
312
|
-
- docs/instrumenting-rails.md
|
313
|
-
- docs/troubleshooting.md
|
314
339
|
- examples/basic/README.md
|
315
340
|
- examples/basic/collector_trace.png
|
316
341
|
- examples/basic/console.rb
|
@@ -326,6 +351,18 @@ files:
|
|
326
351
|
- examples/rails-7-barebones/docker-compose.yml
|
327
352
|
- examples/rails-7-barebones/tests-e2e/rails_7_barebones_test.rb
|
328
353
|
- examples/rails-7-barebones/wait-for.sh
|
354
|
+
- examples/sinatra_example/.gitignore
|
355
|
+
- examples/sinatra_example/.rubocop.yml
|
356
|
+
- examples/sinatra_example/CHANGELOG.md
|
357
|
+
- examples/sinatra_example/CODE_OF_CONDUCT.md
|
358
|
+
- examples/sinatra_example/Gemfile
|
359
|
+
- examples/sinatra_example/README.md
|
360
|
+
- examples/sinatra_example/Rakefile
|
361
|
+
- examples/sinatra_example/config.ru
|
362
|
+
- examples/sinatra_example/docker-compose.yml
|
363
|
+
- examples/sinatra_example/lib/sinatra_example.rb
|
364
|
+
- examples/sinatra_example/lib/sinatra_example/version.rb
|
365
|
+
- examples/sinatra_example/sinatra_example.gemspec
|
329
366
|
- examples/smart-agent/.gitignore
|
330
367
|
- examples/smart-agent/Gemfile
|
331
368
|
- examples/smart-agent/docker-compose.yml
|
data/MIGRATING.md
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
# Migrate from the SignalFx Tracing Library for Ruby
|
2
|
-
|
3
|
-
The SignalFx Tracing Library for Ruby is scheduled to be deprecated by the end of 2022.
|
4
|
-
Replace it with the Splunk Distribution of OpenTelemetry Ruby.
|
5
|
-
|
6
|
-
Splunk Distribution of OpenTelemetry Ruby is based on and compatible with
|
7
|
-
the OpenTelemetry Instrumentation for Ruby,
|
8
|
-
an open-source project that uses the OpenTelemetry API.
|
9
|
-
|
10
|
-
## Compatibility and requirements
|
11
|
-
|
12
|
-
The Splunk Distribution of OpenTelemetry Ruby requires Ruby 2.6 and
|
13
|
-
higher.
|
14
|
-
|
15
|
-
## Known limitations compared to SignalFx Tracing for Ruby
|
16
|
-
|
17
|
-
- Different subset of supported Ruby versions, see previous section
|
18
|
-
- Currently no auto-instrumentation for:
|
19
|
-
- `elasticsearch` (<https://github.com/elastic/elasticsearch-ruby>)
|
20
|
-
- `grape` (<https://github.com/ruby-grape/grape>)
|
21
|
-
- `sequel` (<https://github.com/jeremyevans/sequel>)
|
22
|
-
|
23
|
-
More details in [OTel instrumentation equivalents](#signalfx-instrumentations-equivalents).
|
24
|
-
|
25
|
-
## Migrate to the Splunk Distribution of OpenTelemetry Ruby
|
26
|
-
|
27
|
-
To migrate from the SignalFx Tracing Library for Ruby to the Splunk
|
28
|
-
Distribution of OpenTelemetry Ruby, follow these steps:
|
29
|
-
|
30
|
-
1. Remove the tracing library packages.
|
31
|
-
2. Deploy the Splunk Distribution of OpenTelemetry Ruby.
|
32
|
-
3. Migrate your existing configuration.
|
33
|
-
|
34
|
-
> Semantic conventions for span names and attributes change when you
|
35
|
-
migrate.
|
36
|
-
|
37
|
-
### Remove the SignalFx Tracing Library for Ruby
|
38
|
-
|
39
|
-
Follow these steps to remove the tracing library and its dependencies:
|
40
|
-
|
41
|
-
1. Uninstall `signalfx`:
|
42
|
-
|
43
|
-
``` bash
|
44
|
-
gem uninstall signalfx
|
45
|
-
```
|
46
|
-
|
47
|
-
1. Remove `signalfx` from your Gemfile.
|
48
|
-
|
49
|
-
## Migrate to the Splunk Distribution of OpenTelemetry Ruby
|
50
|
-
|
51
|
-
We're currently only testing installation using Bundler with RubyGems as a source.
|
52
|
-
[Contact us](mailto:ssg-observability-instrumentals-ruby@splunk.com) if you require a different way of installation.
|
53
|
-
|
54
|
-
If you installed
|
55
|
-
[Smart Agent](https://github.com/signalfx/signalfx-agent)
|
56
|
-
to serve as a gateway (traces/metrics data proxy)
|
57
|
-
migrate to
|
58
|
-
[OpenTelemetry Collector](https://docs.splunk.com/Observability/gdi/opentelemetry/resources.html)
|
59
|
-
first, as soon as (if) possible.
|
60
|
-
|
61
|
-
### Deploy the Splunk Distribution of OpenTelemetry Ruby
|
62
|
-
|
63
|
-
To install the Splunk Distribution of OpenTelemetry Ruby, see the [README.md](README.md).
|
64
|
-
|
65
|
-
### Replace SignalFx / OpenTracing gems with OTel equivalents
|
66
|
-
|
67
|
-
1. Make a list of all `signalfx-*` instrumentation gems from your Gemfile, see
|
68
|
-
[this table](https://github.com/signalfx/signalfx-ruby-tracing#supported-libraries)
|
69
|
-
for a complete list.
|
70
|
-
|
71
|
-
1. Replace them with OpenTelemetry, as per the table below.
|
72
|
-
|
73
|
-
1. Replace any other OpenTracing instrumentation packages you might have installed yourself.
|
74
|
-
|
75
|
-
<a name="signalfx-instrumentations-equivalents"></a>
|
76
|
-
#### OTel equivalents of SignalFx instrumentation gems
|
77
|
-
|
78
|
-
| SignalFx instrumentation name | OTel instrumentation name | notes |
|
79
|
-
| ----------------------------- | ------------------------- | ----- |
|
80
|
-
| signalfx-activerecord-opentracing | opentelemetry-instrumentation-active_record | |
|
81
|
-
| signalfx-elasticsearch-instrumentation | no known equivalents | [open issue in OTel](https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues/8) |
|
82
|
-
| signalfx-faraday-instrumentation | opentelemetry-instrumentation-faraday | |
|
83
|
-
| signalfx-grape-instrumentation | no known equivalents | [open issue in OTel](https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues/9) |
|
84
|
-
| signalfgx-mongodb-instrumentation | opentelemetry-instrumentation-mongo | |
|
85
|
-
| signalfx-mysql2-instrumentation | opentelemetry-instrumentation-mysql2 | |
|
86
|
-
| signalfx-nethttp-instrumentation | opentelemetry-instrumentation-net_http | |
|
87
|
-
| signalfx-pg-instrumentation | opentelemetry-instrumentation-pg | |
|
88
|
-
| signalfx-rack-tracer | opentelemetry-instrumentation-rack | |
|
89
|
-
| signalfx-rails-instrumentation | opentelemetry-instrumentation-rails | |
|
90
|
-
| signalfx-redis-instrumentation | opentelemetry-instrumentation-redis | |
|
91
|
-
| signalfx-restclient-instrumentation | opentelemetry-instrumentation-restclient | |
|
92
|
-
| signalfx-sequel-instrumentation | no known equivalents | [open issue in OTel](https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues/11) |
|
93
|
-
| signalfx-sidekiq-opentracing | opentelemetry-instrumentation-sidekiq | |
|
94
|
-
| signalfx-sinatra-instrumentation | opentelemetry-instrumentation-sinatra | |
|
95
|
-
|
96
|
-
#### OTel equivalents of other Open Tracing instrumentation gems
|
97
|
-
|
98
|
-
See the
|
99
|
-
[list of all known OTel Ruby instrumentations](https://opentelemetry.io/registry/?language=ruby&component=instrumentation)
|
100
|
-
in OpenTelemetry registry.
|
101
|
-
|
102
|
-
### Migrate settings for the Splunk Distribution of OpenTelemetry Ruby
|
103
|
-
|
104
|
-
1. `SIGNALFX_ENDPOINT_URL` or `ingest_url` configuration parameter
|
105
|
-
- if you installed Smart Agent and can migrate to OpenTelemetry Collector, do that first, then see the point below
|
106
|
-
- if you have OpenTelemetry Collector available up as a sidecar (via `localhost`),
|
107
|
-
and it accepts OTLP on default ports, just remove this setting, we export OTLP to OTel Collector by default
|
108
|
-
- if you need to keep using Smart Agent, you have to set up a jaeger exporter yourself
|
109
|
-
- if you export directly to our backend (without OTel Collector as a proxy),
|
110
|
-
just set `SPLUNK_REALM` to your realm
|
111
|
-
(it's part of the URL, ie. `https://app.<realm>.signalfx.com/`, or `us0` if it's missing)
|
112
|
-
|
113
|
-
1. `SIGNALFX_SERVICE_NAME` or `service_name` configuration parameter
|
114
|
-
- to set in environment, use `OTEL_SERVICE_NAME`
|
115
|
-
- to set in code, use `Splunk::Otel.configure(service_name: 'your service name', ...`
|
116
|
-
|
117
|
-
1. `SIGNALFX_ACCESS_TOKEN` or `access_token` configuration parameter
|
118
|
-
- to set in environment, use `SPLUNK_ACCESS_TOKEN`
|
119
|
-
|
120
|
-
1. `SIGNALFX_SPAN_TAGS` or `span_tags` configuration parameter
|
121
|
-
- to set in environment:
|
122
|
-
- first, you need to rewrite the existing value to the,
|
123
|
-
which has a syntax of comma-separated `<key>=<value>` pairs (e.g. `key1=value1,key2=value2`)
|
124
|
-
- set `OTEL_RESOURCE_ATTRIBUTES` to the new value
|
125
|
-
- to set in code:
|
126
|
-
- call `OpenTelemetry::SDK::Resources::Resource.create` with a `Hash`
|
127
|
-
consisting of your existing key-value pairs
|
128
|
-
- pass the newly created `Resource` to the `resource=` attribute in configuration
|
129
|
-
- for example:
|
130
|
-
```ruby
|
131
|
-
Splunk::Otel.configure(other_args) do |c|
|
132
|
-
c.resource = OpenTelemetry::SDK::Resources::Resource.create(
|
133
|
-
"key" => "value"
|
134
|
-
)
|
135
|
-
# ...
|
136
|
-
end
|
137
|
-
```
|
138
|
-
|
139
|
-
1. `SIGNALFX_RECORDED_VALUE_MAX_LENGTH`
|
140
|
-
- can be set in environment using `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`
|
141
|
-
- see
|
142
|
-
[the list of span limits settings](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md#span-limits)
|
143
|
-
to learn more
|
144
|
-
|
145
|
-
1. `tracer` configuration parameter
|
146
|
-
- if you need to set its equivalent, open an issue, and tell us about your use case
|
147
|
-
|
148
|
-
For more information about Splunk Ruby OTel settings, see [advanced-config.md](docs/advanced-config.md).
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# Correlating trace and logs
|
2
|
-
|
3
|
-
## Standard Ruby logger
|
4
|
-
|
5
|
-
To add trace metadata of the current trace to logs, use the
|
6
|
-
`Splunk::Otel::Logging.format_correlation` function of the
|
7
|
-
[Ruby standard logger](https://ruby-doc.org/stdlib-3.1.1/libdoc/logger/rdoc/Logger.html)
|
8
|
-
to set the formatter, as in the following example:
|
9
|
-
|
10
|
-
``` ruby
|
11
|
-
require "splunk/otel"
|
12
|
-
|
13
|
-
logger.formatter = proc do |severity, datetime, progname, msg|
|
14
|
-
"#{Splunk::Otel::Logging.format_correlation} : #{msg}\n"
|
15
|
-
end
|
16
|
-
```
|
17
|
-
|
18
|
-
This adds `service.name=<ServiceName> trace_id=<TraceId> span_id=<SpanId>` to each log line.
|
19
|
-
|
20
|
-
```
|
21
|
-
service.name=basic-service trace_id=789b159aaee2b389a8771b2588278bcf
|
22
|
-
span_id=6d26eba14a81f3fa : show log correlation
|
23
|
-
```
|
data/docs/instrumenting-rails.md
DELETED
data/docs/troubleshooting.md
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# Troubleshooting
|
2
|
-
|
3
|
-
## Enable debug logging
|
4
|
-
|
5
|
-
When things are not working, a good first step is to restart the program with
|
6
|
-
debug logging enabled. Do this by setting the `OTEL_LOG_LEVEL` environment
|
7
|
-
variable to `debug`.
|
8
|
-
|
9
|
-
```sh
|
10
|
-
export OTEL_LOG_LEVEL="debug"
|
11
|
-
```
|
12
|
-
|
13
|
-
Make sure to unset the environment variable after the issue is resolved, as its
|
14
|
-
output might overload systems if left on indefinitely.
|