Skip to content

Commit

Permalink
Merge branch 'open-telemetry:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
cheempz authored Jan 3, 2024
2 parents d6721e6 + 294c200 commit 1cb390b
Show file tree
Hide file tree
Showing 20 changed files with 389 additions and 45 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: Release Please

on:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release:
name: Process Release
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@cc61a07e2da466bebbc19b3a7dd01d6aecb20d1e
id: release

outputs:
paths_released: ${{ steps.release.outputs.paths_released }}

publish:
needs: release
name: Publish Gems
runs-on: ubuntu-latest
if: ${{ needs.release.outputs.paths_released != '[]'}}

strategy:
fail-fast: false
max-parallel: 1
matrix:
path: ${{ fromJson(needs.release.outputs.paths_released) }}

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- name: Setup Ruby
uses: ruby/setup-ruby@af848b40be8bb463a751551a1180d74782ba8a72
with:
ruby-version: 3.0.0

- name: Configure RubyGems
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"

run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
- name: Release Gem
working-directory: ${{ matrix.path }}
run: |
bundle install
bundle exec rake --trace build
bundle exec rake --trace release:rubygem_push
49 changes: 49 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"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.57.0",
"instrumentation/active_support": "0.5.1",
"instrumentation/action_view": "0.7.0",
"instrumentation/action_pack": "0.8.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/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/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.23.5",
"instrumentation/rails": "0.29.1",
"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/all": "0.54.0",
"propagator/ottrace": "0.21.2",
"propagator/xray": "0.22.1",
"resources/azure": "0.1.0",
"resources/container": "0.1.1",
"resources/google_cloud_platform": "0.1.0"
}
20 changes: 10 additions & 10 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
# https://help.github.com/en/articles/about-code-owners
#

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

resources/container/ @scbjans @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
resources/container/ @scbjans @open-telemetry/ruby-contrib-maintainers @open-telemetry/ruby-contrib-approvers @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle

instrumentation/aws_sdk/ @NathanielRN @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
instrumentation/aws_sdk/ @NathanielRN @open-telemetry/ruby-contrib-maintainers @open-telemetry/ruby-contrib-approvers @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle

instrumentation/grape/ @muripic @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
instrumentation/grape/ @muripic @open-telemetry/ruby-contrib-maintainers @open-telemetry/ruby-contrib-approvers @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle

instrumentation/graphql/ @swalkinshaw @rmosolgo @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
instrumentation/graphql/ @swalkinshaw @rmoslogo @open-telemetry/ruby-contrib-maintainers @open-telemetry/ruby-contrib-approvers @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle

instrumentation/httpx/ @HoneyryderChuck @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
instrumentation/httpx/ @HoneyryderChuck @open-telemetry/ruby-contrib-maintainers @open-telemetry/ruby-contrib-approvers @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle

instrumentation/mongo/ @johnnyshields @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
instrumentation/mongo/ @johnnyshields @open-telemetry/ruby-contrib-maintainers @open-telemetry/ruby-contrib-approvers @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle

instrumentation/racecar/ @chrisholmes @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
instrumentation/racecar/ @chrisholmes @open-telemetry/ruby-contrib-maintainers @open-telemetry/ruby-contrib-approvers @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle

instrumentation/rspec/ @chrisholmes @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
instrumentation/rspec/ @chrisholmes @open-telemetry/ruby-contrib-maintainers @open-telemetry/ruby-contrib-approvers @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle

instrumentation/que/ @indrekj @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd
instrumentation/que/ @indrekj @open-telemetry/ruby-contrib-maintainers @open-telemetry/ruby-contrib-approvers @fbogsany @mwear @robertlaurin @dazuma @ericmustin @arielvalentin @ahayworth @plantfansam @robbkidd @simi @kaylareopelle
4 changes: 1 addition & 3 deletions instrumentation/action_pack/test/test_helpers/app_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ def initialize_app(use_exceptions_app: false, remove_rack_tracer_middleware: fal
private

def remove_rack_middleware(application)
application.middleware.delete(
OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
)
application.middleware.delete(Rack::Events)
end

def add_exceptions_app(application)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(app, _options = {})
end

def call(env)
return [307, {}, 'Temporary Redirect'] if should_redirect?(env)
return [307, { 'Location' => '/ok', 'Content-Type' => 'text/plain' }, ['Temporary Redirect']] if should_redirect?(env)

@app.call(env)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class RaisedErrorAPI < Grape::API
it 'sets span status to error' do
_(span.name).must_equal expected_span_name
_(span.status.code).must_equal OpenTelemetry::Trace::Status::ERROR
_(span.status.description).must_equal "Unhandled exception of type: #{expected_error_type}"
_(span.status.description).must_equal expected_error_type
end

it 'records the exception event' do
Expand Down Expand Up @@ -316,7 +316,7 @@ class ErrorInFilterAPI < Grape::API
it 'sets span status to error' do
_(span.name).must_equal expected_span_name
_(span.status.code).must_equal OpenTelemetry::Trace::Status::ERROR
_(span.status.description).must_equal "Unhandled exception of type: #{expected_error_type}"
_(span.status.description).must_equal expected_error_type
end

it 'records the exception event' do
Expand Down
35 changes: 28 additions & 7 deletions instrumentation/graphql/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,39 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'graphql-1.13' do
# Max compatible version of 1.x
appraise 'graphql-1.x' do
gem 'graphql', '~> 1.13'
end

appraise 'graphql-2.0.17' do
gem 'graphql', '2.0.17'
end

# A bug was introduced in 2.0.18 that was fixed in 2.0.19
appraise 'graphql-2.0.18' do
gem 'graphql', '2.0.18'
end

appraise 'graphql-2.x' do
gem 'graphql', '>= 2.0.18', '< 3.0.0'
# Max compatible version of 2.0.x
appraise 'graphql-2.0' do
gem 'graphql', '~> 2.0.27'
end

# Max compatible version of 2.1.x
appraise 'graphql-2.1' do
gem 'graphql', '~> 2.1.8'
end

appraise 'graphql-c_parser-2.2.x' do
gem 'graphql', '~> 2.2.1'
gem 'graphql-c_parser', '~> 1.0.7'
end

appraise 'graphql-2.2.x' do
gem 'graphql', '~> 2.2.1', '< 3.0.0'
end

appraise 'graphql-c_parser-latest' do
gem 'graphql-c_parser'
end

appraise 'graphql-latest' do
gem 'graphql'
end
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
'graphql.execute_multiplex'
]

expected_spans.delete('graphql.lex') unless trace_lex_supported?

expected_result = {
'simpleField' => 'Hello.',
'resolvedField' => { 'originalValue' => 'testing=1', 'uppercasedValue' => 'TESTING=1' }
Expand Down Expand Up @@ -103,7 +105,7 @@
it 'traces the provided schemas' do
SomeOtherGraphQLAppSchema.execute('query SimpleQuery{ __typename }')

_(spans.size).must_equal(8)
_(spans.select { |s| s.name.start_with?('graphql.') }).wont_be(:empty?)
end

it 'does not trace all schemas' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
'graphql.execute_query_lazy',
'graphql.execute_multiplex'
]
expected_spans.delete('graphql.lex') unless trace_lex_supported?

expected_result = {
'simpleField' => 'Hello.',
Expand Down Expand Up @@ -102,7 +103,7 @@

it 'traces the provided schemas' do
SomeOtherGraphQLAppSchema.execute('query SimpleQuery{ __typename }')
_(spans.size).must_equal(8)
_(spans.select { |s| s.name.start_with?('graphql.') }).wont_be(:empty?)
end

it 'does not trace all schemas' do
Expand Down
9 changes: 9 additions & 0 deletions instrumentation/graphql/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,12 @@ def uses_platform_interfaces?
def gem_version
Gem::Version.new(GraphQL::VERSION)
end

# When tracing, is the parser expected to call `lex` before `parse`
def trace_lex_supported?
return @trace_lex_supported if defined?(@trace_lex_supported)

# In GraphQL 2.2, the default parser was changed such that `lex` is no longer called
@trace_lex_supported = Gem::Requirement.new('< 2.2').satisfied_by?(Gem::Version.new(GraphQL::VERSION)) \
|| (defined?(GraphQL::CParser) == 'constant')
end
2 changes: 1 addition & 1 deletion instrumentation/rack/example/trace_demonstration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
builder = Rack::Builder.app do
# integration should be automatic in web frameworks (like rails),
# but for a plain Rack application, enable it in your config.ru, e.g.,
use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
use ::Rack::Events, [OpenTelemetry::Instrumentation::Rack::Middlewares::EventHandler.new]

app = ->(_env) { [200, { 'Content-Type' => 'text/plain' }, ['All responses are OK']] }
run app
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/rack/example/trace_demonstration2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end

# integrate instrumentation explicitly:
builder.use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
builder.use ::Rack::Events, [OpenTelemetry::Instrumentation::Rack::Middlewares::EventHandler.new]

# demonstrate tracing (span output to console):
puts Rack::MockRequest.new(builder).get('/')
2 changes: 1 addition & 1 deletion instrumentation/rack/example/trace_demonstration3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
builder = Rack::Builder.app do
# integration should be automatic in web frameworks (like rails),
# but for a plain Rack application, enable it in your config.ru, e.g.,
use OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
use ::Rack::Events, [OpenTelemetry::Instrumentation::Rack::Middlewares::EventHandler.new]

app = ->(_env) { [200, { 'Content-Type' => 'text/plain' }, ['All responses are OK']] }
run app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base
option :url_quantization, default: nil, validate: :callable
option :untraced_requests, default: nil, validate: :callable
option :response_propagators, default: [], validate: :array
# This option is only valid for applicaitons using Rack 2.0 or greater
option :use_rack_events, default: false, validate: :boolean
# This option is only valid for applications using Rack 2.0 or greater
option :use_rack_events, default: true, validate: :boolean

# Temporary Helper for Sinatra and ActionPack middleware to use during installation
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def on_error(request, _, error)
return unless span.recording?

span.record_exception(error)
span.status = OpenTelemetry::Trace::Status.error
span.status = OpenTelemetry::Trace::Status.error(error.class.name)
rescue StandardError => e
OpenTelemetry.handle_error(exception: e)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def call(env)
tracer.in_span(request_span_name,
attributes: request_span_attributes(env: env),
kind: request_span_kind) do |request_span|
request_start_time = OpenTelemetry::Instrumentation::Rack::Util::QueueTime.get_request_start(env)
request_span.add_event('http.proxy.request.started', timestamp: request_start_time) unless request_start_time.nil?
OpenTelemetry::Instrumentation::Rack.with_span(request_span) do
@app.call(env).tap do |status, headers, response|
set_attributes_after_request(request_span, status, headers, response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
_(instrumentation.config[:url_quantization]).must_be_nil
_(instrumentation.config[:untraced_requests]).must_be_nil
_(instrumentation.config[:response_propagators]).must_be_empty
_(instrumentation.config[:use_rack_events]).must_equal false
_(instrumentation.config[:use_rack_events]).must_equal true
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
let(:exporter) { EXPORTER }
let(:finished_spans) { exporter.finished_spans }
let(:first_span) { exporter.finished_spans.first }
let(:proxy_event) { first_span.events&.first }

let(:default_config) { {} }
let(:config) { default_config }
Expand Down Expand Up @@ -84,6 +85,15 @@
end
end

describe 'given request proxy headers' do
let(:env) { Hash('HTTP_X_REQUEST_START' => '1677723466') }

it 'records an event' do
_(proxy_event.name).must_equal 'http.proxy.request.started'
_(proxy_event.timestamp).must_equal 1_677_723_466_000_000_000
end
end

describe 'config[:untraced_endpoints]' do
describe 'when an array is passed in' do
let(:config) { { untraced_endpoints: ['/ping'] } }
Expand Down

This file was deleted.

Loading

0 comments on commit 1cb390b

Please sign in to comment.