elastic-apm 4.6.0 → 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: edae30dc148307b137e402a81ffed731cbe738ca7924f31c9440a9a6ea9a8eb4
4
- data.tar.gz: ef860d2d783fd9351b0eea3106e96eafbadef339fa72a4b5979fbc38d4e3d46a
3
+ metadata.gz: f7c28585ab44cfdb7a4eb8c32b8dd60e1ecb10c091357c25a6b13f35a0fe2ffc
4
+ data.tar.gz: 3aad55a03f8c2a4d824ea09731be304e7712ee306dc4e585c5cc29ba11e25413
5
5
  SHA512:
6
- metadata.gz: 8e1543b7f39d5ba73eb30e34777ba07a8ae940ddd1aee2d84afc445642319304bd26036a9eb5b5e6d4d9c11bbc0323c7c17aa2bd18101bbfcfed1cdcf6bdc635
7
- data.tar.gz: 971963f1d06a398c2af8f988e4386004b7fb176e67d6d8c35b9be8a781b8561fd8236395d89f51ef87e3cad4375f9c91c4105e550dc7f7b1e7b1142e1d0f7c17
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
data/.ci/Jenkinsfile CHANGED
@@ -25,6 +25,7 @@ pipeline {
25
25
  OPBEANS_REPO = 'opbeans-ruby'
26
26
  REFERENCE_REPO = '/var/lib/jenkins/.git-references/apm-agent-ruby.git'
27
27
  SLACK_CHANNEL = '#apm-agent-ruby'
28
+ RUBY_DOCKER_TAG = 'ruby:2.6'
28
29
  }
29
30
  options {
30
31
  timeout(time: 2, unit: 'HOURS')
@@ -123,6 +124,37 @@ pipeline {
123
124
  }
124
125
  }
125
126
  }
127
+ stage('Publish snapshot packages') {
128
+ options { skipDefaultCheckout() }
129
+ environment {
130
+ PATH = "${env.WORKSPACE}/.local/bin:${env.WORKSPACE}/bin:${env.PATH}"
131
+ BUCKET_NAME = 'oblt-artifacts'
132
+ DOCKER_REGISTRY = 'docker.elastic.co'
133
+ DOCKER_REGISTRY_SECRET = 'secret/observability-team/ci/docker-registry/prod'
134
+ GCS_ACCOUNT_SECRET = 'secret/observability-team/ci/snapshoty'
135
+ }
136
+ when { branch 'main' }
137
+ steps {
138
+ withGithubNotify(context: 'Publish snapshot packages') {
139
+ deleteDir()
140
+ unstash 'source'
141
+ dir(env.BASE_DIR) {
142
+ script {
143
+ docker.image(env.RUBY_DOCKER_TAG).inside() {
144
+ sh(label: 'install build system', script: 'gem install rake yard rspec')
145
+ sh(label: 'create gem', script: 'rake build')
146
+ }
147
+ snapshoty(
148
+ bucket: env.BUCKET_NAME,
149
+ gcsAccountSecret: env.GCS_ACCOUNT_SECRET,
150
+ dockerRegistry: env.DOCKER_REGISTRY,
151
+ dockerSecret: env.DOCKER_REGISTRY_SECRET
152
+ )
153
+ }
154
+ }
155
+ }
156
+ }
157
+ }
126
158
  stage('Benchmarks') {
127
159
  options { skipDefaultCheckout() }
128
160
  when {
@@ -178,7 +210,6 @@ pipeline {
178
210
  stage('Release') {
179
211
  options { skipDefaultCheckout() }
180
212
  environment {
181
- RUBY_DOCKER_TAG = 'ruby:2.6'
182
213
  HOME = '/var/lib/jenkins'
183
214
  }
184
215
  when {
@@ -389,7 +420,7 @@ def convergeCoverage() {
389
420
 
390
421
  def prepareRelease(Closure body){
391
422
  dir("${env.BASE_DIR}"){
392
- docker.image("${env.RUBY_DOCKER_TAG}").inside('-v ${REFERENCE_REPO}:${REFERENCE_REPO} -v /etc/passwd:/etc/passwd -v ${HOME}/.ssh:${HOME}/.ssh') {
423
+ docker.image(env.RUBY_DOCKER_TAG).inside('-v ${REFERENCE_REPO}:${REFERENCE_REPO} -v /etc/passwd:/etc/passwd -v ${HOME}/.ssh:${HOME}/.ssh') {
393
424
  withEnv(["HOME=${env.WORKSPACE}/${env.BASE_DIR ?: ''}"]) {
394
425
  rubygemsLogin.withApi(secret: "${env.RELEASE_SECRET}") {
395
426
  withGitRelease(credentialsId: '2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken') {
@@ -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
@@ -38,4 +40,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
40
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
41
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
42
 
43
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
44
+ USER jruby
45
+ WORKDIR /home/jruby
41
46
  CMD [ "irb" ]
@@ -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
 
@@ -38,4 +38,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
38
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
39
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
40
 
41
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
42
+ USER jruby
43
+ WORKDIR /home/jruby
41
44
  CMD [ "irb" ]
@@ -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
 
@@ -38,4 +38,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
38
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
39
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
40
 
41
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
42
+ USER jruby
43
+ WORKDIR /home/jruby
41
44
  CMD [ "irb" ]
@@ -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
 
@@ -38,4 +38,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
38
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
39
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
40
 
41
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
42
+ USER jruby
43
+ WORKDIR /home/jruby
41
44
  CMD [ "irb" ]
@@ -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
@@ -38,4 +40,7 @@ ENV PATH $BUNDLE_BIN:$PATH
38
40
  RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
39
41
  && chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
40
42
 
43
+ RUN useradd -rm -d /home/jruby -u 1001 jruby
44
+ USER jruby
45
+ WORKDIR /home/jruby
41
46
  CMD [ "irb" ]
@@ -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/.ci/snapshoty.yml ADDED
@@ -0,0 +1,34 @@
1
+ ---
2
+
3
+ # Version of configuration to use
4
+ version: '1.0'
5
+
6
+ # You can define a Google Cloud Account to use
7
+ account:
8
+ # Project id of the service account
9
+ project: '${GCS_PROJECT}'
10
+ # Private key id of the service account
11
+ private_key_id: '${GCS_PRIVATE_KEY_ID}'
12
+ # Private key of the service account
13
+ private_key: '${GCS_PRIVATE_KEY}'
14
+ # Email of the service account
15
+ client_email: '${GCS_CLIENT_EMAIL}'
16
+ # URI token
17
+ token_uri: 'https://oauth2.googleapis.com/token'
18
+
19
+ # List of artifacts
20
+ artifacts:
21
+ # Path to use for artifacts discovery
22
+ - path: './pkg'
23
+ # Files pattern to match
24
+ files_pattern: 'elastic-apm-(?P<app_version>\d+\.\d+\.\d+)\.gem'
25
+ # File layout on GCS bucket
26
+ output_pattern: '{project}/{jenkins_branch_name}/elastic-apm-ruby-{app_version}-{jenkins_git_commit_short}.gem'
27
+ # List of metadata processors to use.
28
+ metadata:
29
+ # Define static custom metadata
30
+ - name: 'custom'
31
+ data:
32
+ project: 'apm-agent-ruby'
33
+ # Add jenkins metadata
34
+ - name: 'jenkins'
@@ -0,0 +1,108 @@
1
+ name: update-specs
2
+
3
+ title: synchronize schema specs
4
+
5
+ scms:
6
+ default:
7
+ kind: github
8
+ spec:
9
+ user: '{{ requiredEnv "GIT_USER" }}'
10
+ email: '{{ requiredEnv "GIT_EMAIL" }}'
11
+ owner: elastic
12
+ repository: apm-agent-ruby
13
+ token: '{{ requiredEnv "GITHUB_TOKEN" }}'
14
+ username: '{{ requiredEnv "GIT_USER" }}'
15
+ branch: main
16
+
17
+ sources:
18
+ sha:
19
+ kind: file
20
+ spec:
21
+ file: 'https://github.com/elastic/apm-data/commit/main.patch'
22
+ matchpattern: "^From\\s([0-9a-f]{40})\\s"
23
+ transformers:
24
+ - findsubmatch:
25
+ pattern: "[0-9a-f]{40}"
26
+ error.json:
27
+ kind: file
28
+ spec:
29
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/error.json
30
+ metadata.json:
31
+ kind: file
32
+ spec:
33
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/metadata.json
34
+ metricset.json:
35
+ kind: file
36
+ spec:
37
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/metricset.json
38
+ span.json:
39
+ kind: file
40
+ spec:
41
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/span.json
42
+ transaction.json:
43
+ kind: file
44
+ spec:
45
+ file: https://raw.githubusercontent.com/elastic/apm-data/main/input/elasticapm/docs/spec/v2/transaction.json
46
+
47
+
48
+
49
+
50
+
51
+ actions:
52
+ pr:
53
+ kind: "github/pullrequest"
54
+ scmid: default
55
+ sourceid: sha
56
+ spec:
57
+ automerge: false
58
+ draft: false
59
+ labels:
60
+ - "automation"
61
+ description: |-
62
+ ### What
63
+ APM agent json schema automatic sync
64
+ ### Why
65
+ *Changeset*
66
+ * https://github.com/elastic/apm-data/commit/{{ source "sha" }}
67
+
68
+ targets:
69
+ error.json:
70
+ name: error.json
71
+ scmid: default
72
+ sourceid: error.json
73
+ kind: file
74
+ spec:
75
+ file: spec/fixtures/error.json
76
+ forcecreate: true
77
+ metadata.json:
78
+ name: metadata.json
79
+ scmid: default
80
+ sourceid: metadata.json
81
+ kind: file
82
+ spec:
83
+ file: spec/fixtures/metadata.json
84
+ forcecreate: true
85
+ metricset.json:
86
+ name: metricset.json
87
+ scmid: default
88
+ sourceid: metricset.json
89
+ kind: file
90
+ spec:
91
+ file: spec/fixtures/metricset.json
92
+ forcecreate: true
93
+ span.json:
94
+ name: span.json
95
+ scmid: default
96
+ sourceid: span.json
97
+ kind: file
98
+ spec:
99
+ file: spec/fixtures/span.json
100
+ forcecreate: true
101
+ transaction.json:
102
+ name: transaction.json
103
+ scmid: default
104
+ sourceid: transaction.json
105
+ kind: file
106
+ spec:
107
+ file: spec/fixtures/transaction.json
108
+ forcecreate: true
@@ -0,0 +1,30 @@
1
+ name: update-specs
2
+
3
+ on:
4
+ workflow_dispatch: ~
5
+ schedule:
6
+ - cron: '0 6 * * *'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ bump:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ - uses: elastic/apm-pipeline-library/.github/actions/updatecli@current
17
+ env:
18
+ BRANCH_NAME: ${{ github.ref_name }}
19
+ with:
20
+ vaultUrl: ${{ secrets.VAULT_ADDR }}
21
+ vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
22
+ vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
23
+ pipeline: ./.ci/update-specs.yml
24
+ - if: failure()
25
+ uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
26
+ with:
27
+ vaultUrl: ${{ secrets.VAULT_ADDR }}
28
+ vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
29
+ vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
30
+ slackChannel: "#apm-agent-ruby"
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,23 @@ 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
+
44
+ [[release-notes-4.6.1]]
45
+ ==== 4.6.1
46
+
47
+ [float]
48
+ ===== Fixed
49
+
50
+ - Fix growing number of open file descriptors when HTTP request to APM is never sent {pull}1351[#1351]
51
+ - Fix setting span http status code when Faraday Middleware is used {pull}1368[#1368]
52
+ - Handle whitespace when splitting tracestate entries {pull}1353[#1353]
53
+
38
54
  [[release-notes-4.6.0]]
39
55
  ==== 4.6.0
40
56
 
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"
@@ -116,6 +116,8 @@ if RUBY_PLATFORM == 'java'
116
116
  end
117
117
  elsif frameworks_versions['rails'] =~ /^(4|5)/
118
118
  gem 'sqlite3', '~> 1.3.6'
119
+ elsif RUBY_VERSION < '2.7'
120
+ gem 'sqlite3', '~> 1.4.4'
119
121
  else
120
122
  gem 'sqlite3'
121
123
  end
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
data/docker-compose.yml CHANGED
@@ -6,6 +6,8 @@ services:
6
6
  image: mongo:latest
7
7
  volumes: ['mongodata:/data/db']
8
8
  ports: ['27017:27017']
9
+ security_opt:
10
+ - no-new-privileges
9
11
 
10
12
  specs:
11
13
  build:
@@ -27,12 +29,16 @@ services:
27
29
  depends_on:
28
30
  - mongodb
29
31
  user: ${USER_ID}
32
+ security_opt:
33
+ - no-new-privileges
30
34
 
31
35
  ruby_rspec:
32
36
  image: apm-agent-ruby:${RUBY_VERSION}
33
37
  environment:
34
38
  MONGODB_URL: 'mongodb:27017'
35
39
  user: ${USER_ID}
40
+ security_opt:
41
+ - no-new-privileges
36
42
 
37
43
  volumes:
38
44
  vendor:
@@ -103,10 +103,19 @@ module ElasticAPM
103
103
  ElasticAPM::Spies.without_net_http do
104
104
  trace_context = span&.trace_context || transaction.trace_context
105
105
 
106
- result = super(method, url, body, headers) do |req|
107
- trace_context.apply_headers { |k, v| req[k] = v }
108
-
109
- 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
110
119
  end
111
120
 
112
121
  if (http = span&.context&.http)
@@ -92,6 +92,8 @@ module ElasticAPM
92
92
 
93
93
  extend Forwardable
94
94
 
95
+ ENTRY_SPLIT_REGEX = /\s*[\n,]+\s*/
96
+
95
97
  def initialize(entries: {}, sample_rate: nil)
96
98
  @entries = entries
97
99
 
@@ -140,7 +142,7 @@ module ElasticAPM
140
142
  # Rack handles this by joining the headers under the same key,
141
143
  # separated by newlines.
142
144
  # See https://www.rubydoc.info/github/rack/rack/file/SPEC
143
- String(str).split("\n").map { |s| s.split(',') }.flatten
145
+ String(str).split(ENTRY_SPLIT_REGEX).flatten
144
146
  end
145
147
  end
146
148
  end
@@ -75,7 +75,15 @@ module ElasticAPM
75
75
  @closed.make_true
76
76
 
77
77
  @wr&.close
78
- return if @request.nil? || @request&.join(5)
78
+
79
+ if @request&.join(5)
80
+ @rd&.close
81
+ return
82
+ end
83
+
84
+ @rd&.close
85
+
86
+ return if @request.nil?
79
87
 
80
88
  error(
81
89
  '%s: APM Server not responding in time, terminating request',
@@ -117,8 +125,6 @@ module ElasticAPM
117
125
  error(
118
126
  "Couldn't establish connection to APM Server:\n%p", e.inspect
119
127
  )
120
- ensure
121
- @rd&.close
122
128
  end
123
129
  end
124
130
  end
@@ -18,5 +18,5 @@
18
18
  # frozen_string_literal: true
19
19
 
20
20
  module ElasticAPM
21
- VERSION = '4.6.0'
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.0
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-01-11 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
@@ -82,6 +82,8 @@ files:
82
82
  - ".ci/jobs/defaults.yml"
83
83
  - ".ci/linting.groovy"
84
84
  - ".ci/packer_cache.sh"
85
+ - ".ci/snapshoty.yml"
86
+ - ".ci/update-specs.yml"
85
87
  - ".github/ISSUE_TEMPLATE/Bug_report.md"
86
88
  - ".github/ISSUE_TEMPLATE/Feature_request.md"
87
89
  - ".github/PULL_REQUEST_TEMPLATE.md"
@@ -89,6 +91,7 @@ files:
89
91
  - ".github/labeler-config.yml"
90
92
  - ".github/workflows/addToProject.yml"
91
93
  - ".github/workflows/labeler.yml"
94
+ - ".github/workflows/update-specs.yml"
92
95
  - ".gitignore"
93
96
  - ".pre-commit-config.yaml"
94
97
  - ".rspec"