Skip to content

Commit 5d07b87

Browse files
authored
[Heartbeat] Fix fields generation (#21874)
* [Heartbeat] Fix fields generation Fields generation seems to have broken at some time in the past, but we never noticed, because we didn't add fields for quite a while. This fixes this.
1 parent e9d12e2 commit 5d07b87

13 files changed

Lines changed: 271 additions & 291 deletions

File tree

heartbeat/Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ TEST_ENVIRONMENT?=true
88

99
# Collects all dependencies and then calls update
1010
.PHONY: collect
11-
collect: imports kibana
12-
13-
# Generate imports for all monitors
14-
.PHONY: imports
15-
imports:
16-
@mkdir -p include
17-
mage imports
11+
collect: kibana
1812

1913
# Collects all module dashboards
2014
.PHONY: kibana

heartbeat/_meta/fields.common.yml

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,236 @@
122122
type: long
123123
description: Duration in microseconds
124124

125+
- key: http
126+
title: "HTTP monitor"
127+
description:
128+
fields:
129+
- name: http
130+
type: group
131+
description: >
132+
HTTP related fields.
133+
fields:
134+
- name: url
135+
type: alias
136+
path: url.full
137+
migration: true
138+
description: >
139+
Service url used by monitor.
140+
- name: response
141+
type: group
142+
fields:
143+
- name: body
144+
type: group
145+
fields:
146+
- name: hash
147+
type: keyword
148+
description: >
149+
Hash of the full response body. Can be used to group responses with identical hashes.
150+
- name: redirects
151+
type: keyword
152+
description: >
153+
List of redirects followed to arrive at final content. Last item on the list is the URL for which
154+
body content is shown.
155+
- name: headers.*
156+
type: object
157+
enabled: false
158+
description: >
159+
The canonical headers of the monitored HTTP response.
160+
- name: rtt
161+
type: group
162+
description: >
163+
HTTP layer round trip times.
164+
fields:
165+
- name: validate
166+
type: group
167+
description: |
168+
Duration between first byte of HTTP request being written and
169+
response being processed by validator. Duration based on already
170+
available network connection.
171+
172+
Note: if validator is not reading body or only a prefix, this
173+
number does not fully represent the total time needed
174+
to read the body.
175+
fields:
176+
- name: us
177+
type: long
178+
description: Duration in microseconds
179+
180+
- name: validate_body
181+
type: group
182+
description: |
183+
Duration of validator required to read and validate the response
184+
body.
185+
186+
Note: if validator is not reading body or only a prefix, this
187+
number does not fully represent the total time needed
188+
to read the body.
189+
fields:
190+
- name: us
191+
type: long
192+
description: Duration in microseconds
193+
194+
- name: write_request
195+
type: group
196+
description:
197+
Duration of sending the complete HTTP request. Duration based on
198+
already available network connection.
199+
fields:
200+
- name: us
201+
type: long
202+
description: Duration in microseconds
203+
204+
- name: response_header
205+
type: group
206+
description:
207+
Time required between sending the start of sending the HTTP
208+
request and first byte from HTTP response being read. Duration
209+
based on already available network connection.
210+
fields:
211+
- name: us
212+
type: long
213+
description: Duration in microseconds
214+
215+
- name: content.us
216+
type: long
217+
description: Time required to retrieved the content in micro seconds.
218+
219+
- name: total
220+
type: group
221+
description: |
222+
Duration required to process the HTTP transaction. Starts with
223+
the initial TCP connection attempt. Ends with after validator
224+
did check the response.
225+
226+
Note: if validator is not reading body or only a prefix, this
227+
number does not fully represent the total time needed.
228+
fields:
229+
- name: us
230+
type: long
231+
description: Duration in microseconds
232+
- key: tcp
233+
title: "TCP layer"
234+
description:
235+
fields:
236+
- name: tcp
237+
type: group
238+
description: >
239+
TCP network layer related fields.
240+
fields:
241+
- name: port
242+
type: alias
243+
path: url.port
244+
migration: true
245+
description: >
246+
Service port number.
247+
248+
- name: rtt
249+
type: group
250+
description: >
251+
TCP layer round trip times.
252+
fields:
253+
- name: connect
254+
type: group
255+
description: >
256+
Duration required to establish a TCP connection based on already
257+
available IP address.
258+
fields:
259+
- name: us
260+
type: long
261+
description: Duration in microseconds
262+
263+
- name: validate
264+
type: group
265+
description: >
266+
Duration of validation step based on existing TCP connection.
267+
fields:
268+
- name: us
269+
type: long
270+
description: Duration in microseconds
271+
- key: socks5
272+
title: "SOCKS5 proxy"
273+
description:
274+
fields:
275+
- name: socks5
276+
type: group
277+
description: >
278+
SOCKS5 proxy related fields:
279+
fields:
280+
- name: rtt
281+
type: group
282+
description: >
283+
TLS layer round trip times.
284+
fields:
285+
- name: connect
286+
type: group
287+
description: >
288+
Time required to establish a connection via SOCKS5 to endpoint
289+
based on available connection to SOCKS5 proxy.
290+
fields:
291+
- name: us
292+
type: long
293+
description: Duration in microseconds
294+
295+
- key: tls
296+
title: "TLS encryption layer"
297+
description:
298+
fields:
299+
- name: tls
300+
type: group
301+
description: >
302+
TLS layer related fields.
303+
fields:
304+
- name: certificate_not_valid_before
305+
type: date
306+
deprecated: 7.8.0
307+
description: Deprecated in favor of `tls.server.x509.not_before`. Earliest time at which the connection's certificates are valid.
308+
- name: certificate_not_valid_after
309+
deprecated: 7.8.0
310+
type: date
311+
description: Deprecated in favor of `tls.server.x509.not_after`. Latest time at which the connection's certificates are valid.
312+
- name: rtt
313+
type: group
314+
description: >
315+
TLS layer round trip times.
316+
fields:
317+
- name: handshake
318+
type: group
319+
description: >
320+
Time required to finish TLS handshake based on already available network
321+
connection.
322+
fields:
323+
- name: us
324+
type: long
325+
description: Duration in microseconds
326+
- name: server
327+
type: group
328+
description: Detailed x509 certificate metadata
329+
fields:
330+
- name: version_number
331+
type: keyword
332+
ignore_above: 1024
333+
description: Version of x509 format.
334+
example: 3
335+
default_field: false
336+
337+
- key: icmp
338+
title: "ICMP"
339+
description:
340+
fields:
341+
- name: icmp
342+
type: group
343+
description: >
344+
IP ping fields.
345+
fields:
346+
- name: requests
347+
type: integer
348+
description: >
349+
Number if ICMP EchoRequests send.
350+
351+
- name: rtt
352+
type: group
353+
description: ICMP Echo Request and Reply round trip time
354+
fields:
355+
- name: us
356+
type: long
357+
description: Duration in microseconds

heartbeat/cmd/root.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ import (
2525
// include all heartbeat specific autodiscovery builders
2626
_ "github.com/elastic/beats/v7/heartbeat/autodiscover/builder/hints"
2727

28-
// register default heartbeat monitors
29-
_ "github.com/elastic/beats/v7/heartbeat/monitors/defaults"
3028
cmd "github.com/elastic/beats/v7/libbeat/cmd"
3129
"github.com/elastic/beats/v7/libbeat/cmd/instance"
3230
"github.com/elastic/beats/v7/libbeat/common"
3331
"github.com/elastic/beats/v7/libbeat/publisher/processing"
32+
33+
// Import packages that need to register themselves.
34+
_ "github.com/elastic/beats/v7/heartbeat/monitors/active/http"
35+
_ "github.com/elastic/beats/v7/heartbeat/monitors/active/icmp"
36+
_ "github.com/elastic/beats/v7/heartbeat/monitors/active/tcp"
3437
)
3538

3639
const (

heartbeat/include/fields.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

heartbeat/magefile.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,7 @@ func Fields() error {
8080

8181
// Update updates the generated files (aka make update).
8282
func Update() {
83-
mg.SerialDeps(Fields, Config, Imports)
84-
}
85-
86-
// Imports generates an include/list.go file containing
87-
// a import statement for each module and dataset.
88-
func Imports() error {
89-
options := devtools.DefaultIncludeListOptions()
90-
options.ModuleDirs = []string{"monitors"}
91-
options.Outfile = "monitors/defaults/default.go"
92-
options.Pkg = "defaults"
93-
return devtools.GenerateIncludeListGo(options)
83+
mg.SerialDeps(Fields, Config)
9484
}
9585

9686
// Config generates both the short/reference/docker configs.

heartbeat/monitors/active/dialchain/_meta/fields.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)