Skip to content

Commit

Permalink
Merge branch 'main' into sinatra-rack-optional
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin authored Jun 20, 2024
2 parents 331f36b + 989da17 commit 710bfac
Show file tree
Hide file tree
Showing 81 changed files with 436 additions and 142 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.178.0
uses: ruby/setup-ruby@v1.180.1
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.176.0
uses: ruby/setup-ruby@v1.180.1
with:
ruby-version: "${{ inputs.ruby }}"
bundler: "latest"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conventional-commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
name: Conventional Commits Validation
runs-on: ubuntu-latest
steps:
- uses: dev-build-deploy/commit-me@v1.4.1
- uses: dev-build-deploy/commit-me@v1.5.0
env:
FORCE_COLOR: 3
with:
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.178.0
- uses: ruby/setup-ruby@v1.180.1
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.178.0
uses: ruby/setup-ruby@v1.180.1
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.178.0
uses: ruby/setup-ruby@v1.180.1
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.178.0
uses: ruby/setup-ruby@v1.180.1
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ jobs:
name: Process Release
runs-on: ubuntu-latest
steps:
- uses: googleapis/[email protected].1
- uses: googleapis/[email protected].3
id: prepare
# with:
# token: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}

outputs:
paths_released: ${{ steps.prepare.outputs.paths_released }}
Expand Down Expand Up @@ -48,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.178.0
- uses: ruby/setup-ruby@v1.180.1
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.178.0
uses: ruby/setup-ruby@v1.180.1
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.178.0
uses: ruby/setup-ruby@v1.180.1
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.178.0
uses: ruby/setup-ruby@v1.180.1
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
Expand Down
78 changes: 39 additions & 39 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
{
"helpers/mysql": "0.0.0",
"helpers/sql_obfuscation": "0.0.0",
"instrumentation/gruf": "0.1.1",
"instrumentation/grape": "0.1.6",
"instrumentation/racecar": "0.3.0",
"instrumentation/rake": "0.2.1",
"instrumentation/rdkafka": "0.4.2",
"instrumentation/trilogy": "0.58.0",
"helpers/mysql": "0.1.1",
"helpers/sql_obfuscation": "0.1.1",
"instrumentation/base": "0.22.4",
"instrumentation/graphql": "0.28.2",
"instrumentation/gruf": "0.2.1",
"instrumentation/racecar": "0.3.2",
"instrumentation/rake": "0.2.2",
"instrumentation/rdkafka": "0.4.6",
"instrumentation/trilogy": "0.59.3",
"instrumentation/active_support": "0.5.1",
"instrumentation/action_mailer": "0.1.0",
"instrumentation/action_view": "0.7.0",
"instrumentation/action_pack": "0.9.0",
"instrumentation/active_job": "0.7.1",
"instrumentation/resque": "0.5.0",
"instrumentation/bunny": "0.21.1",
"instrumentation/base": "0.22.3",
"instrumentation/active_record": "0.7.0",
"instrumentation/aws_sdk": "0.5.0",
"instrumentation/resque": "0.5.2",
"instrumentation/bunny": "0.21.3",
"instrumentation/active_record": "0.7.2",
"instrumentation/aws_sdk": "0.5.2",
"instrumentation/aws_lambda": "0.1.0",
"instrumentation/lmdb": "0.22.1",
"instrumentation/http": "0.23.2",
"instrumentation/graphql": "0.27.0",
"instrumentation/http_client": "0.22.3",
"instrumentation/httpx": "0.1.1",
"instrumentation/koala": "0.20.2",
"instrumentation/lmdb": "0.22.2",
"instrumentation/http": "0.23.3",
"instrumentation/http_client": "0.22.6",
"instrumentation/httpx": "0.1.2",
"instrumentation/koala": "0.20.5",
"instrumentation/active_model_serializers": "0.20.1",
"instrumentation/concurrent_ruby": "0.21.2",
"instrumentation/dalli": "0.25.0",
"instrumentation/delayed_job": "0.22.1",
"instrumentation/ethon": "0.21.3",
"instrumentation/excon": "0.22.0",
"instrumentation/faraday": "0.23.4",
"instrumentation/mongo": "0.22.2",
"instrumentation/mysql2": "0.25.0",
"instrumentation/net_http": "0.22.4",
"instrumentation/pg": "0.26.1",
"instrumentation/que": "0.7.1",
"instrumentation/rack": "0.24.0",
"instrumentation/rails": "0.30.0",
"instrumentation/redis": "0.25.3",
"instrumentation/restclient": "0.22.3",
"instrumentation/rspec": "0.3.2",
"instrumentation/ruby_kafka": "0.21.0",
"instrumentation/sidekiq": "0.25.0",
"instrumentation/sinatra": "0.23.2",
"instrumentation/concurrent_ruby": "0.21.3",
"instrumentation/dalli": "0.25.3",
"instrumentation/delayed_job": "0.22.2",
"instrumentation/ethon": "0.21.7",
"instrumentation/excon": "0.22.3",
"instrumentation/faraday": "0.24.4",
"instrumentation/mongo": "0.22.3",
"instrumentation/mysql2": "0.27.1",
"instrumentation/net_http": "0.22.6",
"instrumentation/pg": "0.27.3",
"instrumentation/que": "0.8.1",
"instrumentation/rack": "0.24.5",
"instrumentation/rails": "0.30.2",
"instrumentation/grape": "0.1.8",
"instrumentation/redis": "0.25.6",
"instrumentation/restclient": "0.22.6",
"instrumentation/rspec": "0.3.3",
"instrumentation/ruby_kafka": "0.21.1",
"instrumentation/sidekiq": "0.25.5",
"instrumentation/sinatra": "0.23.5",
"instrumentation/all": "0.56.0",
"processor/baggage": "0.1.0",
"processor/baggage": "0.2.0",
"propagator/ottrace": "0.21.2",
"propagator/xray": "0.22.1",
"resources/azure": "0.1.0",
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ services:
command: ./start_server.sh
working_dir: /app/instrumentation/sinatra/example

processor-baggage-test:
<<: *base
working_dir: /app/processor/baggage
command: |
bash -c "bundle install && rake"
mongo:
image: mongo:4.4
expose:
Expand Down
4 changes: 4 additions & 0 deletions helpers/mysql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-helpers-mysql

### v0.1.1 / 2024-06-18

* FIXED: Relax otel common gem constraints

### v0.1.0 / 2024-02-08

Initial release.
2 changes: 1 addition & 1 deletion helpers/mysql/lib/opentelemetry/helpers/mysql/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module OpenTelemetry
module Helpers
module MySQL
VERSION = '0.1.0'
VERSION = '0.1.1'
end
end
end
2 changes: 1 addition & 1 deletion helpers/mysql/opentelemetry-helpers-mysql.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'opentelemetry-api', '~> 1.0'
spec.add_dependency 'opentelemetry-common', '~> 0.20'
spec.add_dependency 'opentelemetry-common', '~> 0.21'

spec.add_development_dependency 'bundler', '~> 2.4'
spec.add_development_dependency 'minitest', '~> 5.0'
Expand Down
4 changes: 4 additions & 0 deletions helpers/sql-obfuscation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-helpers-sql-obfuscation

### v0.1.1 / 2024-06-18

* FIXED: Relax otel common gem constraints

### v0.1.0 / 2024-02-08

Initial release.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module OpenTelemetry
module Helpers
module SqlObfuscation
VERSION = '0.1.0'
VERSION = '0.1.1'
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'opentelemetry-common', '~> 0.20'
spec.add_dependency 'opentelemetry-common', '~> 0.21'

spec.add_development_dependency 'bundler', '~> 2.4'
spec.add_development_dependency 'minitest', '~> 5.0'
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/active_job/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
gem 'activejob', "~> #{version}"
end
end

appraise 'activejob-latest' do
gem 'activejob'
end
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def start(name, id, payload)
# @return [Hash] with the span and generated context tokens
def start_span(name, _id, payload)
span = tracer.start_span(name, attributes: @mapper.call(payload))
tokens = [OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span))]
token = OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span))

{ span: span, ctx_tokens: tokens }
{ span: span, ctx_token: token }
end

# Creates a span and registers it with the current context
Expand All @@ -55,20 +55,20 @@ def start_span(name, _id, payload)
def finish(_name, _id, payload)
otel = payload.delete(:__otel)
span = otel&.fetch(:span)
tokens = otel&.fetch(:ctx_tokens)
token = otel&.fetch(:ctx_token)

on_exception((payload[:error] || payload[:exception_object]), span)
rescue StandardError => e
OpenTelemetry.handle_error(exception: e)
ensure
finish_span(span, tokens)
finish_span(span, token)
end

# Finishes the provided spans and also detaches the associated contexts
#
# @param span [OpenTelemetry::Trace::Span]
# @param tokens [Array] to unregister
def finish_span(span, tokens)
# @param token [Numeric] to unregister
def finish_span(span, token)
# closes the span after all attributes have been finalized
begin
if span&.recording?
Expand All @@ -79,8 +79,7 @@ def finish_span(span, tokens)
OpenTelemetry.handle_error(exception: e)
end

# pops the context stack
tokens&.reverse_each do |token|
begin
OpenTelemetry::Context.detach(token)
rescue StandardError => e
OpenTelemetry.handle_error(exception: e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ def initialize(...)
def start_span(name, _id, payload)
job = payload.fetch(:job)
span = tracer.start_span(@span_name_formatter.call(job), kind: :producer, attributes: @mapper.call(payload))
tokens = [OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span))]
OpenTelemetry.propagation.inject(job.__otel_headers) # This must be transmitted over the wire
{ span: span, ctx_tokens: tokens }
{ span: span, ctx_token: OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span)) }
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def initialize(...)
# @param payload [Hash] containing job run information
# @return [Hash] with the span and generated context tokens
def start_span(name, _id, payload)
tokens = []
job = payload.fetch(:job)
parent_context = OpenTelemetry.propagation.extract(job.__otel_headers)

Expand All @@ -36,30 +35,27 @@ def start_span(name, _id, payload)
# TODO: Refactor into a propagation strategy
propagation_style = @config[:propagation_style]
if propagation_style == :child
tokens << OpenTelemetry::Context.attach(parent_context)
span = tracer.start_span(span_name, kind: :consumer, attributes: @mapper.call(payload))
else
span_context = OpenTelemetry::Trace.current_span(parent_context).context
links = [OpenTelemetry::Trace::Link.new(span_context)] if span_context.valid? && propagation_style == :link
span = tracer.start_root_span(span_name, kind: :consumer, attributes: @mapper.call(payload), links: links)
end

tokens.concat(attach_consumer_context(span))

{ span: span, ctx_tokens: tokens }
{ span: span, ctx_token: attach_consumer_context(span) }
end

# This method attaches a span to multiple contexts:
# 1. Registers the ingress span as the top level ActiveJob span.
# This is used later to enrich the ingress span in children, e.g. setting span status to error when a child event like `discard` terminates due to an error
# 2. Registers the ingress span as the "active" span, which is the default behavior of the SDK.
# @param span [OpenTelemetry::Trace::Span] the currently active span used to record the exception and set the status
# @return [Array] Context tokens that must be detached when finished
# @return [Numeric] Context token that must be detached when finished
def attach_consumer_context(span)
consumer_context = OpenTelemetry::Trace.context_with_span(span)
internal_context = OpenTelemetry::Instrumentation::ActiveJob.context_with_span(span, parent_context: consumer_context)

[consumer_context, internal_context].map { |context| OpenTelemetry::Context.attach(context) }
OpenTelemetry::Context.attach(internal_context)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/active_support/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-instrumentation-active_support

### v0.5.2 / 2024-06-20

* ADDED: ActiveSupport user specified span kind

### v0.5.1 / 2023-11-23

* CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
Expand Down
Loading

0 comments on commit 710bfac

Please sign in to comment.