elastic-apm 3.6.0 → 3.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ci/Jenkinsfile +183 -100
- data/.ci/jobs/defaults.yml +1 -1
- data/.ci/packer_cache.sh +12 -10
- data/.rspec +0 -1
- data/.rubocop.yml +3 -0
- data/CHANGELOG.asciidoc +84 -0
- data/Gemfile +22 -1
- data/Rakefile +28 -1
- data/bin/run-tests +4 -1
- data/docker-compose.yml +2 -0
- data/docs/configuration.asciidoc +117 -16
- data/docs/debugging.asciidoc +14 -0
- data/docs/getting-started-rails.asciidoc +2 -0
- data/docs/images/dynamic-config.svg +1 -0
- data/docs/index.asciidoc +2 -1
- data/docs/introduction.asciidoc +2 -1
- data/docs/performance-tuning.asciidoc +106 -0
- data/docs/set-up.asciidoc +5 -2
- data/docs/supported-technologies.asciidoc +18 -1
- data/elastic-apm.gemspec +17 -0
- data/lib/elastic-apm.rb +17 -0
- data/lib/elastic_apm.rb +18 -1
- data/lib/elastic_apm/agent.rb +48 -2
- data/lib/elastic_apm/central_config.rb +27 -8
- data/lib/elastic_apm/central_config/cache_control.rb +17 -0
- data/lib/elastic_apm/child_durations.rb +17 -0
- data/lib/elastic_apm/config.rb +52 -2
- data/lib/elastic_apm/config/bytes.rb +17 -0
- data/lib/elastic_apm/config/duration.rb +17 -0
- data/lib/elastic_apm/config/options.rb +18 -1
- data/lib/elastic_apm/config/regexp_list.rb +17 -0
- data/lib/elastic_apm/config/wildcard_pattern_list.rb +28 -1
- data/lib/elastic_apm/context.rb +17 -0
- data/lib/elastic_apm/context/request.rb +17 -0
- data/lib/elastic_apm/context/request/socket.rb +17 -0
- data/lib/elastic_apm/context/request/url.rb +17 -0
- data/lib/elastic_apm/context/response.rb +17 -0
- data/lib/elastic_apm/context/user.rb +17 -0
- data/lib/elastic_apm/context_builder.rb +18 -1
- data/lib/elastic_apm/deprecations.rb +17 -0
- data/lib/elastic_apm/error.rb +17 -0
- data/lib/elastic_apm/error/exception.rb +17 -0
- data/lib/elastic_apm/error/log.rb +17 -0
- data/lib/elastic_apm/error_builder.rb +17 -0
- data/lib/elastic_apm/grape.rb +17 -0
- data/lib/elastic_apm/graphql.rb +17 -0
- data/lib/elastic_apm/grpc.rb +19 -2
- data/lib/elastic_apm/instrumenter.rb +29 -4
- data/lib/elastic_apm/internal_error.rb +17 -0
- data/lib/elastic_apm/logging.rb +17 -0
- data/lib/elastic_apm/metadata.rb +17 -0
- data/lib/elastic_apm/metadata/process_info.rb +17 -0
- data/lib/elastic_apm/metadata/service_info.rb +22 -2
- data/lib/elastic_apm/metadata/system_info.rb +22 -3
- data/lib/elastic_apm/metadata/system_info/container_info.rb +45 -4
- data/lib/elastic_apm/metrics.rb +33 -1
- data/lib/elastic_apm/metrics/breakdown_set.rb +17 -0
- data/lib/elastic_apm/metrics/cpu_mem_set.rb +17 -0
- data/lib/elastic_apm/metrics/metric.rb +17 -0
- data/lib/elastic_apm/metrics/set.rb +17 -0
- data/lib/elastic_apm/metrics/span_scoped_set.rb +17 -0
- data/lib/elastic_apm/metrics/transaction_set.rb +17 -0
- data/lib/elastic_apm/metrics/vm_set.rb +17 -0
- data/lib/elastic_apm/metricset.rb +17 -0
- data/lib/elastic_apm/middleware.rb +25 -2
- data/lib/elastic_apm/naively_hashable.rb +17 -0
- data/lib/elastic_apm/normalizers.rb +17 -0
- data/lib/elastic_apm/normalizers/grape.rb +17 -0
- data/lib/elastic_apm/normalizers/grape/endpoint_run.rb +18 -1
- data/lib/elastic_apm/normalizers/rails.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_controller.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_mailer.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/action_view.rb +17 -0
- data/lib/elastic_apm/normalizers/rails/active_record.rb +17 -0
- data/lib/elastic_apm/opentracing.rb +64 -23
- data/lib/elastic_apm/rails.rb +17 -0
- data/lib/elastic_apm/railtie.rb +17 -0
- data/lib/elastic_apm/resque.rb +17 -0
- data/lib/elastic_apm/sinatra.rb +17 -0
- data/lib/elastic_apm/span.rb +20 -2
- data/lib/elastic_apm/span/context.rb +17 -0
- data/lib/elastic_apm/span/context/db.rb +17 -0
- data/lib/elastic_apm/span/context/destination.rb +17 -0
- data/lib/elastic_apm/span/context/http.rb +17 -0
- data/lib/elastic_apm/span_helpers.rb +17 -0
- data/lib/elastic_apm/spies.rb +33 -14
- data/lib/elastic_apm/spies/action_dispatch.rb +17 -0
- data/lib/elastic_apm/spies/delayed_job.rb +17 -0
- data/lib/elastic_apm/spies/dynamo_db.rb +58 -0
- data/lib/elastic_apm/spies/elasticsearch.rb +37 -2
- data/lib/elastic_apm/spies/faraday.rb +17 -0
- data/lib/elastic_apm/spies/http.rb +17 -0
- data/lib/elastic_apm/spies/json.rb +17 -0
- data/lib/elastic_apm/spies/mongo.rb +18 -1
- data/lib/elastic_apm/spies/net_http.rb +23 -2
- data/lib/elastic_apm/spies/rake.rb +17 -0
- data/lib/elastic_apm/spies/redis.rb +17 -0
- data/lib/elastic_apm/spies/resque.rb +19 -9
- data/lib/elastic_apm/spies/sequel.rb +18 -1
- data/lib/elastic_apm/spies/shoryuken.rb +17 -0
- data/lib/elastic_apm/spies/sidekiq.rb +17 -0
- data/lib/elastic_apm/spies/sinatra.rb +17 -0
- data/lib/elastic_apm/spies/sneakers.rb +17 -0
- data/lib/elastic_apm/spies/sucker_punch.rb +54 -0
- data/lib/elastic_apm/spies/tilt.rb +17 -0
- data/lib/elastic_apm/sql.rb +17 -0
- data/lib/elastic_apm/sql/signature.rb +17 -0
- data/lib/elastic_apm/sql/tokenizer.rb +17 -0
- data/lib/elastic_apm/sql/tokens.rb +17 -0
- data/lib/elastic_apm/sql_summarizer.rb +17 -0
- data/lib/elastic_apm/stacktrace.rb +17 -0
- data/lib/elastic_apm/stacktrace/frame.rb +17 -0
- data/lib/elastic_apm/stacktrace_builder.rb +17 -0
- data/lib/elastic_apm/subscriber.rb +17 -0
- data/lib/elastic_apm/trace_context.rb +17 -0
- data/lib/elastic_apm/trace_context/traceparent.rb +17 -0
- data/lib/elastic_apm/trace_context/tracestate.rb +17 -0
- data/lib/elastic_apm/transaction.rb +33 -5
- data/lib/elastic_apm/transport/base.rb +39 -23
- data/lib/elastic_apm/transport/connection.rb +17 -0
- data/lib/elastic_apm/transport/connection/http.rb +17 -0
- data/lib/elastic_apm/transport/connection/proxy_pipe.rb +22 -0
- data/lib/elastic_apm/transport/filters.rb +17 -0
- data/lib/elastic_apm/transport/filters/hash_sanitizer.rb +77 -0
- data/lib/elastic_apm/transport/filters/secrets_filter.rb +30 -56
- data/lib/elastic_apm/transport/headers.rb +17 -0
- data/lib/elastic_apm/transport/serializers.rb +17 -0
- data/lib/elastic_apm/transport/serializers/context_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/error_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/metadata_serializer.rb +44 -20
- data/lib/elastic_apm/transport/serializers/metricset_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/span_serializer.rb +17 -0
- data/lib/elastic_apm/transport/serializers/transaction_serializer.rb +17 -0
- data/lib/elastic_apm/transport/user_agent.rb +17 -0
- data/lib/elastic_apm/transport/worker.rb +21 -0
- data/lib/elastic_apm/util.rb +17 -0
- data/lib/elastic_apm/util/inflector.rb +17 -0
- data/lib/elastic_apm/util/lru_cache.rb +17 -0
- data/lib/elastic_apm/util/throttle.rb +17 -0
- data/lib/elastic_apm/version.rb +18 -1
- metadata +12 -11
- data/.ci/downstreamTests.groovy +0 -185
- data/.ci/prepare-git-context.sh +0 -27
- data/codecov.yml +0 -32
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -60,6 +77,10 @@ module ElasticAPM
|
|
60
77
|
private
|
61
78
|
|
62
79
|
def serialize_and_filter(resource)
|
80
|
+
if resource.respond_to?(:prepare_for_serialization!)
|
81
|
+
resource.prepare_for_serialization!
|
82
|
+
end
|
83
|
+
|
63
84
|
serialized = serializers.serialize(resource)
|
64
85
|
|
65
86
|
# if a filter returns nil, it means skip the event
|
data/lib/elastic_apm/util.rb
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
data/lib/elastic_apm/version.rb
CHANGED
@@ -1,5 +1,22 @@
|
|
1
|
+
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
+
# license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright
|
4
|
+
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
+
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
+
# not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
|
1
18
|
# frozen_string_literal: true
|
2
19
|
|
3
20
|
module ElasticAPM
|
4
|
-
VERSION = '3.
|
21
|
+
VERSION = '3.10.1'
|
5
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
|
-
description:
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- mikkel@elastic.co
|
44
44
|
executables: []
|
@@ -59,7 +59,6 @@ files:
|
|
59
59
|
- ".ci/docker/jruby/README.md"
|
60
60
|
- ".ci/docker/jruby/run.sh"
|
61
61
|
- ".ci/docker/jruby/test.sh"
|
62
|
-
- ".ci/downstreamTests.groovy"
|
63
62
|
- ".ci/jobs/apm-agent-ruby-downstream.yml"
|
64
63
|
- ".ci/jobs/apm-agent-ruby-linting-mbp.yml"
|
65
64
|
- ".ci/jobs/apm-agent-ruby-mbp.yml"
|
@@ -67,7 +66,6 @@ files:
|
|
67
66
|
- ".ci/jobs/defaults.yml"
|
68
67
|
- ".ci/linting.groovy"
|
69
68
|
- ".ci/packer_cache.sh"
|
70
|
-
- ".ci/prepare-git-context.sh"
|
71
69
|
- ".github/ISSUE_TEMPLATE/Bug_report.md"
|
72
70
|
- ".github/ISSUE_TEMPLATE/Feature_request.md"
|
73
71
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
@@ -97,7 +95,6 @@ files:
|
|
97
95
|
- bin/run-tests
|
98
96
|
- bin/setup
|
99
97
|
- bin/with_framework
|
100
|
-
- codecov.yml
|
101
98
|
- docker-compose.yml
|
102
99
|
- docs/advanced.asciidoc
|
103
100
|
- docs/api.asciidoc
|
@@ -108,11 +105,13 @@ files:
|
|
108
105
|
- docs/getting-started-rack.asciidoc
|
109
106
|
- docs/getting-started-rails.asciidoc
|
110
107
|
- docs/graphql.asciidoc
|
108
|
+
- docs/images/dynamic-config.svg
|
111
109
|
- docs/index.asciidoc
|
112
110
|
- docs/introduction.asciidoc
|
113
111
|
- docs/log-correlation.asciidoc
|
114
112
|
- docs/metrics.asciidoc
|
115
113
|
- docs/opentracing.asciidoc
|
114
|
+
- docs/performance-tuning.asciidoc
|
116
115
|
- docs/release-notes.asciidoc
|
117
116
|
- docs/set-up.asciidoc
|
118
117
|
- docs/supported-technologies.asciidoc
|
@@ -186,6 +185,7 @@ files:
|
|
186
185
|
- lib/elastic_apm/spies.rb
|
187
186
|
- lib/elastic_apm/spies/action_dispatch.rb
|
188
187
|
- lib/elastic_apm/spies/delayed_job.rb
|
188
|
+
- lib/elastic_apm/spies/dynamo_db.rb
|
189
189
|
- lib/elastic_apm/spies/elasticsearch.rb
|
190
190
|
- lib/elastic_apm/spies/faraday.rb
|
191
191
|
- lib/elastic_apm/spies/http.rb
|
@@ -200,6 +200,7 @@ files:
|
|
200
200
|
- lib/elastic_apm/spies/sidekiq.rb
|
201
201
|
- lib/elastic_apm/spies/sinatra.rb
|
202
202
|
- lib/elastic_apm/spies/sneakers.rb
|
203
|
+
- lib/elastic_apm/spies/sucker_punch.rb
|
203
204
|
- lib/elastic_apm/spies/tilt.rb
|
204
205
|
- lib/elastic_apm/sql.rb
|
205
206
|
- lib/elastic_apm/sql/signature.rb
|
@@ -219,6 +220,7 @@ files:
|
|
219
220
|
- lib/elastic_apm/transport/connection/http.rb
|
220
221
|
- lib/elastic_apm/transport/connection/proxy_pipe.rb
|
221
222
|
- lib/elastic_apm/transport/filters.rb
|
223
|
+
- lib/elastic_apm/transport/filters/hash_sanitizer.rb
|
222
224
|
- lib/elastic_apm/transport/filters/secrets_filter.rb
|
223
225
|
- lib/elastic_apm/transport/headers.rb
|
224
226
|
- lib/elastic_apm/transport/serializers.rb
|
@@ -235,13 +237,12 @@ files:
|
|
235
237
|
- lib/elastic_apm/util/lru_cache.rb
|
236
238
|
- lib/elastic_apm/util/throttle.rb
|
237
239
|
- lib/elastic_apm/version.rb
|
238
|
-
- vendor/.gitkeep
|
239
240
|
homepage: https://github.com/elastic/apm-agent-ruby
|
240
241
|
licenses:
|
241
242
|
- Apache-2.0
|
242
243
|
metadata:
|
243
244
|
source_code_uri: https://github.com/elastic/apm-agent-ruby
|
244
|
-
post_install_message:
|
245
|
+
post_install_message:
|
245
246
|
rdoc_options: []
|
246
247
|
require_paths:
|
247
248
|
- lib
|
@@ -256,8 +257,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
257
|
- !ruby/object:Gem::Version
|
257
258
|
version: '0'
|
258
259
|
requirements: []
|
259
|
-
rubygems_version: 3.
|
260
|
-
signing_key:
|
260
|
+
rubygems_version: 3.1.2
|
261
|
+
signing_key:
|
261
262
|
specification_version: 4
|
262
263
|
summary: The official Elastic APM agent for Ruby
|
263
264
|
test_files: []
|
data/.ci/downstreamTests.groovy
DELETED
@@ -1,185 +0,0 @@
|
|
1
|
-
#!/usr/bin/env groovy
|
2
|
-
@Library('apm@current') _
|
3
|
-
|
4
|
-
import co.elastic.matrix.*
|
5
|
-
import groovy.transform.Field
|
6
|
-
|
7
|
-
/**
|
8
|
-
This is the parallel tasks generator,
|
9
|
-
it is need as field to store the results of the tests.
|
10
|
-
*/
|
11
|
-
@Field def rubyTasksGen
|
12
|
-
|
13
|
-
pipeline {
|
14
|
-
agent { label 'linux && immutable' }
|
15
|
-
environment {
|
16
|
-
REPO="git@github.com:elastic/apm-agent-ruby.git"
|
17
|
-
BASE_DIR="src/github.com/elastic/apm-agent-ruby"
|
18
|
-
PIPELINE_LOG_LEVEL='INFO'
|
19
|
-
NOTIFY_TO = credentials('notify-to')
|
20
|
-
JOB_GCS_BUCKET = credentials('gcs-bucket')
|
21
|
-
JOB_GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba"
|
22
|
-
DOCKER_REGISTRY = 'docker.elastic.co'
|
23
|
-
DOCKER_SECRET = 'secret/apm-team/ci/docker-registry/prod'
|
24
|
-
CODECOV_SECRET = 'secret/apm-team/ci/apm-agent-ruby-codecov'
|
25
|
-
}
|
26
|
-
options {
|
27
|
-
timeout(time: 2, unit: 'HOURS')
|
28
|
-
buildDiscarder(logRotator(numToKeepStr: '300', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
|
29
|
-
timestamps()
|
30
|
-
ansiColor('xterm')
|
31
|
-
disableResume()
|
32
|
-
durabilityHint('PERFORMANCE_OPTIMIZED')
|
33
|
-
rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true])
|
34
|
-
quietPeriod(10)
|
35
|
-
}
|
36
|
-
parameters {
|
37
|
-
string(name: 'RUBY_VERSION', defaultValue: "ruby:2.6", description: "Ruby version to test")
|
38
|
-
string(name: 'BRANCH_SPECIFIER', defaultValue: "master", description: "Git branch/tag to use")
|
39
|
-
}
|
40
|
-
stages {
|
41
|
-
/**
|
42
|
-
Checkout the code and stash it, to use it on other stages.
|
43
|
-
*/
|
44
|
-
stage('Checkout') {
|
45
|
-
options { skipDefaultCheckout() }
|
46
|
-
steps {
|
47
|
-
deleteDir()
|
48
|
-
gitCheckout(basedir: "${BASE_DIR}",
|
49
|
-
branch: "${params.BRANCH_SPECIFIER}",
|
50
|
-
repo: "${REPO}",
|
51
|
-
credentialsId: "${JOB_GIT_CREDENTIALS}")
|
52
|
-
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
|
53
|
-
}
|
54
|
-
}
|
55
|
-
stage('Test') {
|
56
|
-
options { skipDefaultCheckout() }
|
57
|
-
steps {
|
58
|
-
runTests('.ci/.jenkins_framework.yml')
|
59
|
-
}
|
60
|
-
}
|
61
|
-
stage('Master Test') {
|
62
|
-
options { skipDefaultCheckout() }
|
63
|
-
steps {
|
64
|
-
catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE', message: "The tests for the master framework have failed. Let's warn instead.") {
|
65
|
-
runTests('.ci/.jenkins_master_framework.yml')
|
66
|
-
}
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
post {
|
71
|
-
cleanup {
|
72
|
-
script{
|
73
|
-
if(rubyTasksGen?.results){
|
74
|
-
writeJSON(file: 'results.json', json: toJSON(rubyTasksGen.results), pretty: 2)
|
75
|
-
def mapResults = ["Ruby": rubyTasksGen.results]
|
76
|
-
def processor = new ResultsProcessor()
|
77
|
-
processor.processResults(mapResults)
|
78
|
-
archiveArtifacts allowEmptyArchive: true, artifacts: 'results.json,results.html', defaultExcludes: false
|
79
|
-
catchError(buildResult: 'SUCCESS') {
|
80
|
-
def datafile = readFile(file: "results.json")
|
81
|
-
def json = getVaultSecret(secret: 'secret/apm-team/ci/jenkins-stats-cloud')
|
82
|
-
sendDataToElasticsearch(es: json.data.url, data: datafile, restCall: '/jenkins-builds-ruby-test-results/_doc/')
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
notifyBuildResult()
|
87
|
-
}
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
/**
|
92
|
-
Parallel task generator for the integration tests.
|
93
|
-
*/
|
94
|
-
class RubyParallelTaskGenerator extends DefaultParallelTaskGenerator {
|
95
|
-
|
96
|
-
public RubyParallelTaskGenerator(Map params){
|
97
|
-
super(params)
|
98
|
-
}
|
99
|
-
|
100
|
-
/**
|
101
|
-
build a clousure that launch and agent and execute the corresponding test script,
|
102
|
-
then store the results.
|
103
|
-
*/
|
104
|
-
public Closure generateStep(x, y){
|
105
|
-
return {
|
106
|
-
steps.sleep steps.randomNumber(min:10, max: 30)
|
107
|
-
steps.node('linux && immutable'){
|
108
|
-
// Label is transformed to avoid using the internal docker registry in the x coordinate
|
109
|
-
// TODO: def label = "${tag}:${x?.drop(x?.lastIndexOf('/')+1)}#${y}"
|
110
|
-
def label = "${tag}:${x}#${y}"
|
111
|
-
try {
|
112
|
-
steps.runScript(label: label, ruby: x, framework: y)
|
113
|
-
saveResult(x, y, 1)
|
114
|
-
} catch(e){
|
115
|
-
saveResult(x, y, 0)
|
116
|
-
steps.error("${label} tests failed : ${e.toString()}\n")
|
117
|
-
} finally {
|
118
|
-
steps.junit(allowEmptyResults: true,
|
119
|
-
keepLongStdio: true,
|
120
|
-
testResults: "**/spec/junit-reports/**/ruby-agent-junit.xml")
|
121
|
-
if (steps.isCodecovEnabled(x, y)) {
|
122
|
-
steps.codecov(repo: "${steps.env.REPO}", basedir: "${steps.env.BASE_DIR}",
|
123
|
-
secret: "${steps.env.CODECOV_SECRET}")
|
124
|
-
}
|
125
|
-
}
|
126
|
-
}
|
127
|
-
}
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
/**
|
132
|
-
Run tests for a Ruby version and framework version.
|
133
|
-
*/
|
134
|
-
def runScript(Map params = [:]){
|
135
|
-
def label = params.label
|
136
|
-
def ruby = params.ruby
|
137
|
-
def framework = params.framework
|
138
|
-
log(level: 'INFO', text: "${label}")
|
139
|
-
env.HOME = "${env.WORKSPACE}"
|
140
|
-
env.PATH = "${env.PATH}:${env.WORKSPACE}/bin"
|
141
|
-
deleteDir()
|
142
|
-
unstash 'source'
|
143
|
-
dir("${BASE_DIR}"){
|
144
|
-
retry(2){
|
145
|
-
sleep randomNumber(min:10, max: 30)
|
146
|
-
dockerLogin(secret: "${DOCKER_SECRET}", registry: "${DOCKER_REGISTRY}")
|
147
|
-
sh("./spec/scripts/spec.sh ${ruby} ${framework}")
|
148
|
-
}
|
149
|
-
}
|
150
|
-
}
|
151
|
-
|
152
|
-
/**
|
153
|
-
* Whether the given ruby version and framework are in charge of sending the
|
154
|
-
* codecov results. It does require the workspace.
|
155
|
-
*/
|
156
|
-
def isCodecovEnabled(ruby, framework){
|
157
|
-
dir(BASE_DIR){
|
158
|
-
def codecovVersions = readYaml(file: '.ci/.jenkins_codecov.yml')
|
159
|
-
return codecovVersions['ENABLED'].any { it.trim() == "${ruby?.trim()}#${framework?.trim()}" }
|
160
|
-
}
|
161
|
-
}
|
162
|
-
|
163
|
-
/**
|
164
|
-
Run all the tests for the given ruby version and file with the frameworks to test
|
165
|
-
*/
|
166
|
-
def runTests(frameworkFile) {
|
167
|
-
deleteDir()
|
168
|
-
unstash "source"
|
169
|
-
dir("${BASE_DIR}"){
|
170
|
-
script {
|
171
|
-
rubyTasksGen = new RubyParallelTaskGenerator(
|
172
|
-
xVersions: [ "${params.RUBY_VERSION}" ],
|
173
|
-
xKey: 'RUBY_VERSION',
|
174
|
-
yKey: 'FRAMEWORK',
|
175
|
-
yFile: frameworkFile,
|
176
|
-
exclusionFile: '.ci/.jenkins_exclude.yml',
|
177
|
-
tag: 'Ruby',
|
178
|
-
name: 'Ruby',
|
179
|
-
steps: this
|
180
|
-
)
|
181
|
-
def mapPatallelTasks = rubyTasksGen.generateParallelTests()
|
182
|
-
parallel(mapPatallelTasks)
|
183
|
-
}
|
184
|
-
}
|
185
|
-
}
|
data/.ci/prepare-git-context.sh
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -exo pipefail
|
3
|
-
|
4
|
-
# Enable git+ssh. Env variables are created on the fly with the gitCheckout
|
5
|
-
git config remote.origin.url "git@github.com:${ORG_NAME}/${REPO_NAME}.git"
|
6
|
-
|
7
|
-
# Enable to fetch branches when cloning with a detached and shallow clone
|
8
|
-
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
|
9
|
-
|
10
|
-
# Force the git user details when pushing using the last commit details
|
11
|
-
USER_MAIL=$(git log -1 --pretty=format:'%ae')
|
12
|
-
USER_NAME=$(git log -1 --pretty=format:'%an')
|
13
|
-
git config user.email "${USER_MAIL}"
|
14
|
-
git config user.name "${USER_NAME}"
|
15
|
-
|
16
|
-
# Checkout the branch as it's detached based by default.
|
17
|
-
# See https://issues.jenkins-ci.org/browse/JENKINS-33171
|
18
|
-
git fetch --all
|
19
|
-
git checkout "${BRANCH_NAME}"
|
20
|
-
|
21
|
-
# Checkout the master branch to be able to rebase the *.x branch
|
22
|
-
git checkout master
|
23
|
-
|
24
|
-
# Ensure the master branch points to the original commit to avoid commit injection
|
25
|
-
# when running the release pipeline.
|
26
|
-
# used GIT_BASE_COMMIT instead GIT_COMMIT to support the MultiBranchPipelines.
|
27
|
-
git reset --hard "${GIT_BASE_COMMIT}"
|