Skip to content

Commit

Permalink
Merge branch 'main' into otel-resource-attributes-env
Browse files Browse the repository at this point in the history
  • Loading branch information
inssein committed Mar 2, 2024
2 parents 09d652e + 70288a7 commit 76d88fe
Show file tree
Hide file tree
Showing 65 changed files with 803 additions and 125 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 @@ -58,7 +58,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.152.0
uses: ruby/setup-ruby@v1.165.1
with:
ruby-version: "${{ inputs.ruby }}"
working-directory: "${{ steps.setup.outputs.gem_dir }}"
Expand All @@ -69,7 +69,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.152.0
uses: ruby/setup-ruby@v1.165.1
with:
ruby-version: "${{ inputs.ruby }}"
bundler: "latest"
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- opentelemetry-common
- opentelemetry-logs-api
- opentelemetry-metrics-api
- opentelemetry-metrics-sdk
- opentelemetry-registry
- opentelemetry-sdk
- opentelemetry-sdk-experimental
Expand All @@ -32,6 +33,11 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: "Test Ruby 3.3"
uses: ./.github/actions/test_gem
with:
gem: "${{ matrix.gem }}"
ruby: "3.3"
- name: "Test Ruby 3.2"
uses: ./.github/actions/test_gem
with:
Expand Down Expand Up @@ -90,6 +96,11 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: "Test Ruby 3.3"
uses: ./.github/actions/test_gem
with:
gem: "${{ matrix.gem }}"
ruby: "3.3"
- name: "Test Ruby 3.2"
uses: ./.github/actions/test_gem
with:
Expand Down Expand Up @@ -157,6 +168,11 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: "Test Ruby 3.3"
uses: ./.github/actions/test_gem
with:
gem: "${{ matrix.gem }}"
ruby: "3.3"
- name: "Test Ruby 3.2"
uses: ./.github/actions/test_gem
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
tools: latest

- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
4 changes: 2 additions & 2 deletions .github/workflows/release-hook-on-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1.165.1
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.5"
- name: Process release request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-hook-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1.165.1
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.5"
- name: Update open releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-perform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1.165.1
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.5"
- name: Perform release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1.165.1
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.5"
- name: Open release pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-retry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Install Ruby ${{ env.ruby_version }}
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1.165.1
with:
ruby-version: ${{ env.ruby_version }}
- name: Checkout repo
uses: actions/checkout@v2
- name: Install Toys
run: "gem install --no-document toys"
run: "gem install --no-document toys -v 0.15.5"
- name: Retry release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Mark stale issues and pull requests

on:
schedule:
- cron: "30 1 * * *"

jobs:
stale:

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v9
name: Clean up stale issues and PRs
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: "👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `keep` label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot."
stale-issue-label: "stale"
exempt-issue-labels: "keep"
days-before-issue-stale: 30
days-before-issue-close: 30
stale-pr-message: "👋 This pull request has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the `keep` label to hold stale off permanently, or do nothing. If you do nothing this pull request will be closed eventually by the stale bot"
stale-pr-label: "stale"
exempt-pr-labels: "keep"
days-before-pr-stale: 30
days-before-pr-close: 30
3 changes: 2 additions & 1 deletion .toys/.toys.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
toys_version! ">= 0.14.5"
toys_version! ">= 0.15.5"

load_git remote: "https://github.com/dazuma/toys.git",
path: ".toys/release",
as: "release",
commit: "common-tools/v0.15.5.1",
update: 3600
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# 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 @kaylareopelle
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration for Ruby base image
ARG ALPINE_VERSION=3.10
ARG RUBY_VERSION=2.6.5
ARG ALPINE_VERSION=3.13
ARG RUBY_VERSION=3.0.0

FROM ruby:"${RUBY_VERSION}-alpine${ALPINE_VERSION}" as ruby

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Approvers ([@open-telemetry/ruby-approvers](https://github.com/orgs/open-telemet
- [Andrew Hayworth](https://github.com/ahayworth), Shopify
- [Sam Handler](https://github.com/plantfansam), Shopify
- [Robb Kidd](https://github.com/robbkidd), Honeycomb
- [Kayla Reopelle](https://github.com/kaylareopelle), New Relic

*Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/master/community-membership.md#approver).*

Expand Down Expand Up @@ -66,7 +67,7 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
[contrib-repo]: https://github.com/open-telemetry/opentelemetry-ruby-contrib
[contrib-instrumentations]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation
[examples-github]: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/examples
[getting-started]: https://opentelemetry.io/docs/ruby/
[getting-started]: https://opentelemetry.io/docs/languages/ruby/
[issues-good-first-issue]: https://github.com/open-telemetry/opentelemetry-ruby/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
[issues-help-wanted]: https://github.com/open-telemetry/opentelemetry-ruby/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
Expand Down
8 changes: 8 additions & 0 deletions api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release History: opentelemetry-api

### v1.2.5 / 2024-02-20

* FIXED: Replace Context stack on clear

### v1.2.4 / 2024-02-06

* FIXED: SystemStackError in Composite Text Map Propagator (#1590)

### v1.2.3 / 2023-09-18

* FIXED: Optimize span and trace ID generation
Expand Down
5 changes: 4 additions & 1 deletion api/lib/opentelemetry/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ def value(key)
current.value(key)
end

# Clears the fiber-local Context stack. This allocates a new array for the
# stack, which is important in some use-cases to avoid sharing the backing
# array between fibers.
def clear
stack.clear
Thread.current[STACK_KEY] = []
end

def empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def extract(carrier, context: Context.current, getter: Context::Propagation.text
# @return [Array<String>] a list of fields that will be used by this propagator.
def fields
injectors = @injectors || @propagators
injectors.flat_map(&fields).uniq
injectors.flat_map(&:fields).uniq
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion api/lib/opentelemetry/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

module OpenTelemetry
## Current OpenTelemetry version
VERSION = '1.2.3'
VERSION = '1.2.5'
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def inject(carrier, context:, setter: nil)
end
carrier
end

def fields
[@key]
end
end

class TestExtractor
Expand Down Expand Up @@ -124,6 +128,12 @@ def get(carrier, key)
_(context['k3']).must_equal('V3')
end
end

describe '#fields' do
it 'returns all fields from injectors' do
_(propagator.fields).must_equal(%w[k1 k2 k3])
end
end
end

describe 'with buggy injectors / extractors' do
Expand Down
4 changes: 4 additions & 0 deletions common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-common

### v0.20.1 / 2024-02-06

* FIXED: Patch the issue for frozen string on ruby < 3.0 with string interpolation

### v0.20.0 / 2023-06-08

* BREAKING CHANGE: Remove support for EoL Ruby 2.7
Expand Down
2 changes: 1 addition & 1 deletion common/lib/opentelemetry/common/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

module OpenTelemetry
module Common
VERSION = '0.20.0'
VERSION = '0.20.1'
end
end
4 changes: 2 additions & 2 deletions exporter/jaeger/lib/opentelemetry/exporter/jaeger/encoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ module Encoder # rubocop:disable Metrics/ModuleLength

def encoded_process(resource)
service_name = DEFAULT_SERVICE_NAME
tags = resource&.attribute_enumerator&.select do |key, value|
tags = resource&.attribute_enumerator&.reject do |key, value|
service_name = value if key == 'service.name'
key != 'service.name'
key == 'service.name'
end
tags = encoded_tags(tags)
Thrift::Process.new('serviceName' => service_name, 'tags' => tags)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
require 'opentelemetry/exporter/otlp/common'
require 'opentelemetry/sdk'
require 'net/http'
require 'csv'
require 'zlib'

require 'google/rpc/status_pb'
Expand Down
10 changes: 10 additions & 0 deletions exporter/otlp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Release History: opentelemetry-exporter-otlp

### v0.26.3 / 2024-02-01

* FIXED: do not log request failure in backoff?

### v0.26.2 / 2024-01-23

* FIXED: Align endpoint environment variable handling with spec
* FIXED: Require csv for ruby-3.4 compatibility
* FIXED: Add context to metrics reporting of buffer-full events

### v0.26.1 / 2023-07-29

* FIXED: Regenerate v0.20.0 protos
Expand Down
12 changes: 8 additions & 4 deletions exporter/otlp/lib/opentelemetry/exporter/otlp/exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
require 'opentelemetry/common'
require 'opentelemetry/sdk'
require 'net/http'
require 'csv'
require 'zlib'

require 'google/rpc/status_pb'
Expand Down Expand Up @@ -167,8 +166,7 @@ def send_bytes(bytes, timeout:) # rubocop:disable Metrics/CyclomaticComplexity,
redo if backoff?(retry_count: retry_count += 1, reason: response.code)
FAILURE
when Net::HTTPNotFound
OpenTelemetry.handle_error(message: "OTLP exporter received http.code=404 for uri: '#{@path}'")
@metrics_reporter.add_to_counter('otel.otlp_exporter.failure', labels: { 'reason' => response.code })
log_request_failure(response.code)
FAILURE
when Net::HTTPBadRequest, Net::HTTPClientError, Net::HTTPServerError
log_status(response.body)
Expand All @@ -180,6 +178,7 @@ def send_bytes(bytes, timeout:) # rubocop:disable Metrics/CyclomaticComplexity,
redo if backoff?(retry_after: 0, retry_count: retry_count += 1, reason: response.code)
else
@http.finish
log_request_failure(response.code)
FAILURE
end
rescue Net::OpenTimeout, Net::ReadTimeout
Expand Down Expand Up @@ -222,11 +221,16 @@ def log_status(body)
klass_or_nil = ::Google::Protobuf::DescriptorPool.generated_pool.lookup(detail.type_name).msgclass
detail.unpack(klass_or_nil) if klass_or_nil
end.compact
OpenTelemetry.handle_error(message: "OTLP exporter received rpc.Status{message=#{status.message}, details=#{details}}")
OpenTelemetry.handle_error(message: "OTLP exporter received rpc.Status{message=#{status.message}, details=#{details}} for uri=#{@uri}")
rescue StandardError => e
OpenTelemetry.handle_error(exception: e, message: 'unexpected error decoding rpc.Status in OTLP::Exporter#log_status')
end

def log_request_failure(response_code)
OpenTelemetry.handle_error(message: "OTLP exporter received http.code=#{response_code} for uri='#{@uri}' in OTLP::Exporter#send_bytes")
@metrics_reporter.add_to_counter('otel.otlp_exporter.failure', labels: { 'reason' => response_code })
end

def measure_request_duration
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
begin
Expand Down
2 changes: 1 addition & 1 deletion exporter/otlp/lib/opentelemetry/exporter/otlp/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module OpenTelemetry
module Exporter
module OTLP
## Current OpenTelemetry OTLP exporter version
VERSION = '0.26.1'
VERSION = '0.26.3'
end
end
end

0 comments on commit 76d88fe

Please sign in to comment.