File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed
Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,20 @@ export GEM_HOME="${RUBY_FULL_VERSION_DIR}"
3434
3535# Ensure rubygems is preloaded and Ruby can find libs within gem directories
3636export RUBYOPT=" ${RUBYOPT:- -rrubygems} "
37- # Add each gem's lib directory to RUBYLIB for extra safety (expanded at shell time)
38- export RUBYLIB=" ${RUBY_FULL_VERSION_DIR} /gems/*/lib:${RUBYLIB:- } "
37+ # Build RUBYLIB as a colon-separated list of each gem's lib directory
38+ LIBS=" "
39+ for d in " ${RUBY_FULL_VERSION_DIR} " /gems/* /lib; do
40+ if [ -d " $d " ]; then
41+ if [ -z " $LIBS " ]; then
42+ LIBS=" $d "
43+ else
44+ LIBS=" $LIBS :$d "
45+ fi
46+ fi
47+ done
48+ if [ -n " $LIBS " ]; then
49+ export RUBYLIB=" ${LIBS} :${RUBYLIB:- } "
50+ fi
3951
4052if [ -z " ${OTEL_SERVICE_NAME} " ]; then
4153 export OTEL_SERVICE_NAME=" $AWS_LAMBDA_FUNCTION_NAME " ;
Original file line number Diff line number Diff line change 1+ # Ensure gem libs are on the load path in case environment hooks are ignored
2+ require 'rubygems'
3+
4+ begin
5+ gem_root = ENV [ 'GEM_PATH' ] || ENV [ 'GEM_HOME' ]
6+ if gem_root && Dir . exist? ( gem_root )
7+ # Ensure RubyGems knows about our layer paths
8+ begin
9+ default_paths = Gem . default_path
10+ Gem . use_paths ( ENV [ 'GEM_HOME' ] || gem_root , [ gem_root , *default_paths ] . uniq )
11+ Gem . refresh
12+ rescue StandardError
13+ # ignore, we still amend $LOAD_PATH manually below
14+ end
15+ Dir . glob ( File . join ( gem_root , 'gems' , '*' , 'lib' ) ) . each do |dir |
16+ $LOAD_PATH. unshift ( dir ) unless $LOAD_PATH. include? ( dir )
17+ end
18+ end
19+ rescue StandardError
20+ # no-op: fall through to requires; errors will surface if libs are missing
21+ end
22+
123require 'opentelemetry/sdk'
224require 'opentelemetry/exporter/otlp'
325require 'opentelemetry/instrumentation/all'
You can’t perform that action at this time.
0 commit comments