diff --git a/.github/actions/test_gem/action.yml b/.github/actions/test_gem/action.yml index cf4350590..c26f0d703 100644 --- a/.github/actions/test_gem/action.yml +++ b/.github/actions/test_gem/action.yml @@ -66,7 +66,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.203.0 + uses: ruby/setup-ruby@v1.207.0 with: ruby-version: "${{ inputs.ruby }}" working-directory: "${{ steps.setup.outputs.gem_dir }}" @@ -77,7 +77,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.203.0 + uses: ruby/setup-ruby@v1.207.0 with: ruby-version: "${{ inputs.ruby }}" bundler: "latest" diff --git a/.github/workflows/ci-markdown-link.yml b/.github/workflows/ci-markdown-link.yml index 7b42be0c1..626a8fce4 100644 --- a/.github/workflows/ci-markdown-link.yml +++ b/.github/workflows/ci-markdown-link.yml @@ -2,6 +2,8 @@ name: Markdown Link Check on: pull_request: + paths: + - '**/*.md' jobs: markdown-link-check: @@ -9,9 +11,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: "Markdown Link Check" - uses: gaurav-nelson/github-action-markdown-link-check@v1 + # equivalent cli: linkspector check + - name: Run linkspector + uses: umbrelladocs/action-linkspector@v1 with: - config-file: '.markdown-link-check.json' - use-quiet-mode: 'yes' - use-verbose-mode: 'yes' + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-review + fail_on_error: true diff --git a/.github/workflows/ci-markdownlint.yml b/.github/workflows/ci-markdownlint.yml index 037b2fa9e..93350d7c4 100644 --- a/.github/workflows/ci-markdownlint.yml +++ b/.github/workflows/ci-markdownlint.yml @@ -11,7 +11,7 @@ jobs: # equivalent cli: markdownlint-cli2 "**/*.md" "#**/CHANGELOG.md" --config .markdownlint.json - name: "Markdown Lint Check" - uses: DavidAnson/markdownlint-cli2-action@v18 + uses: DavidAnson/markdownlint-cli2-action@v19 with: fix: false globs: | diff --git a/.github/workflows/installation-tests.yml b/.github/workflows/installation-tests.yml index dca91e495..18b81bef6 100644 --- a/.github/workflows/installation-tests.yml +++ b/.github/workflows/installation-tests.yml @@ -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.203.0 + - uses: ruby/setup-ruby@v1.207.0 with: ruby-version: ${{ matrix.ruby-version }} - name: "Install Latest Gem Versions on ${{ matrix.ruby-version }}" diff --git a/.github/workflows/release-hook-on-closed.yml b/.github/workflows/release-hook-on-closed.yml index 317b713a8..3bf8d5e19 100644 --- a/.github/workflows/release-hook-on-closed.yml +++ b/.github/workflows/release-hook-on-closed.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Ruby ${{ env.ruby_version }} - uses: ruby/setup-ruby@v1.203.0 + uses: ruby/setup-ruby@v1.207.0 with: ruby-version: ${{ env.ruby_version }} - name: Checkout repo diff --git a/.github/workflows/release-hook-on-push.yml b/.github/workflows/release-hook-on-push.yml index 33781582a..72b3b2ab8 100644 --- a/.github/workflows/release-hook-on-push.yml +++ b/.github/workflows/release-hook-on-push.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Ruby ${{ env.ruby_version }} - uses: ruby/setup-ruby@v1.203.0 + uses: ruby/setup-ruby@v1.207.0 with: ruby-version: ${{ env.ruby_version }} - name: Checkout repo diff --git a/.github/workflows/release-perform.yml b/.github/workflows/release-perform.yml index fec719443..59ae1c289 100644 --- a/.github/workflows/release-perform.yml +++ b/.github/workflows/release-perform.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Ruby ${{ env.ruby_version }} - uses: ruby/setup-ruby@v1.203.0 + uses: ruby/setup-ruby@v1.207.0 with: ruby-version: ${{ env.ruby_version }} - name: Checkout repo diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 3b0197b8d..73568b13b 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -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.203.0 + - uses: ruby/setup-ruby@v1.207.0 with: ruby-version: "3.0" bundler: latest diff --git a/.github/workflows/release-request-weekly.yml b/.github/workflows/release-request-weekly.yml index f76a5118e..a9dacf40d 100644 --- a/.github/workflows/release-request-weekly.yml +++ b/.github/workflows/release-request-weekly.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Ruby ${{ env.ruby_version }} - uses: ruby/setup-ruby@v1.203.0 + uses: ruby/setup-ruby@v1.207.0 with: ruby-version: ${{ env.ruby_version }} - name: Checkout repo diff --git a/.github/workflows/release-request.yml b/.github/workflows/release-request.yml index 9d05b3d6f..cfea8d665 100644 --- a/.github/workflows/release-request.yml +++ b/.github/workflows/release-request.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Ruby ${{ env.ruby_version }} - uses: ruby/setup-ruby@v1.203.0 + uses: ruby/setup-ruby@v1.207.0 with: ruby-version: ${{ env.ruby_version }} - name: Checkout repo diff --git a/.github/workflows/release-retry.yml b/.github/workflows/release-retry.yml index 0066ea7e2..f716f3947 100644 --- a/.github/workflows/release-retry.yml +++ b/.github/workflows/release-retry.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Ruby ${{ env.ruby_version }} - uses: ruby/setup-ruby@v1.203.0 + uses: ruby/setup-ruby@v1.207.0 with: ruby-version: ${{ env.ruby_version }} - name: Checkout repo diff --git a/.markdown-link-check.json b/.markdown-link-check.json deleted file mode 100644 index 12284d673..000000000 --- a/.markdown-link-check.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ignorePatterns": [ - { - "pattern": "^http://localhost" - } - ], - "timeout": "5s", - "retryOn429": true, - "aliveStatusCodes": [200, 206, 429] -} diff --git a/instrumentation/active_model_serializers/README.md b/instrumentation/active_model_serializers/README.md index 728cdf74b..7e8fe0bd5 100644 --- a/instrumentation/active_model_serializers/README.md +++ b/instrumentation/active_model_serializers/README.md @@ -32,7 +32,7 @@ end ## Examples -Example usage of active_model_serializers can be seen in the `./example/active_model_serializers.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/active_model_serializers/example/active_model_serializers.rb) +Example usage of active_model_serializers can be seen in the `./example/` folder [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/active_model_serializers/example) ## How can I get involved? diff --git a/instrumentation/faraday/Appraisals b/instrumentation/faraday/Appraisals index 0c19136a4..4ed32e342 100644 --- a/instrumentation/faraday/Appraisals +++ b/instrumentation/faraday/Appraisals @@ -4,7 +4,7 @@ # # SPDX-License-Identifier: Apache-2.0 -%w[0.17.6 1.0 2.0].each do |version| +%w[1.0 2.0].each do |version| appraise "faraday-#{version}" do gem 'faraday', "~> #{version}" end diff --git a/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/instrumentation.rb b/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/instrumentation.rb index 17d4826e8..a194d709e 100644 --- a/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/instrumentation.rb +++ b/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/instrumentation.rb @@ -10,12 +10,18 @@ module Faraday # The Instrumentation class contains logic to detect and install the Faraday # instrumentation class Instrumentation < OpenTelemetry::Instrumentation::Base + MINIMUM_VERSION = Gem::Version.new('1.0') + install do |_config| require_dependencies register_tracer_middleware use_middleware_by_default end + compatible do + gem_version >= MINIMUM_VERSION + end + present do defined?(::Faraday) end @@ -25,10 +31,13 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base private + def gem_version + Gem::Version.new(::Faraday::VERSION) + end + def require_dependencies require_relative 'middlewares/tracer_middleware' require_relative 'patches/connection' - require_relative 'patches/rack_builder' end def register_tracer_middleware @@ -38,11 +47,7 @@ def register_tracer_middleware end def use_middleware_by_default - if Gem::Version.new(::Faraday::VERSION) >= Gem::Version.new('1') - ::Faraday::Connection.prepend(Patches::Connection) - else - ::Faraday::RackBuilder.prepend(Patches::RackBuilder) - end + ::Faraday::Connection.prepend(Patches::Connection) end end end diff --git a/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/patches/connection.rb b/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/patches/connection.rb index 51d8ad0b5..1819488ad 100644 --- a/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/patches/connection.rb +++ b/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/patches/connection.rb @@ -13,7 +13,7 @@ module Patches module Connection # Wraps Faraday::Connection#initialize: # https://github.com/lostisland/faraday/blob/ff9dc1d1219a1bbdba95a9a4cf5d135b97247ee2/lib/faraday/connection.rb#L62-L92 - def initialize(*args) + def initialize(...) super.tap do use(:open_telemetry) unless builder.handlers.any? do |handler| handler.klass == Middlewares::TracerMiddleware diff --git a/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/patches/rack_builder.rb b/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/patches/rack_builder.rb deleted file mode 100644 index 1b32a00da..000000000 --- a/instrumentation/faraday/lib/opentelemetry/instrumentation/faraday/patches/rack_builder.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -# Copyright The OpenTelemetry Authors -# -# SPDX-License-Identifier: Apache-2.0 - -module OpenTelemetry - module Instrumentation - module Faraday - module Patches - # Module to be prepended to force Faraday to use the middleware by - # default so the user doesn't have to call `use` for every connection. - module RackBuilder - def adapter(*args) - use(:open_telemetry) unless @handlers.any? do |handler| - handler.klass == Faraday::Middlewares::TracerMiddleware - end - - super - end - end - end - end - end -end diff --git a/instrumentation/pg/lib/opentelemetry/instrumentation/pg/constants.rb b/instrumentation/pg/lib/opentelemetry/instrumentation/pg/constants.rb index 73d9c8710..d248cbdb0 100644 --- a/instrumentation/pg/lib/opentelemetry/instrumentation/pg/constants.rb +++ b/instrumentation/pg/lib/opentelemetry/instrumentation/pg/constants.rb @@ -40,10 +40,10 @@ module Constants LISTEN LOAD LOCK + MERGE MOVE NOTIFY PREPARE - PREPARE REASSIGN REFRESH REINDEX @@ -54,7 +54,6 @@ module Constants SAVEPOINT SECURITY SELECT - SELECT SET SHOW START diff --git a/instrumentation/pg/test/fixtures/sql_table_name.json b/instrumentation/pg/test/fixtures/sql_table_name.json index 7cf96681f..852d1dcea 100644 --- a/instrumentation/pg/test/fixtures/sql_table_name.json +++ b/instrumentation/pg/test/fixtures/sql_table_name.json @@ -54,5 +54,9 @@ { "name": "table_name_with_double_quotes", "sql": "SELECT columns FROM \"test_table\"" + }, + { + "name": "merge", + "sql": "MERGE INTO test_table AS t USING other_table AS o ON (o.id = t.id) WHEN MATCHED THEN UPDATE SET x = t.x + 1 WHEN NOT MATCHED THEN INSERT (id, x, status) VALUES (o.id, o.x, o.status)" } ]