Skip to content

Commit

Permalink
Merge branch 'main' into action-pack-instrument-notification
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin authored Nov 9, 2023
2 parents 6dc9184 + 7ba2616 commit 05060e0
Show file tree
Hide file tree
Showing 105 changed files with 828 additions and 851 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ updates:
directory: "/instrumentation/rails"
schedule:
interval: weekly
- package-ecosystem: bundler
directory: "/resource_detectors"
schedule:
interval: weekly
- package-ecosystem: bundler
directory: "/resources/azure"
schedule:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-contrib-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ jobs:
fail-fast: false
matrix:
gem:
- resource_detectors
- resource-detector-azure
- resource-detector-container
- resource-detector-google_cloud_platform
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
fail-fast: false
matrix:
gem:
- resource_detectors
- resource-detector-azure
- resource-detector-container
- resource-detector-google_cloud_platform
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-instrumentation-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- koala
- lmdb
- net_http
- httpx
- rack
- rails
- restclient
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-instrumentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- gruf
- http
- http_client
- httpx
- koala
- lmdb
- net_http
Expand Down
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 @@ -18,7 +18,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.3"
- name: Process release request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 @@ -19,7 +19,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.3"
- name: Update open releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 @@ -28,7 +28,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.3"
- name: Perform release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 @@ -22,7 +22,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.3"
- name: Open release pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 @@ -25,7 +25,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.3"
- name: Retry release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .toys/.data/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ repo: open-telemetry/opentelemetry-ruby-contrib
main_branch: main
# Time in seconds for release scripts to wait for CI to complete.
required_checks_timeout: 1200
required_jobs: "^(ci|CI).*"
# Git user attached to commits for release pull requests.
git_user_name: Ariel Valentin
git_user_email: ariel@arielvalentin.com
Expand Down Expand Up @@ -106,6 +107,10 @@ gems:
directory: instrumentation/http_client
version_constant: [OpenTelemetry, Instrumentation, HttpClient, VERSION]

- name: opentelemetry-instrumentation-httpx
directory: instrumentation/httpx
version_constant: [OpenTelemetry, Instrumentation, HTTPX, VERSION]

- name: opentelemetry-instrumentation-koala
directory: instrumentation/koala
version_constant: [OpenTelemetry, Instrumentation, Koala, VERSION]
Expand Down Expand Up @@ -203,11 +208,6 @@ gems:
directory: propagator/xray
version_constant: [OpenTelemetry, Propagator, XRay, VERSION]

- name: opentelemetry-resource_detectors
directory: resource_detectors
version_rb_path: lib/opentelemetry/resource/detectors/version.rb
version_constant: [OpenTelemetry, Resource, Detectors, VERSION]

- name: opentelemetry-resource-detector-azure
directory: resources/azure
version_rb_path: lib/opentelemetry/resource/detector/azure/version.rb
Expand Down
4 changes: 2 additions & 2 deletions .toys/.toys.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
toys_version! "0.14.7"
toys_version! "0.15.3"

load_git remote: "https://github.com/dazuma/toys.git",
path: ".toys/release",
as: "release",
commit: "toys/v0.14.7",
commit: "toys/v0.15.3",
update: 3600
4 changes: 3 additions & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# https://help.github.com/en/articles/about-code-owners
#

* @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
* @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle @open-telemetry/ruby-contrib-approvers

resources/container/ @scbjans @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd

Expand All @@ -22,6 +22,8 @@ instrumentation/grape/ @muripic @fbogsany @mwear @robertlaurin @dazuma @ericmust

instrumentation/graphql/ @swalkinshaw @rmosolgo @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd

instrumentation/httpx/ @HoneyryderChuck @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd

instrumentation/mongo/ @johnnyshields @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd

instrumentation/racecar/ @chrisholmes @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ _Setting up a running Ruby environment is outside the scope of this document._
This repository contains multiple Ruby gems:

* Various instrumentation gems located in subdirectories of `instrumentation`
* Various resource detector gems located in subdirectories of `resources`
* `opentelemetry-propagator-xray` located in the `propagator/xray` directory
* `opentelemetry-propagator-ottrace` located in the `propagator/ottrace` directory
* `opentelemetry-resource_detectors` located in the `resource_detectors` directory

Each of these gems has its configuration and tests.

For example, to test `opentelemetry-resource_detectors` you would:
For example, to test `opentelemetry-instrumentation-action_pack` you would:

1. Change directory to `resource_detectors`
1. Change directory to `instrumentation/action_pack`
2. Install the bundle with `bundle install`
3. Run the tests with `bundle exec rake`

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

gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1.56.2'
gem 'rubocop', '~> 1.57.1'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ using OpenTelemetry with minimal changes to your application. See the
This repository also contains libraries to aid with interoperablity with vendor specific tracing solutions:

- [Context Propagation](propagator/): OTTrace and Amazon X-Ray
- [Resource Detectors](resource_detectors/):
- [Resource Detectors](resources/):
- Azure
- Container
- Google Cloud Platform
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/action_pack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-instrumentation-action_pack

### v0.7.1 / 2023-10-16

* FIXED: Add Rails 7.1 compatibility

### v0.7.0 / 2023-06-05

* ADDED: Use Rack Middleware Helper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module OpenTelemetry
module Instrumentation
module ActionPack
VERSION = '0.7.0'
VERSION = '0.7.1'
end
end
end
4 changes: 4 additions & 0 deletions instrumentation/action_view/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ end
appraise 'rails-7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
end
4 changes: 4 additions & 0 deletions instrumentation/action_view/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-instrumentation-action_view

### v0.6.1 / 2023-10-16

* FIXED: Add Rails 7.1 compatibility

### v0.6.0 / 2023-06-05

* ADDED: Render layout for action view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module OpenTelemetry
module Instrumentation
module ActionView
VERSION = '0.6.0'
VERSION = '0.6.1'
end
end
end
14 changes: 4 additions & 10 deletions instrumentation/active_job/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'activejob-6.0' do
gem 'activejob', '~> 6.0.0'
end

appraise 'activejob-6.1' do
gem 'activejob', '~> 6.1.0'
end

appraise 'activejob-7.0' do
gem 'activejob', '~> 7.0.0'
%w[6.0.0 6.1.0 7.0.0 7.1.0].each do |version|
appraise "activejob-#{version}" do
gem 'activejob', "~> #{version}"
end
end
4 changes: 4 additions & 0 deletions instrumentation/active_job/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-instrumentation-active_job

### v0.6.1 / 2023-10-16

* FIXED: Add Rails 7.1 compatibility

### v0.6.0 / 2023-09-07

* FIXED: Align messaging instrumentation operation names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def job_attributes(job)
'messaging.destination' => job.queue_name,
'messaging.message_id' => job.job_id,
'messaging.active_job.provider_job_id' => job.provider_job_id,
'messaging.active_job.scheduled_at' => job.scheduled_at,
'messaging.active_job.scheduled_at' => job.scheduled_at&.to_f,
'messaging.active_job.priority' => job.priority
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module OpenTelemetry
module Instrumentation
module ActiveJob
VERSION = '0.6.0'
VERSION = '0.6.1'
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,21 @@
end
end

it 'is set correctly for jobs that do wait' do
it 'records the scheduled at time for apps running Rails 7.1 and newer' do
skip 'scheduled jobs behave differently in Rails 7.1+' if ActiveJob.version < Gem::Version.new('7.1')

job = TestJob.set(wait: 0.second).perform_later

# Only the sending span is a 'scheduled' thing
_(publish_span.attributes['messaging.active_job.scheduled_at']).must_equal(job.scheduled_at)
assert(publish_span.attributes['messaging.active_job.scheduled_at'])
_(publish_span.attributes['messaging.active_job.scheduled_at']).must_equal(job.scheduled_at.to_f)
_(process_span.attributes['messaging.active_job.scheduled_at']).must_equal(job.scheduled_at.to_f)
end

it 'records the scheduled at time for apps running Rails 7.0 or older' do
skip 'scheduled jobs behave differently in Rails 7.1+' if ActiveJob.version >= Gem::Version.new('7.1')

job = TestJob.set(wait: 0.second).perform_later

# The processing span isn't a 'scheduled' thing
_(publish_span.attributes['messaging.active_job.scheduled_at']).must_equal(job.scheduled_at.to_f)
_(process_span.attributes['messaging.active_job.scheduled_at']).must_be_nil
end
end
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/active_record/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ end
appraise 'activerecord-7.0' do
gem 'activerecord', '~> 7.0.0'
end

appraise 'activerecord-7.1' do
gem 'activerecord', '~> 7.1.0'
end
4 changes: 4 additions & 0 deletions instrumentation/active_record/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-instrumentation-active_record

### v0.6.3 / 2023-10-16

* FIXED: Add Rails 7.1 compatibility

### v0.6.2 / 2023-08-14

* FIXED: Ensure that transaction name property is used, rather than self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module OpenTelemetry
module Instrumentation
module ActiveRecord
VERSION = '0.6.2'
VERSION = '0.6.3'
end
end
end
4 changes: 4 additions & 0 deletions instrumentation/active_support/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ end
appraise 'activesupport-7.0' do
gem 'activesupport', '~> 7.0.0'
end

appraise 'activesupport-7.1' do
gem 'activesupport', '~> 7.1.0'
end
8 changes: 8 additions & 0 deletions instrumentation/active_support/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release History: opentelemetry-instrumentation-active_support

### v0.4.4 / 2023-10-31

* FIXED: Remove call to ActiveSupport::Notifications.notifier#synchronize deprecated in Rails 7.2

### v0.4.3 / 2023-10-16

* FIXED: Add Rails 7.1 compatibility

### v0.4.2 / 2023-09-07

FIXED: Reduce Object allocation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,23 @@ def self.subscribe(

subscriber_object = ::ActiveSupport::Notifications.subscribe(pattern, subscriber)

::ActiveSupport::Notifications.notifier.synchronize do
subscribers = ::ActiveSupport::Notifications.notifier.instance_variable_get(:@string_subscribers)[pattern]

if subscribers.nil?
OpenTelemetry.handle_error(
message: 'Unable to move OTEL ActiveSupport Notifications subscriber to the front of the notifications list which may cause incomplete traces.' \
'Please report an issue here: ' \
'https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues/new?labels=bug&template=bug_report.md&title=ActiveSupport%20Notifications%20subscribers%20list%20is%20nil'
)
else
subscribers.unshift(
subscribers.delete(subscriber_object)
)
# this can be removed once we drop support for Rails < 7.2
# see https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/707 for more context
if ::ActiveSupport::Notifications.notifier.respond_to?(:synchronize)
::ActiveSupport::Notifications.notifier.synchronize do
subscribers = ::ActiveSupport::Notifications.notifier.instance_variable_get(:@string_subscribers)[pattern]

if subscribers.nil?
OpenTelemetry.handle_error(
message: 'Unable to move OTEL ActiveSupport Notifications subscriber to the front of the notifications list which may cause incomplete traces.' \
'Please report an issue here: ' \
'https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues/new?labels=bug&template=bug_report.md&title=ActiveSupport%20Notifications%20subscribers%20list%20is%20nil'
)
else
subscribers.unshift(
subscribers.delete(subscriber_object)
)
end
end
end
subscriber_object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module OpenTelemetry
module Instrumentation
module ActiveSupport
VERSION = '0.4.2'
VERSION = '0.4.4'
end
end
end
Loading

0 comments on commit 05060e0

Please sign in to comment.