Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/test_gem/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ runs:
# ...but not for appraisals, sadly.
- name: Install Ruby ${{ inputs.ruby }} with dependencies
if: "${{ steps.setup.outputs.appraisals == 'false' }}"
uses: ruby/setup-ruby@v1.245.0
uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: "${{ inputs.ruby }}"
working-directory: "${{ steps.setup.outputs.gem_dir }}"
Expand All @@ -95,7 +95,7 @@ runs:
# If we're using appraisals, do it all manually.
- name: Install Ruby ${{ inputs.ruby }} without dependencies
if: "${{ steps.setup.outputs.appraisals == 'true' }}"
uses: ruby/setup-ruby@v1.245.0
uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: "${{ inputs.ruby }}"
bundler: "latest"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: streetsidesoftware/cspell-action@v7
- uses: streetsidesoftware/cspell-action@v6
with:
# Files should be consistent with check:spelling files
files: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-instrumentation-with-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
image: confluentinc/cp-kafka:7.9.1
image: confluentinc/cp-kafka:latest
ports:
- 9092:9092
- 29092:29092
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

# equivalent cli: markdownlint-cli2 "**/*.md" "#**/CHANGELOG.md" --config .markdownlint.json
- name: "Markdown Lint Check"
uses: DavidAnson/markdownlint-cli2-action@v20
continue-on-error: true
uses: DavidAnson/markdownlint-cli2-action@v19
with:
fix: false
globs: |
**/*.md
!**/CHANGELOG.md
continue-on-error: true
2 changes: 1 addition & 1 deletion .github/workflows/fossa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
- uses: fossas/fossa-action@c0a7d013f84c8ee5e910593186598625513cc1e4 # v1.6.0
with:
api-key: ${{secrets.FOSSA_API_KEY}}
team: OpenTelemetry
2 changes: 1 addition & 1 deletion .github/workflows/installation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v4
# ATTENTION: Dependabot does not know how to update shared actions file.
# If you see it update setup-ruby here also update it as part of actions/test_gem/action.yml
- uses: ruby/setup-ruby@v1.245.0
- uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: ${{ matrix.ruby-version }}
- name: "Install Latest Gem Versions on ${{ matrix.ruby-version }}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ossf-scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
persist-credentials: false

- uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
- uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
with:
results_file: results.sarif
results_format: sarif
Expand All @@ -43,6 +43,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/release-hook-on-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1.245.0
uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-hook-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1.245.0
uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-perform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1.245.0
uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials

- uses: ruby/setup-ruby@v1.245.0
- uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: "3.1"
bundler: latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-request-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1.245.0
uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1.245.0
uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-retry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1.245.0
uses: ruby/setup-ruby@v1.237.0
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion .instrumentation_generator/templates/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ group :test do
gem 'opentelemetry-sdk', '~> 1.0'
gem 'opentelemetry-test-helpers', '~> 0.3'
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.76.2'
gem 'rubocop', '~> 1.75.1'
gem 'rubocop-performance', '~> 1.24.0'
gem 'simplecov', '~> 0.17.1'
gem 'webmock', '~> 3.24'
Expand Down
2 changes: 1 addition & 1 deletion .instrumentation_generator/templates/Readme.md.tt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ end

## Examples

Example usage can be seen in the [`./example/trace_demonstration.rb` file](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/<%= instrumentation_name %>/example/trace_demonstration.rb)
Example usage can be seen in the `./example/trace_demonstration.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/<%= instrumentation_name %>/example/trace_demonstration.rb)

## How can I get involved?

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
source 'https://rubygems.org'

gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.76.2'
gem 'rubocop', '~> 1.75.1'
gem 'rubocop-performance', '~> 1.24.0'
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ requests.
The Ruby special interest group (SIG) meets regularly. See the OpenTelemetry
[community page][ruby-sig] repo for information on this and other language SIGs.

### Maintainers
Approvers ([@open-telemetry/ruby-contrib-approvers](https://github.com/orgs/open-telemetry/teams/ruby-contrib-approvers)):

- [Josef Šimánek](https://github.com/simi)
- [Xuan Cao](https://github.com/xuan-cao-swi), Solarwinds

*Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).*

Maintainers ([@open-telemetry/ruby-contrib-maintainers](https://github.com/orgs/open-telemetry/teams/ruby-contrib-maintainers)):

- [Andrew Hayworth](https://github.com/ahayworth)
- [Ariel Valentin](https://github.com/arielvalentin), GitHub
- [Daniel Azuma](https://github.com/dazuma), Google
- [Eric Mustin](https://github.com/ericmustin)
Expand All @@ -38,14 +44,7 @@ The Ruby special interest group (SIG) meets regularly. See the OpenTelemetry
- [Robert Laurin](https://github.com/robertlaurin), Shopify
- [Sam Handler](https://github.com/plantfansam), Shopify

For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).

### Approvers

- [Josef Šimánek](https://github.com/simi)
- [Xuan Cao](https://github.com/xuan-cao-swi), Solarwinds

For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
*Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).*

## Instrumentation Libraries

Expand Down Expand Up @@ -93,7 +92,7 @@ Consult instrumentation gem's README file and gemspec for details about library

### Releases

This repository was extracted from the [OpenTelemetry Ruby repository][otel-ruby]. Versions of libraries contained in this repo released prior to 2022-06-13 are available on the [OpenTelemetry Ruby Releases][otel-ruby-releases] page. Newer versions are available [on the opentelemetry-ruby-contrib Releases page][otel-ruby-contrib-releases].
This repository was extracted from the [OpenTelemetry Ruby repository][otel-ruby]. Versions of libraries contained in this repo released prior to 2022-06-13 are available on the [OpenTelemetry Ruby Releases][otel-ruby-releases] page. Newer versions are available [here][otel-ruby-contrib-releases]

## Useful links

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ services:
ZOOKEEPER_TICK_TIME: 2000

kafka:
image: confluentinc/cp-kafka:7.9.1
image: confluentinc/cp-kafka:latest
ports:
- "9092:9092"
- "29092:29092"
Expand Down
2 changes: 1 addition & 1 deletion helpers/mysql/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ group :test do
gem 'minitest', '~> 5.0'
gem 'opentelemetry-test-helpers', '~> 0.3'
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.76.2'
gem 'rubocop', '~> 1.75.1'
gem 'rubocop-performance', '~> 1.24.0'
gem 'simplecov', '~> 0.22.0'
gem 'yard', '~> 0.9'
Expand Down
2 changes: 1 addition & 1 deletion helpers/sql-obfuscation/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ group :test do
gem 'minitest', '~> 5.0'
gem 'opentelemetry-test-helpers', '~> 0.3'
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.76.2'
gem 'rubocop', '~> 1.75.1'
gem 'rubocop-performance', '~> 1.24.0'
gem 'simplecov', '~> 0.22.0'
gem 'yard', '~> 0.9'
Expand Down
2 changes: 1 addition & 1 deletion helpers/sql/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ group :test do
gem 'minitest', '~> 5.0'
gem 'opentelemetry-test-helpers', '~> 0.3'
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.76.2'
gem 'rubocop', '~> 1.75.1'
gem 'rubocop-performance', '~> 1.24.0'
gem 'simplecov', '~> 0.22.0'
gem 'yard', '~> 0.9'
Expand Down
4 changes: 2 additions & 2 deletions instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Instrumentation libraries provide pre-built OpenTelemetry instrumentation for po

Released instrumentations can be found at the [OpenTelemetry registry](https://opentelemetry.io/registry/?language=ruby&component=instrumentation#). You can also look in this project's Github repository: Individual instrumentation libraries can be found in subdirectories under `/instrumentation`.

[In-progress instrumentations can be found here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues?q=is%3Aopen+label%3Ainstrumentation+-label%3A%22help+wanted%22+).
In-progress instrumentations can be found [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues?q=is%3Aopen+label%3Ainstrumentation+-label%3A%22help+wanted%22+).

## How do I get started?

Expand Down Expand Up @@ -49,7 +49,7 @@ Please review the individual instrumentation READMEs for more information about

The source for all OpenTelemetry Ruby instrumentation gems is [on github](https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation).

If you are interested in helping out with an instrumentation, check out [instrumentations that have been requested but are not currently in-progress](https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues?q=is%3Aopen+label%3Ainstrumentation+label%3A%22help+wanted%22).
If you are interested in helping out with an instrumentation, you can see instrumentations that have been requested but are not currently in-progress [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues?q=is%3Aopen+label%3Ainstrumentation+label%3A%22help+wanted%22).

The OpenTelemetry Ruby gems are maintained by the OpenTelemetry Ruby special interest group (SIG). You can get involved by joining us on our [GitHub Discussions][discussions-url], [Slack Channel][slack-channel] 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].

Expand Down
2 changes: 1 addition & 1 deletion instrumentation/action_mailer/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ group :test do
gem 'opentelemetry-sdk', '~> 1.1'
gem 'opentelemetry-test-helpers', '~> 0.3'
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.76.2'
gem 'rubocop', '~> 1.75.1'
gem 'rubocop-performance', '~> 1.24.0'
gem 'simplecov', '~> 0.22.0'
gem 'webmock', '~> 3.24'
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/action_mailer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Internal spans are named using the name of the `ActiveSupport` event that was pr

## Examples

Example usage can be seen in the [`./example/trace_request_demonstration.ru` file](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/action_mailer/example/trace_request_demonstration.ru)
Example usage can be seen in the `./example/trace_request_demonstration.ru` file [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/action_mailer/example/trace_request_demonstration.ru)

## How can I get involved?

Expand Down
12 changes: 0 additions & 12 deletions instrumentation/action_pack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# Release History: opentelemetry-instrumentation-action_pack

### v0.12.3 / 2025-06-16

* FIXED: Action_pack always assuming sdk spans

### v0.12.2 / 2025-06-04

* FIXED: Rack span class naming

### v0.12.1 / 2025-05-07

* FIXED: Account for `nil` routes

### v0.12.0 / 2025-02-04

* ADDED: Strip Rails `(.:format)` suffix from `http.route`
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/action_pack/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ group :test do
gem 'opentelemetry-sdk', '~> 1.1'
gem 'opentelemetry-test-helpers', '~> 0.3'
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.76.2'
gem 'rubocop', '~> 1.75.1'
gem 'rubocop-performance', '~> 1.24.0'
gem 'simplecov', '~> 0.22.0'
gem 'webmock', '~> 3.24'
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/action_pack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The error object will be retained within `payload[:exception_object]`. Additiona

## Examples

Example usage can be seen in the [`./example/trace_demonstration.rb` file](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/action_pack/example/trace_demonstration.ru)
Example usage can be seen in the `./example/trace_demonstration.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/action_pack/example/trace_demonstration.ru)

## How can I get involved?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,10 @@ def initialize(config)
# @param payload [Hash] the payload passed as a method argument
# @return [Hash] the payload passed as a method argument
def start(_name, _id, payload)
span = OpenTelemetry::Instrumentation::Rack.current_span
return unless span.recording?

request = payload[:request]
# It seems that there are cases in Rails functional tests where it bypasses the routing system and the `action_dispatch.route_uri_pattern` header not being set.
# Our Test suite executes the routing system so we are unable to recreate this error case.
# https://github.com/rails/rails/blob/747f85f200e7bb2c1a31b4e26e5a5655e2dc0cdc/actionpack/lib/action_dispatch/http/request.rb#L160
http_route = request.route_uri_pattern&.chomp('(.:format)') if request.respond_to?(:route_uri_pattern)

attributes = {
OpenTelemetry::SemanticConventions::Trace::CODE_NAMESPACE => String(payload[:controller]),
OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => String(payload[:action])
}
attributes[OpenTelemetry::SemanticConventions::Trace::HTTP_ROUTE] = http_route if http_route
attributes[OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET] = request.filtered_path if request.filtered_path != request.fullpath

if @span_naming == :semconv
span.name = if http_route
"#{request.method} #{http_route}"
else
"#{request.method} /#{payload.dig(:params, :controller)}/#{payload.dig(:params, :action)}"
end
# If there is an exception we want to keep the original span name
# so it is easier to see where the request was routed to.
elsif !request.env['action_dispatch.exception']
span.name = "#{payload[:controller]}##{payload[:action]}"
end
span_name, attributes = to_span_name_and_attributes(payload)

span = OpenTelemetry::Instrumentation::Rack.current_span
span.name = span_name
span.add_attributes(attributes)
rescue StandardError => e
OpenTelemetry.handle_error(exception: e)
Expand All @@ -68,6 +44,32 @@ def finish(_name, _id, payload)
rescue StandardError => e
OpenTelemetry.handle_error(exception: e)
end

private

# Extracts the span name and attributes from the payload
#
# @param payload [Hash] the payload passed from ActiveSupport::Notifications
# @return [Array<String, Hash>] the span name and attributes
def to_span_name_and_attributes(payload)
request = payload[:request]
http_route = request.route_uri_pattern.chomp('(.:format)') if request.respond_to?(:route_uri_pattern)

attributes = {
OpenTelemetry::SemanticConventions::Trace::CODE_NAMESPACE => String(payload[:controller]),
OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => String(payload[:action])
}
attributes[OpenTelemetry::SemanticConventions::Trace::HTTP_ROUTE] = http_route if http_route
attributes[OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET] = request.filtered_path if request.filtered_path != request.fullpath

if @span_naming == :semconv
return ["#{request.method} #{http_route}", attributes] if http_route

return ["#{request.method} /#{payload.dig(:params, :controller)}/#{payload.dig(:params, :action)}", attributes]
end

["#{payload[:controller]}##{payload[:action]}", attributes]
end
end
end
end
Expand Down
Loading
Loading