Skip to content

Commit

Permalink
Merge branch 'main' into fix-dalli-gat
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlaurin authored Jan 7, 2025
2 parents 236cfc1 + 0cfc9d0 commit 8002aef
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 62 deletions.
4 changes: 2 additions & 2 deletions .github/actions/test_gem/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand All @@ -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"
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/ci-markdown-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ name: Markdown Link Check

on:
pull_request:
paths:
- '**/*.md'

jobs:
markdown-link-check:
runs-on: ubuntu-latest
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
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.203.0
- uses: ruby/setup-ruby@v1.207.0
with:
ruby-version: ${{ matrix.ruby-version }}
- name: "Install Latest Gem Versions on ${{ matrix.ruby-version }}"
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 @@ -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
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.203.0
uses: ruby/setup-ruby@v1.207.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.203.0
uses: ruby/setup-ruby@v1.207.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.203.0
- uses: ruby/setup-ruby@v1.207.0
with:
ruby-version: "3.0"
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.203.0
uses: ruby/setup-ruby@v1.207.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.203.0
uses: ruby/setup-ruby@v1.207.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.203.0
uses: ruby/setup-ruby@v1.207.0
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
Expand Down
10 changes: 0 additions & 10 deletions .markdown-link-check.json

This file was deleted.

2 changes: 1 addition & 1 deletion instrumentation/active_model_serializers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
2 changes: 1 addition & 1 deletion instrumentation/faraday/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ module Constants
LISTEN
LOAD
LOCK
MERGE
MOVE
NOTIFY
PREPARE
PREPARE
REASSIGN
REFRESH
REINDEX
Expand All @@ -54,7 +54,6 @@ module Constants
SAVEPOINT
SECURITY
SELECT
SELECT
SET
SHOW
START
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/pg/test/fixtures/sql_table_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
]

0 comments on commit 8002aef

Please sign in to comment.