gitlab-rspec-metrics-exporter 0.0.2 → 0.2.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfcda9d8209ff8d2719c8b39f4995b4734de3295e8a47367900a5e32e962e665
|
|
4
|
+
data.tar.gz: 1e76c49aa5de797691a639445f2ba00704c9893069c60960520ed56fb5bd080c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e6577d25018d3d9ea858cef1da7f27004fc31edc7efff4d8e76e6e1ec8397145b39818d758bee871c41802e0da791aa6612e5dd8f57a187209dbcfaf3c39644
|
|
7
|
+
data.tar.gz: d902dc4c706552fb2d3e225b67c575f7585cfa21b45996ec55ca172fe380597f8b85867c36cdfe284203cb3ba3950649a23d57f04c0a0514bc6ed631492c56c0
|
data/README.md
CHANGED
|
@@ -41,17 +41,20 @@ When the `ConfigHelper.configure!` helper is used, the options marked with an
|
|
|
41
41
|
options can also be set explicitly via yielded `config` object; explicit
|
|
42
42
|
values always take precedence over the corresponding environment variable.
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
44
|
+
<!-- markdownlint-disable line-length -->
|
|
45
|
+
| Option | Env var | Description |
|
|
46
|
+
| ---------------------------- | ------------------------------ | ---------------------------------------------------------------------------- |
|
|
47
|
+
| `observer_url` | `GLCI_OBSERVER_URL` | Observer service base URL |
|
|
48
|
+
| `observer_token` | `GLCI_OBSERVER_AUTH_TOKEN` | Auth token sent as `X-Gitlab-Token` |
|
|
49
|
+
| `run_type` | `GLCI_TEST_METRICS_RUN_TYPE` | Suite name (falls back to `test_level`, then `CI_JOB_NAME`, or `"unknown"`) |
|
|
50
|
+
| `test_level` | `GLCI_TEST_METRICS_TEST_LEVEL` | Suite-wide test level / tier (e.g. `unit`, `integration`) |
|
|
51
|
+
| `extra_rspec_metadata_keys` | _(none)_ | Additional `example.metadata` keys to include in metrics |
|
|
52
|
+
| `spec_file_path_prefix` | _(none)_ | Prepended to file paths (useful for monorepos) |
|
|
53
|
+
| `skip_record_proc` | _(none)_ | Lambda receiving an example; return `true` to skip exporting |
|
|
54
|
+
| `test_retried_proc` | _(none)_ | Lambda receiving an example; return `true` if it was a retry |
|
|
55
|
+
| `custom_metrics_proc` | _(none)_ | Lambda returning a hash merged into every metric record |
|
|
56
|
+
| `logger` | _(none)_ | Ruby `Logger` instance |
|
|
57
|
+
<!-- markdownlint-enable line-length -->
|
|
55
58
|
|
|
56
59
|
The config helper also reads two control-flow variables that gate whether the
|
|
57
60
|
exporter activates at all:
|
|
@@ -62,6 +62,7 @@ module Gitlab
|
|
|
62
62
|
|
|
63
63
|
def configure_exporter!(config, run_type)
|
|
64
64
|
config.run_type = run_type || default_run_type unless env_present?(config.run_type)
|
|
65
|
+
config.test_level = ENV.fetch("GLCI_TEST_METRICS_TEST_LEVEL", nil) unless env_present?(config.test_level)
|
|
65
66
|
|
|
66
67
|
configure_observer!(config)
|
|
67
68
|
end
|
|
@@ -77,7 +78,9 @@ module Gitlab
|
|
|
77
78
|
end
|
|
78
79
|
|
|
79
80
|
def default_run_type
|
|
80
|
-
@default_run_type ||=
|
|
81
|
+
@default_run_type ||= %w[GLCI_TEST_METRICS_RUN_TYPE GLCI_TEST_METRICS_TEST_LEVEL CI_JOB_NAME]
|
|
82
|
+
.filter_map { |name| ENV.fetch(name, nil) }
|
|
83
|
+
.find { |value| env_present?(value) }
|
|
81
84
|
end
|
|
82
85
|
|
|
83
86
|
def observer_url
|
|
@@ -59,6 +59,7 @@ module Gitlab
|
|
|
59
59
|
feature_category: example.metadata[:feature_category] || "",
|
|
60
60
|
test_retried: config.test_retried_proc.call(example),
|
|
61
61
|
run_type: run_type,
|
|
62
|
+
test_level: test_level,
|
|
62
63
|
spec_file_path_prefix: config.spec_file_path_prefix,
|
|
63
64
|
pipeline_type: pipeline_type
|
|
64
65
|
}
|
|
@@ -191,7 +192,17 @@ module Gitlab
|
|
|
191
192
|
#
|
|
192
193
|
# @return [String]
|
|
193
194
|
def run_type
|
|
194
|
-
config.run_type || ci_job_name || "unknown"
|
|
195
|
+
config.run_type || test_level || ci_job_name || "unknown"
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Configured suite-wide test level
|
|
199
|
+
#
|
|
200
|
+
# @return [String, nil]
|
|
201
|
+
def test_level
|
|
202
|
+
value = config.test_level
|
|
203
|
+
return nil if value.nil? || value.to_s.empty?
|
|
204
|
+
|
|
205
|
+
value
|
|
195
206
|
end
|
|
196
207
|
|
|
197
208
|
# Metrics value cast to a valid type
|