Skip to content

Commit 4b7b2a2

Browse files
committed
GHA: Install couchbase-opentelemetry gem for tests
1 parent 6887e5f commit 4b7b2a2

File tree

5 files changed

+57
-26
lines changed

5 files changed

+57
-26
lines changed

.github/workflows/tests.yml

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ jobs:
495495
- uses: actions/download-artifact@v4
496496
with:
497497
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-linux
498+
- uses: actions/download-artifact@v4
499+
with:
500+
name: couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
498501
- uses: actions/download-artifact@v4
499502
with:
500503
name: scripts-${{ needs.source.outputs.gem_version }}
@@ -506,12 +509,17 @@ jobs:
506509
ruby-version: ${{ matrix.ruby }}
507510
- name: Install
508511
run: |
509-
COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
510-
UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
511-
gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
512-
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
512+
COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
513+
COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
514+
mkdir -p local-gem-repo/gems
515+
mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
516+
mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
517+
GEM_REPO_PATH=$(realpath local-gem-repo)
518+
gem generate_index --directory local-gem-repo
519+
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
520+
ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
513521
bundle install
514-
bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
522+
bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION}'
515523
- name: Test
516524
env:
517525
CB_CAVES_LOGS_DIR: caves-logs
@@ -556,6 +564,9 @@ jobs:
556564
- uses: actions/download-artifact@v4
557565
with:
558566
name: couchbase-${{ needs.source.outputs.gem_version }}-arm64-darwin
567+
- uses: actions/download-artifact@v4
568+
with:
569+
name: couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
559570
- uses: actions/download-artifact@v4
560571
with:
561572
name: scripts-${{ needs.source.outputs.gem_version }}
@@ -568,14 +579,17 @@ jobs:
568579
- name: Install
569580
run: |
570581
set -xe
571-
COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
572-
UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
573-
gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
574-
ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
575-
find .
576-
ls -ld ${UNPACKED_GEM_PATH}
582+
COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
583+
COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
584+
mkdir -p local-gem-repo/gems
585+
mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
586+
mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
587+
GEM_REPO_PATH=$(realpath local-gem-repo)
588+
gem generate_index --directory local-gem-repo
589+
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
590+
ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
577591
bundle install
578-
bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
592+
bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION}'
579593
- name: Test
580594
env:
581595
CB_CAVES_LOGS_DIR: caves-logs
@@ -629,6 +643,9 @@ jobs:
629643
- uses: actions/download-artifact@v4
630644
with:
631645
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-darwin
646+
- uses: actions/download-artifact@v4
647+
with:
648+
name: couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
632649
- uses: actions/download-artifact@v4
633650
with:
634651
name: scripts-${{ needs.source.outputs.gem_version }}
@@ -640,12 +657,17 @@ jobs:
640657
ruby-version: ${{ matrix.ruby }}
641658
- name: Install
642659
run: |
643-
COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
644-
UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
645-
gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
646-
ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
660+
COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
661+
COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
662+
mkdir -p local-gem-repo/gems
663+
mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
664+
mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
665+
GEM_REPO_PATH=$(realpath local-gem-repo)
666+
gem generate_index --directory local-gem-repo
667+
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
668+
ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
647669
bundle install
648-
bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
670+
bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION}'
649671
- name: Test
650672
env:
651673
CB_CAVES_LOGS_DIR: caves-logs
@@ -734,6 +756,9 @@ jobs:
734756
- uses: actions/download-artifact@v4
735757
with:
736758
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-linux
759+
- uses: actions/download-artifact@v4
760+
with:
761+
name: couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
737762
- uses: actions/download-artifact@v4
738763
with:
739764
name: scripts-${{ needs.source.outputs.gem_version }}
@@ -745,12 +770,17 @@ jobs:
745770
ruby-version: 3.3
746771
- name: Install
747772
run: |
748-
COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
749-
UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
750-
gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
751-
ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
773+
COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
774+
COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
775+
mkdir -p local-gem-repo/gems
776+
mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
777+
mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
778+
GEM_REPO_PATH=$(realpath local-gem-repo)
779+
gem generate_index --directory local-gem-repo
780+
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
781+
ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
752782
bundle install
753-
bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
783+
bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION}'
754784
- name: Test
755785
env:
756786
TEST_SERVER_VERSION: ${{ matrix.server }}

couchbase-opentelemetry/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ desc "Generate YARD documentation"
2121
task :doc do
2222
require "couchbase/opentelemetry/version"
2323
input_dir = File.join(__dir__, "lib")
24-
output_dir = File.join(__dir__, "doc", "couchbase-ruby-client-#{Couchbase::OpenTelemetry::VERSION}")
24+
output_dir = File.join(__dir__, "doc", "couchbase-ruby-client-opentelemetry-#{Couchbase::OpenTelemetry::VERSION}")
2525
rm_rf output_dir
2626
sh "bundle exec yard doc --no-progress --hide-api private --output-dir #{output_dir} #{input_dir} --main README.md"
2727
puts "#{File.realpath(output_dir)}/index.html"

couchbase-opentelemetry/couchbase-opentelemetry.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616

1717
lib = File.expand_path("lib", __dir__)
1818
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
19+
require "couchbase/opentelemetry/version"
1920

2021
Gem::Specification.new do |spec|
2122
spec.name = "couchbase-opentelemetry"
22-
spec.version = "0.0.1"
23+
spec.version = Couchbase::OpenTelemetry::VERSION
2324
spec.authors = ["Sergey Avseyev"]
2425
spec.email = ["sergey.avseyev@gmail.com"]
2526
spec.summary = "OpenTelemetry integration for the Couchbase Ruby Client"

couchbase-opentelemetry/lib/couchbase/opentelemetry.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616

1717
require_relative "opentelemetry/request_tracer"
1818
require_relative "opentelemetry/meter"
19+
require_relative "opentelemetry/version"

couchbase-opentelemetry/lib/couchbase/opentelemetry/request_span.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ def initialize(span)
2828
end
2929

3030
def set_attribute(key, value)
31-
@wrapped
32-
.set_attribute(key, value)
31+
@wrapped.set_attribute(key, value)
3332
end
3433

3534
def status=(status_code)

0 commit comments

Comments
 (0)