-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into rails-6.0-eol
- Loading branch information
Showing
44 changed files
with
504 additions
and
710 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ jobs: | |
- koala | ||
- lmdb | ||
- net_http | ||
- httpx | ||
- rack | ||
- rails | ||
- restclient | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ jobs: | |
- gruf | ||
- http | ||
- http_client | ||
- httpx | ||
- koala | ||
- lmdb | ||
- net_http | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
module OpenTelemetry | ||
module Instrumentation | ||
module ActiveSupport | ||
VERSION = '0.4.3' | ||
VERSION = '0.4.4' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--no-private | ||
--title=OpenTelemetry HTTPX Instrumentation | ||
--markup=markdown | ||
--main=README.md | ||
./lib/opentelemetry/instrumentation/**/*.rb | ||
./lib/opentelemetry/instrumentation.rb | ||
- | ||
README.md | ||
CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
appraise 'httpx-1' do | ||
gem 'httpx', '~> 1.0' | ||
end | ||
|
||
appraise 'httpx-0' do | ||
gem 'httpx', '~> 0.24' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Release History: opentelemetry-instrumentation-httpx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# OpenTelemetry Http Instrumentation | ||
|
||
The HTTPX instrumentation is a community-maintained instrumentation for the [HTTPX][httpx-home] gem. | ||
|
||
## How do I get started? | ||
|
||
Install the gem using: | ||
|
||
``` | ||
gem install opentelemetry-instrumentation-httpx | ||
``` | ||
|
||
Or, if you use [bundler][bundler-home], include `opentelemetry-instrumentation-httpx` in your `Gemfile`. | ||
|
||
## Usage | ||
|
||
To use the instrumentation, call `use` with the name of the instrumentation: | ||
|
||
```ruby | ||
OpenTelemetry::SDK.configure do |c| | ||
c.use 'OpenTelemetry::Instrumentation::HTTPX' | ||
end | ||
``` | ||
|
||
Alternatively, you can also call `use_all` to install all the available instrumentation. | ||
|
||
```ruby | ||
OpenTelemetry::SDK.configure do |c| | ||
c.use_all | ||
end | ||
``` | ||
|
||
## How can I get involved? | ||
|
||
The `opentelemetry-instrumentation-httpx` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`. | ||
|
||
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig]. | ||
|
||
## License | ||
|
||
The `opentelemetry-instrumentation-httpx` gem is distributed under the Apache 2.0 license. See [LICENSE][license-github] for more information. | ||
|
||
[http-home]: https://gitlab.com/os85/httpx | ||
[bundler-home]: https://bundler.io | ||
[repo-github]: https://github.com/open-telemetry/opentelemetry-ruby | ||
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE | ||
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig | ||
[community-meetings]: https://github.com/open-telemetry/community#community-meetings | ||
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'bundler/inline' | ||
|
||
gemfile(true) do | ||
source 'https://rubygems.org' | ||
gem 'opentelemetry-api' | ||
gem 'opentelemetry-instrumentation-base' | ||
gem 'opentelemetry-instrumentation-httpx' | ||
gem 'opentelemetry-sdk' | ||
gem 'httpx' | ||
end | ||
|
||
require 'opentelemetry-api' | ||
require 'opentelemetry-sdk' | ||
require 'opentelemetry-instrumentation-httpx' | ||
require 'httpx' | ||
|
||
# Export traces to console by default | ||
ENV['OTEL_TRACES_EXPORTER'] ||= 'console' | ||
|
||
OpenTelemetry::SDK.configure do |c| | ||
c.use 'OpenTelemetry::Instrumentation::HTTPX' | ||
end | ||
|
||
# A basic HTTP example | ||
HTTPX.get('https://github.com') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
instrumentation/httpx/lib/opentelemetry/instrumentation/httpx.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
require 'opentelemetry' | ||
require 'opentelemetry-instrumentation-base' | ||
|
||
module OpenTelemetry | ||
module Instrumentation | ||
# Contains the OpenTelemetry instrumentation for the Http gem | ||
module HTTPX | ||
end | ||
end | ||
end | ||
|
||
require_relative 'httpx/instrumentation' | ||
require_relative 'httpx/version' |
40 changes: 40 additions & 0 deletions
40
instrumentation/httpx/lib/opentelemetry/instrumentation/httpx/instrumentation.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
module OpenTelemetry | ||
module Instrumentation | ||
module HTTPX | ||
# The Instrumentation class contains logic to detect and install the Http instrumentation | ||
class Instrumentation < OpenTelemetry::Instrumentation::Base | ||
install do |_config| | ||
require_dependencies | ||
patch | ||
end | ||
|
||
compatible do | ||
Gem::Version.new(::HTTPX::VERSION) >= Gem::Version.new('0.24.7') | ||
end | ||
|
||
present do | ||
defined?(::HTTPX) | ||
end | ||
|
||
option :peer_service, default: nil, validate: :string | ||
|
||
def patch | ||
otel_session = ::HTTPX.plugin(Plugin) | ||
|
||
::HTTPX.send(:remove_const, :Session) | ||
::HTTPX.send(:const_set, :Session, otel_session.class) | ||
end | ||
|
||
def require_dependencies | ||
require_relative 'plugin' | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.