elastic-apm 4.6.1 → 4.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49b381ca37784473aef9bf3462b37eb77b3d263dfd402adf929c866153f81af3
4
- data.tar.gz: 51f9290d7cace3428273171484ab6f6526e1309bdb2d27a101d9e74a17f9f619
3
+ metadata.gz: f7c28585ab44cfdb7a4eb8c32b8dd60e1ecb10c091357c25a6b13f35a0fe2ffc
4
+ data.tar.gz: 3aad55a03f8c2a4d824ea09731be304e7712ee306dc4e585c5cc29ba11e25413
5
5
  SHA512:
6
- metadata.gz: 55c315cf52ce113f032b471f64d6662d4e5b9d85577bf228913da82c3f114cdc1846c70a8078de2fc7e1362c89f2cff2559b6e6b046007667feeb0c194223e75
7
- data.tar.gz: 9962145d110f552e1beb449e721389cefe17bb862b3e255f48ef236170fa04523c29654f11fb3e1cc89cc5b8f69e14f0678cab51431b86a501ec016631278992
6
+ metadata.gz: eb6480a61567bd000e5325e12702c46882a42a9c452a60bd7af997b7138b076cd332d853f101b694af30d120bdd3b48f1b911feb6ecf12e94cdfc58ba096855c
7
+ data.tar.gz: e626d4a1cb9370780d764385585fb4c4025d612a84b7ef36ae0525f6d6f6a83ddf7d5aa670ccf2610bf10f9e2c2d9a87f2f97818cc9e8de27153c3a85cd34875
@@ -18,7 +18,7 @@ exclude:
18
18
  - RUBY_VERSION: ruby:2.4
19
19
  FRAMEWORK: rails-main
20
20
  - RUBY_VERSION: ruby:2.4
21
- FRAMEWORK: sinatra-master
21
+ FRAMEWORK: sinatra-main
22
22
  - RUBY_VERSION: ruby:2.4
23
23
  FRAMEWORK: grape-master
24
24
 
@@ -61,7 +61,7 @@ exclude:
61
61
  - RUBY_VERSION: ruby:2.4
62
62
  FRAMEWORK: rails-6.0
63
63
 
64
- # Only test rails master on ruby 3.1
64
+ # Only test rails main on ruby 3.1
65
65
  - RUBY_VERSION: ruby:3.0
66
66
  FRAMEWORK: rails-main
67
67
  - RUBY_VERSION: ruby:2.7
@@ -97,23 +97,23 @@ exclude:
97
97
  - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
98
98
  FRAMEWORK: rails-7.0
99
99
 
100
- # Only test sinatra master on ruby 2.7 and ruby 3.1
100
+ # Only test sinatra main on ruby 2.7 and ruby 3.1
101
101
  - RUBY_VERSION: ruby:3.0
102
- FRAMEWORK: sinatra-master
102
+ FRAMEWORK: sinatra-main
103
103
  - RUBY_VERSION: ruby:2.6
104
- FRAMEWORK: sinatra-master
104
+ FRAMEWORK: sinatra-main
105
105
  - RUBY_VERSION: ruby:2.5
106
- FRAMEWORK: sinatra-master
106
+ FRAMEWORK: sinatra-main
107
107
  - RUBY_VERSION: ruby:2.4
108
- FRAMEWORK: sinatra-master
108
+ FRAMEWORK: sinatra-main
109
109
  - RUBY_VERSION: jruby:9.2
110
- FRAMEWORK: sinatra-master
110
+ FRAMEWORK: sinatra-main
111
111
  - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-13-jdk
112
- FRAMEWORK: sinatra-master
112
+ FRAMEWORK: sinatra-main
113
113
  - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-11-jdk
114
- FRAMEWORK: sinatra-master
114
+ FRAMEWORK: sinatra-main
115
115
  - RUBY_VERSION: docker.elastic.co/observability-ci/jruby:9.2-8-jdk
116
- FRAMEWORK: sinatra-master
116
+ FRAMEWORK: sinatra-main
117
117
 
118
118
  # Only test grape master on ruby 2.7 and ruby 3.0
119
119
  - RUBY_VERSION: ruby:2.6
@@ -1,4 +1,4 @@
1
1
  FRAMEWORK:
2
- - rails-main
3
- - sinatra-master
2
+ #- rails-main
3
+ - sinatra-main
4
4
  - grape-master
@@ -6,11 +6,11 @@ RUN apt-get update \
6
6
  && rm -rf /var/lib/apt/lists/*
7
7
 
8
8
  ENV JRUBY_VERSION 9.2.16.0
9
- ENV JRUBY_SHA256 9199707712c683c525252ccb1de5cb8e75f53b790c5b57a18f6367039ec79553
10
9
 
11
10
  RUN mkdir -p /opt/jruby \
11
+ && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz.sha256 -o /tmp/jruby.sha256 \
12
12
  && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz -o /tmp/jruby.tar.gz \
13
- && echo "$JRUBY_SHA256 */tmp/jruby.tar.gz" | sha256sum -c - \
13
+ && echo "$(cat /tmp/jruby.sha256) */tmp/jruby.tar.gz" | sha256sum -c - \
14
14
  && tar -zx --strip-components=1 -f /tmp/jruby.tar.gz -C /opt/jruby \
15
15
  && update-alternatives --install /usr/local/bin/ruby ruby /opt/jruby/bin/jruby 1
16
16
 
@@ -25,7 +25,9 @@ RUN mkdir -p /opt/jruby/etc \
25
25
  } >> /opt/jruby/etc/gemrc
26
26
 
27
27
  # install bundler, gem requires bash to work
28
- RUN gem install bundler rake net-telnet xmlrpc tzinfo-data
28
+ # https://github.com/rubygems/rubygems/issues/2534#issuecomment-448843746
29
+ RUN gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems) \
30
+ && gem install bundler:2.3.26 rake net-telnet xmlrpc tzinfo-data
29
31
 
30
32
  # install things globally, for great justice
31
33
  # and don't create ".bundle" in all our apps
@@ -6,11 +6,11 @@ RUN apt-get update \
6
6
  && rm -rf /var/lib/apt/lists/*
7
7
 
8
8
  ENV JRUBY_VERSION 9.3.1.0
9
- ENV JRUBY_SHA256 9199707712c683c525252ccb1de5cb8e75f53b790c5b57a18f6367039ec79553
10
9
 
11
10
  RUN mkdir -p /opt/jruby \
11
+ && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz.sha256 -o /tmp/jruby.sha256 \
12
12
  && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz -o /tmp/jruby.tar.gz \
13
- && echo "$JRUBY_SHA256 */tmp/jruby.tar.gz" | sha256sum -c - \
13
+ && echo "$(cat /tmp/jruby.sha256) */tmp/jruby.tar.gz" | sha256sum -c - \
14
14
  && tar -zx --strip-components=1 -f /tmp/jruby.tar.gz -C /opt/jruby \
15
15
  && update-alternatives --install /usr/local/bin/ruby ruby /opt/jruby/bin/jruby 1
16
16
 
@@ -6,11 +6,11 @@ RUN apt-get update \
6
6
  && rm -rf /var/lib/apt/lists/*
7
7
 
8
8
  ENV JRUBY_VERSION 9.3.1.0
9
- ENV JRUBY_SHA256 9199707712c683c525252ccb1de5cb8e75f53b790c5b57a18f6367039ec79553
10
9
 
11
10
  RUN mkdir -p /opt/jruby \
11
+ && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz.sha256 -o /tmp/jruby.sha256 \
12
12
  && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz -o /tmp/jruby.tar.gz \
13
- && echo "$JRUBY_SHA256 */tmp/jruby.tar.gz" | sha256sum -c - \
13
+ && echo "$(cat /tmp/jruby.sha256) */tmp/jruby.tar.gz" | sha256sum -c - \
14
14
  && tar -zx --strip-components=1 -f /tmp/jruby.tar.gz -C /opt/jruby \
15
15
  && update-alternatives --install /usr/local/bin/ruby ruby /opt/jruby/bin/jruby 1
16
16
 
@@ -2,15 +2,15 @@ FROM openjdk:7-jdk
2
2
 
3
3
  RUN apt-get update \
4
4
  && apt-get install -y libc6-dev --no-install-recommends \
5
- && apt-get install -y gcc \
5
+ && apt-get install --force-yes -y gcc \
6
6
  && rm -rf /var/lib/apt/lists/*
7
7
 
8
8
  ENV JRUBY_VERSION 9.3.1.0
9
- ENV JRUBY_SHA256 6a22f7bf8fef1a52530a9c9781a9d374ad07bbbef0d3d8e2af0ff5cbead0dfd5
10
9
 
11
10
  RUN mkdir -p /opt/jruby \
11
+ && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz.sha256 -o /tmp/jruby.sha256 \
12
12
  && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz -o /tmp/jruby.tar.gz \
13
- && echo "$JRUBY_SHA256 */tmp/jruby.tar.gz" | sha256sum -c - \
13
+ && echo "$(cat /tmp/jruby.sha256) */tmp/jruby.tar.gz" | sha256sum -c - \
14
14
  && tar -zx --strip-components=1 -f /tmp/jruby.tar.gz -C /opt/jruby \
15
15
  && update-alternatives --install /usr/local/bin/ruby ruby /opt/jruby/bin/jruby 1
16
16
 
@@ -6,11 +6,11 @@ RUN apt-get update \
6
6
  && rm -rf /var/lib/apt/lists/*
7
7
 
8
8
  ENV JRUBY_VERSION 9.2.14.0
9
- ENV JRUBY_SHA256 9199707712c683c525252ccb1de5cb8e75f53b790c5b57a18f6367039ec79553
10
9
 
11
10
  RUN mkdir -p /opt/jruby \
11
+ && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz.sha256 -o /tmp/jruby.sha256 \
12
12
  && curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz -o /tmp/jruby.tar.gz \
13
- && echo "$JRUBY_SHA256 */tmp/jruby.tar.gz" | sha256sum -c - \
13
+ && echo "$(cat /tmp/jruby.sha256) */tmp/jruby.tar.gz" | sha256sum -c - \
14
14
  && tar -zx --strip-components=1 -f /tmp/jruby.tar.gz -C /opt/jruby \
15
15
  && update-alternatives --install /usr/local/bin/ruby ruby /opt/jruby/bin/jruby 1
16
16
 
@@ -25,7 +25,9 @@ RUN mkdir -p /opt/jruby/etc \
25
25
  } >> /opt/jruby/etc/gemrc
26
26
 
27
27
  # install bundler, gem requires bash to work
28
- RUN gem install bundler rake net-telnet xmlrpc tzinfo-data
28
+ # https://github.com/rubygems/rubygems/issues/2534#issuecomment-448843746
29
+ RUN gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems) \
30
+ && gem install bundler:2.3.26 rake net-telnet xmlrpc tzinfo-data
29
31
 
30
32
  # install things globally, for great justice
31
33
  # and don't create ".bundle" in all our apps
@@ -12,7 +12,7 @@ To build the images run
12
12
 
13
13
  You can set your own docker registry with the flag `--registry x.y.z/org`
14
14
 
15
- You can exclude what images can be built with the flag `--exclude jdk-7`
15
+ You can exclude what images can be built with the flag `--exclude jdk-7`. Multiple usages of `--exclude` are accepted.
16
16
 
17
17
  ## Test
18
18
 
@@ -1,5 +1,10 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ set -o pipefail
4
+
5
+ # 7-jdk is excluded by default. See https://github.com/elastic/apm-agent-ruby/pull/1367#issuecomment-1437228929
6
+ EXCLUDE=("7-jdk")
7
+
3
8
  while (( "$#" )); do
4
9
  case "$1" in
5
10
  -r|--registry)
@@ -7,7 +12,7 @@ while (( "$#" )); do
7
12
  shift 2
8
13
  ;;
9
14
  -e|--exclude)
10
- EXCLUDE=$2
15
+ EXCLUDE+=("$2")
11
16
  shift 2
12
17
  ;;
13
18
  -a|--action)
@@ -28,12 +33,13 @@ while (( "$#" )); do
28
33
  esac
29
34
  done
30
35
 
36
+ function convert_exclude_opts() {
37
+ for val in "${EXCLUDE[@]}"; do
38
+ printf "! -path \"./%s/*\" " $val
39
+ done
40
+ }
31
41
 
32
- if [ -n "$EXCLUDE" ] ; then
33
- search=$(find . -path ./$EXCLUDE -prune -o -name 'Dockerfile' -print)
34
- else
35
- search=$(find . -name 'Dockerfile' -print)
36
- fi
42
+ search=$(bash -c "find . -name 'Dockerfile' $(convert_exclude_opts) -print")
37
43
 
38
44
  function report {
39
45
  if [ $1 -eq 0 ] ; then
@@ -43,7 +49,18 @@ function report {
43
49
  fi
44
50
  }
45
51
 
52
+ function max {
53
+ if [ "$1" -gt "$2" ]; then
54
+ echo "$1"
55
+ else
56
+ echo "$2"
57
+ fi
58
+ }
59
+
46
60
  echo "${ACTION} docker images"
61
+
62
+ EXIT_CODE=0
63
+
47
64
  for i in ${search}; do
48
65
  jdk_image=$(basename `dirname "$i"`)
49
66
  jdk_version=$(echo "$jdk_image" | cut -d'-' -f1)
@@ -63,11 +80,18 @@ for i in ${search}; do
63
80
 
64
81
  if [ "${ACTION}" == "build" ] ; then
65
82
  docker build --tag "${name}" -< $i >> output.log 2>&1
66
- report $? "${name}"
83
+ result=$?
84
+ report $result "${name}"
67
85
  elif [ "${ACTION}" == "push" ] ; then
68
86
  docker push "${name}" >> output.log 2>&1
69
- report $? "${name}"
87
+ result=$?
88
+ report $result "${name}"
70
89
  else
71
90
  ./test.sh "${name}" $jdk_version
91
+ result=$?
72
92
  fi
73
- done
93
+
94
+ EXIT_CODE=$(max $EXIT_CODE $result)
95
+ done
96
+
97
+ exit "${EXIT_CODE}"
@@ -6,8 +6,23 @@ printf '\tTest %-30s %s\n' ${image}
6
6
 
7
7
  if [ -n "$version" ] ; then
8
8
  test_name="Test java -version '$version'"
9
- docker run -t --rm $image java -version | grep -q "openjdk version \"$version\|1.$version" && printf '\t\t%-40s %s\n' "${test_name}" "PASSED" || printf '\t\t%-40s %s\n' "${test_name}" "FAILED"
9
+ docker run -t --rm $image java -version | grep -q "openjdk version \"$version\|1.$version"
10
+ TEST_JAVA_VERSION_RESULT=$?
11
+ if [[ $TEST_JAVA_VERSION_RESULT -eq 0 ]]; then
12
+ printf '\t\t%-40s %s\n' "${test_name}" "PASSED"
13
+ else
14
+ printf '\t\t%-40s %s\n' "${test_name}" "FAILED"
15
+ fi
10
16
  fi
11
17
 
12
18
  test_name="Test Hello World"
13
- docker run -t --rm $image jruby -e "puts 'Hello World" | grep -q 'Hello World' && printf '\t\t%-40s %s\n' "${test_name}" "PASSED" || printf '\t\t%-40s %s\n' "${test_name}" "FAILED"
19
+ # random operation to verify that ruby evaluates the passed string correctly
20
+ docker run -t --rm $image jruby -e "foo = 3 * 4; puts foo" | grep -q '12'
21
+ TEST_HELLO_WORLD_RESULT=$?
22
+ if [[ $TEST_HELLO_WORLD_RESULT -eq 0 ]]; then
23
+ printf '\t\t%-40s %s\n' "${test_name}" "PASSED"
24
+ else
25
+ printf '\t\t%-40s %s\n' "${test_name}" "FAILED"
26
+ fi
27
+
28
+ ! (( $TEST_JAVA_VERSION_RESULT || $TEST_HELLO_WORLD_RESULT ))
data/CHANGELOG.asciidoc CHANGED
@@ -25,7 +25,6 @@ endif::[]
25
25
 
26
26
  [float]
27
27
  ===== Fixed
28
- - Fix {pull}2526[#2526]
29
28
 
30
29
  [float]
31
30
  [[unreleased]]
@@ -35,6 +34,13 @@ endif::[]
35
34
  [[release-notes-4.x]]
36
35
  === Ruby Agent version 4.x
37
36
 
37
+ [[release-notes-4.6.2]]
38
+ ==== 4.6.2
39
+
40
+ [float]
41
+ ===== Fixed
42
+ - Fix Faraday::RackBuilder::StackLocked {pull}1371[#1371]
43
+
38
44
  [[release-notes-4.6.1]]
39
45
  ==== 4.6.1
40
46
 
data/CONTRIBUTING.md CHANGED
@@ -49,4 +49,4 @@ To release a new version:
49
49
  2. Push the tag to GitHub.
50
50
  3. Build the gem and upload to Rubygems (local user needs to be signed in and authorized.)
51
51
  1. Run `rake release:update_branch`. This will...
52
- 1. Update `3.x` branch to be at released commit and push it to GitHub.
52
+ 1. Update `4.x` branch to be at released commit and push it to GitHub.
data/Gemfile CHANGED
@@ -83,9 +83,9 @@ frameworks_versions.each do |framework, version|
83
83
  end
84
84
 
85
85
  case version
86
- when 'master' # sinatra, grape
86
+ when 'master' # grape
87
87
  gem framework, github: GITHUB_REPOS.fetch(framework)
88
- when 'main' # rails
88
+ when 'main' # sinatra, rails
89
89
  gem framework, github: GITHUB_REPOS.fetch(framework), branch: 'main'
90
90
  when /.+/
91
91
  gem framework, "~> #{version}.0"
data/Rakefile CHANGED
@@ -24,9 +24,9 @@ desc 'Post release action:'\
24
24
 
25
25
  namespace :release do
26
26
  task :update_branch do
27
- `git checkout 3.x &&
27
+ `git checkout 4.x &&
28
28
  git rebase main &&
29
- git push origin 3.x &&
29
+ git push origin 4.x &&
30
30
  git checkout main`
31
31
  end
32
32
  end
@@ -102,12 +102,20 @@ module ElasticAPM
102
102
  ) do |span|
103
103
  ElasticAPM::Spies.without_net_http do
104
104
  trace_context = span&.trace_context || transaction.trace_context
105
- self.response :elastic_apm_middleware, span # middleware
106
105
 
107
- result = super(method, url, body, headers) do |req|
108
- trace_context.apply_headers { |k, v| req[k] = v }
109
-
110
- yield req if block
106
+ begin
107
+ result = super(method, url, body, headers) do |req|
108
+ trace_context.apply_headers { |k, v| req[k] = v }
109
+ yield req if block
110
+ end
111
+ rescue Faraday::ClientError, Faraday::ServerError => e # Faraday::Response::RaiseError
112
+ status = e.response[:status]
113
+ http = span&.context&.http
114
+ if http && status
115
+ http.status_code = status.to_s
116
+ span.outcome = Span::Outcome.from_http_status(status)
117
+ end
118
+ raise e
111
119
  end
112
120
 
113
121
  if (http = span&.context&.http)
@@ -123,28 +131,6 @@ module ElasticAPM
123
131
  # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
124
132
 
125
133
  def install
126
- # This middleware class has to be defined here because it inherits from
127
- # ::Faraday::Middleware, which isn't defined when this file loads.
128
- tracing_middleware = Class.new ::Faraday::Middleware do
129
- attr_reader :span
130
-
131
- def initialize(app, span = nil, options = {})
132
- super(app)
133
- @span = span
134
- end
135
-
136
- def on_complete(env)
137
- status = env[:status]
138
- http = span&.context&.http
139
- if http && status
140
- http.status_code = status.to_s
141
- span.outcome = Span::Outcome.from_http_status(status)
142
- end
143
- end
144
- end
145
- ::Faraday::Response.register_middleware(
146
- elastic_apm_middleware: -> { tracing_middleware }
147
- )
148
134
  ::Faraday::Connection.prepend(Ext)
149
135
  end
150
136
  end
@@ -18,5 +18,5 @@
18
18
  # frozen_string_literal: true
19
19
 
20
20
  module ElasticAPM
21
- VERSION = '4.6.1'
21
+ VERSION = '4.6.2'
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.1
4
+ version: 4.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Malmberg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-03-01 00:00:00.000000000 Z
12
+ date: 2023-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby