Skip to content

Commit b838f0a

Browse files
authored
Add false positive test package to detect errors in elastic agent logs (#2084)
Added a new test package into false_positives folder to be able to check if there is any error in the logs from Elastic Agent container. This package requires to run in Elastic stack version 8.12.0 in order to reproduce the error in logs.
1 parent bd6312f commit b838f0a

File tree

24 files changed

+3733
-0
lines changed

24 files changed

+3733
-0
lines changed

.buildkite/pipeline.trigger.integration.tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ for package in $(find . -maxdepth 1 -mindepth 1 -type d) ; do
8383
echo " image: \"${UBUNTU_X86_64_AGENT_IMAGE}\""
8484
echo " artifact_paths:"
8585
echo " - build/test-results/*.xml"
86+
echo " - build/test-results/*.xml.expected-errors.txt" # these files are uploaded in case it is needed to review the xUnit files in case of CI reports success the step
8687
echo " - build/test-coverage/coverage-*.xml" # these files should not be used to compute the final coverage of elastic-package
8788
done
8889
popd > /dev/null

scripts/links_table.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
links:
22
elastic-main: "https://www.elastic.co/guide"
33
getting-started-observability: "https://www.elastic.co/guide/en/welcome-to-elastic/current/getting-started-observability.html"
4+
elasticsearch-histograms: https://www.elastic.co/guide/en/elasticsearch/reference/current/histogram.html

scripts/test-check-false-positives.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ function check_expected_errors() {
5959
cat ${results_no_spaces} | grep -E "${line}"
6060
done < "${expected_errors_file}"
6161

62+
# Copy XML files to another extension so they are not used to check jUnit tests
63+
# but those files will be able to be reviewed afterwards
64+
for file in $(ls $result_tests) ; do
65+
cp "${file}" "${file}.expected-errors.txt"
66+
done
6267
rm -f ${result_tests}
6368
rm -f ${results_no_spaces}
6469
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test case failed: one or more errors found while examining elastic-agent.logs
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.12.0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dependencies:
2+
ecs:
3+
reference: [email protected]
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Prometheus Integration
2+
3+
This integration can collect metrics from:
4+
- [Prometheus Exporters (Collectors)](#prometheus-exporters-collectors)
5+
- [Prometheus Server Remote-Write](#prometheus-server-remote-write)
6+
- [Prometheus Queries (PromQL)](#prometheus-queries-promql)
7+
8+
## Metrics
9+
10+
### Prometheus Exporters (Collectors)
11+
12+
The Prometheus integration `collector` dataset connects to the Prometheus server and pulls metrics using either the `/metrics` endpoint or the [Prometheus Federation API](https://prometheus.io/docs/prometheus/latest/federation/).
13+
14+
#### Scraping from a Prometheus exporter
15+
16+
To scrape metrics from a Prometheus exporter, configure the `hosts` setting to it. The path
17+
to retrieve the metrics from (`/metrics` by default) can be configured with Metrics Path.
18+
19+
#### Histograms and types
20+
21+
`Use Types` parameter (default: true) enables a different layout for metrics storage, leveraging Elasticsearch
22+
types, including {{ url "elasticsearch-histograms" "histograms" }}.
23+
24+
`Rate Counters` parameter (default: true) enables calculating a rate out of Prometheus counters. When enabled, Metricbeat stores
25+
the counter increment since the last collection. This metric should make some aggregations easier and with better
26+
performance. This parameter can only be enabled in combination with `Use Types`.
27+
28+
When `Use Types` and `Rate Counters` are enabled, metrics are stored like this:
29+
30+
```json
31+
{
32+
"_index": ".ds-metrics-prometheus.collector-default-000001",
33+
"_id": "JlK9AHMBeyDc0b9rCwVA",
34+
"_version": 1,
35+
"_score": null,
36+
"_source": {
37+
"@timestamp": "2020-06-29T15:40:55.028Z",
38+
"prometheus": {
39+
"labels": {
40+
"slice": "inner_eval",
41+
"instance": "localhost:9090",
42+
"job": "prometheus"
43+
},
44+
"prometheus_engine_query_duration_seconds_sum": {
45+
"counter": 0.002697546,
46+
"rate": 0.00006945900000000001
47+
},
48+
"prometheus_engine_query_duration_seconds_count": {
49+
"rate": 1,
50+
"counter": 37
51+
}
52+
},
53+
"dataset": {
54+
"type": "metrics",
55+
"name": "prometheus.collector",
56+
"namespace": "default"
57+
},
58+
"agent": {
59+
"ephemeral_id": "98420e91-ee6d-4883-8ad3-02fa8d47f5c1",
60+
"id": "9fc3e975-6789-4738-a11a-ba7108b0a92c",
61+
"name": "minikube",
62+
"type": "metricbeat",
63+
"version": "8.0.0"
64+
},
65+
"ecs": {
66+
"version": "1.5.0"
67+
},
68+
"event": {
69+
"module": "prometheus",
70+
"duration": 15397122,
71+
"dataset": "prometheus.collector"
72+
},
73+
"metricset": {
74+
"period": 10000,
75+
"name": "collector"
76+
},
77+
"service": {
78+
"address": "localhost:9090",
79+
"type": "prometheus"
80+
},
81+
"stream": {
82+
"namespace": "default",
83+
"type": "metrics",
84+
"dataset": "prometheus.collector"
85+
},
86+
"host": {},
87+
},
88+
"fields": {
89+
"@timestamp": [
90+
"2020-06-29T15:40:55.028Z"
91+
]
92+
},
93+
"highlight": {
94+
"event.dataset": [
95+
"@[email protected]@/kibana-highlighted-field@"
96+
]
97+
},
98+
"sort": [
99+
1593445255028
100+
]
101+
}
102+
```
103+
104+
#### Scraping all metrics from a Prometheus server
105+
106+
We recommend using the Remote Write dataset for this, and make Prometheus push metrics to Agent.
107+
108+
109+
#### Filtering metrics
110+
111+
In order to filter out/in metrics one can make use of `Metrics Filters Include`, `Metrics Filters Exclude` settings:
112+
113+
```yml
114+
Metrics Filters Include: ["node_filesystem_*"]
115+
Metrics Filters Exclude: ["node_filesystem_device_*"]
116+
```
117+
118+
The configuration above will include only metrics that match `node_filesystem_*` pattern and do not match `node_filesystem_device_*`.
119+
120+
121+
To keep only specific metrics, anchor the start and the end of the regexp of each metric:
122+
123+
- the caret ^ matches the beginning of a text or line,
124+
- the dollar sign $ matches the end of a text.
125+
126+
```yml
127+
Metrics Filters Include: ["^node_network_net_dev_group$", "^node_network_up$"]
128+
```
129+
130+
{{event "collector"}}
131+
132+
The fields reported are:
133+
134+
{{fields "collector"}}
135+
136+
137+
## Dashboard
138+
139+
Prometheus integration is shipped including default overview dashboard.
140+
Default dashboard works only for `remote_write` datastream and `collector` darastream, if metrics are scraped from the Prometheus server metrics endpoint.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: '3.2'
2+
services:
3+
prometheus:
4+
image: prom/prometheus:${PROMETHEUS_VERSION:-prometheus_2}
5+
ports:
6+
- 9090:9090
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
variants:
2+
prometheus_2:
3+
PROMETHEUS_VERSION: v2.36.2
4+
default: prometheus_2
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# newer versions go on top
2+
- version: "1.13.1"
3+
changes:
4+
- description: Migrate Prometheus Server Overview dashboard to lens.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/8016
7+
- version: "1.13.0"
8+
changes:
9+
- description: Ensure event.kind is correctly set for pipeline errors.
10+
type: enhancement
11+
link: https://github.com/elastic/integrations/pull/7082
12+
- version: "1.12.1"
13+
changes:
14+
- description: Fix remote_write ingest pipeline to include both metric path 'prometheus.*' and 'prometheus.metrics.*' to fingerprint calculation
15+
type: bugfix
16+
link: https://github.com/elastic/integrations/pull/7882
17+
- version: "1.12.0"
18+
changes:
19+
- description: Use ecs definition of the 'event.dataset' field
20+
type: enhancement
21+
link: https://github.com/elastic/integrations/pull/7667
22+
- version: "1.11.0"
23+
changes:
24+
- description: Enable TSDB by default for remote_write datastreams. This improves storage usage and query performance. For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/current/tsds.html
25+
type: enhancement
26+
link: https://github.com/elastic/integrations/pull/7598
27+
- version: "1.10.0"
28+
changes:
29+
- description: Align fingerprint field name across all datastreams, add handling of pipeline failures to the collector and query datastreams
30+
type: enhancement
31+
link: https://github.com/elastic/integrations/pull/7594
32+
- version: "1.9.0"
33+
changes:
34+
- description: Add dimension and metric_type fields to remote_write datastream
35+
type: enhancement
36+
link: https://github.com/elastic/integrations/pull/7565
37+
- version: "1.8.0"
38+
changes:
39+
- description: Enable TSDB by default for collector and query metrics data streams. This improves storage usage and query performance. For more details, see https://www.elastic.co/guide/en/elasticsearch/reference/current/tsds.html. Still TSDB is not supported for remote_write
40+
type: enhancement
41+
link: https://github.com/elastic/integrations/pull/7261
42+
- version: "1.7.0"
43+
changes:
44+
- description: Revert metrics field definition to the format used before introducing metric_type
45+
type: enhancement
46+
link: https://github.com/elastic/integrations/pull/7324
47+
- version: "1.6.0"
48+
changes:
49+
- description: Add metric_type fields to collector and query datastreams for TSDB support
50+
type: enhancement
51+
link: https://github.com/elastic/integrations/pull/6981
52+
- version: "1.5.0"
53+
changes:
54+
- description: Add dimension fields to collector and query datastreams for TSDB support
55+
type: enhancement
56+
link: https://github.com/elastic/integrations/pull/5974
57+
- version: "1.4.0"
58+
changes:
59+
- description: Add processor configuration
60+
type: enhancement
61+
link: https://github.com/elastic/integrations/pull/6536
62+
- version: "1.3.2"
63+
changes:
64+
- description: Fix timeout and connect_timeout parameter parsing issue
65+
type: bugfix
66+
link: https://github.com/elastic/integrations/pull/6140
67+
- version: "1.3.1"
68+
changes:
69+
- description: Added categories and/or subcategories.
70+
type: enhancement
71+
link: https://github.com/elastic/integrations/pull/5123
72+
- version: "1.3.0"
73+
changes:
74+
- description: Support data_stream.dataset name
75+
type: enhancement
76+
link: https://github.com/elastic/integrations/pull/5336
77+
- version: "1.2.0"
78+
changes:
79+
- description: Enable setting condition on Prometheus Collector
80+
type: enhancement
81+
link: https://github.com/elastic/integrations/pull/5317
82+
- version: "1.1.0"
83+
changes:
84+
- description: Remove "integration" from the package name
85+
type: enhancement
86+
link: https://github.com/elastic/integrations/pull/4983
87+
- version: "1.0.1"
88+
changes:
89+
- description: Removing x-pack references and updating default values
90+
type: enhancement
91+
link: https://github.com/elastic/integrations/pull/4545
92+
- version: "1.0.0"
93+
changes:
94+
- description: Promote integration to GA
95+
type: enhancement
96+
link: https://github.com/elastic/integrations/pull/4315
97+
- version: "0.14.0"
98+
changes:
99+
- description: Update default dashboard
100+
type: enhancement
101+
link: https://github.com/elastic/integrations/pull/4275
102+
- version: "0.13.0"
103+
changes:
104+
- description: Revert index mapping changes for histogram type
105+
type: enhancement
106+
link: https://github.com/elastic/integrations/pull/4060
107+
- version: "0.12.0"
108+
changes:
109+
- description: Disable leader election by default, remove bearer token file default value
110+
type: bugfix
111+
link: https://github.com/elastic/integrations/pull/4034
112+
- version: "0.11.0"
113+
changes:
114+
- description: Fix histogram type in collector data_stream
115+
type: bugfix
116+
link: https://github.com/elastic/integrations/pull/3891
117+
- version: "0.10.0"
118+
changes:
119+
- description: Hide some configuration for remote_write data_stream; Add leader election for collector and query data_streams
120+
type: enhancement
121+
link: https://github.com/elastic/integrations/pull/3662
122+
- version: "0.9.2"
123+
changes:
124+
- description: reworded a link to related documentation in the Readme so it is clearer
125+
type: enhancement
126+
link: https://github.com/elastic/integrations/pull/2916
127+
- version: "0.9.1"
128+
changes:
129+
- description: Add documentation for multi-fields
130+
type: enhancement
131+
link: https://github.com/elastic/integrations/pull/2916
132+
- version: "0.9.0"
133+
changes:
134+
- description: Add standard HTTP options to the package
135+
type: enhancement
136+
link: https://github.com/elastic/integrations/pull/2632
137+
- version: "0.8.0"
138+
changes:
139+
- description: Improve default datastream enablement
140+
type: enhancement
141+
link: https://github.com/elastic/integrations/pull/2619
142+
- version: "0.7.0"
143+
changes:
144+
- description: Release prometheus package for v8.0.0
145+
type: enhancement
146+
link: https://github.com/elastic/integrations/pull/2189
147+
- version: "0.6.1"
148+
changes:
149+
- description: Uniform with guidelines
150+
type: enhancement
151+
link: https://github.com/elastic/integrations/pull/2050
152+
- version: "0.6.0"
153+
changes:
154+
- description: Update to ECS 1.12.0
155+
type: enhancement
156+
link: https://github.com/elastic/integrations/pull/1705
157+
- version: "0.5.1"
158+
changes:
159+
- description: Escape special characters in docs
160+
type: enhancement
161+
link: https://github.com/elastic/integrations/pull/1405
162+
- version: "0.5.0"
163+
changes:
164+
- description: Update integration description
165+
type: enhancement
166+
link: https://github.com/elastic/integrations/pull/1364
167+
- version: "0.4.1"
168+
changes:
169+
- description: Fix yml code blocks
170+
type: enhancement
171+
link: https://github.com/elastic/integrations/pull/1323
172+
- version: "0.4.0"
173+
changes:
174+
- description: Set `event.module` and `event.dataset`
175+
type: enhancement
176+
link: https://github.com/elastic/integrations/pull/1249
177+
- version: "0.3.5"
178+
changes:
179+
- description: Updating package owner
180+
type: enhancement
181+
link: https://github.com/elastic/integrations/pull/766
182+
- version: "0.3.4"
183+
changes:
184+
- description: Correct sample event file.
185+
type: bugfix # can be one of: enhancement, bugfix, breaking-change
186+
link: https://github.com/elastic/integrations/pull/754
187+
- version: "0.3.3"
188+
changes:
189+
- description: Change kibana.version constraint to be more conservative.
190+
type: bugfix
191+
link: https://github.com/elastic/integrations/pull/749
192+
- version: "0.1.0"
193+
changes:
194+
- description: initial release
195+
type: enhancement # can be one of: enhancement, bugfix, breaking-change
196+
link: https://github.com/elastic/integrations/pull/114

0 commit comments

Comments
 (0)