Skip to content

Commit

Permalink
address pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
efd6 committed Dec 1, 2022
1 parent 6cd27d6 commit 923a290
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
18 changes: 18 additions & 0 deletions filebeat/docs/inputs/input-udp.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ The `udp` input supports the following configuration options plus the

include::../inputs/input-common-udp-options.asciidoc[]

[float]
=== Metrics

This input exposes metrics under the <<http-endpoint, HTTP monitoring endpoint>>.
These metrics are exposed under the `/dataset` path. They can be used to
observe the activity of the input.

[options="header"]
|=======
| Metric | Description
| `device` | Host/port of the UDP stream.
| `udp_read_buffer_length_gauge` | Size of the UDP socket buffer length in bytes (gauge).
| `received_events_total` | Total number of packets (events) that have been received.
| `received_bytes_total` | Total number of bytes received.
| `arrival_period` | Histogram of the time between successive packets in nanoseconds.
| `processing_time` | Histogram of the time taken to process packets in nanoseconds.
|=======

[id="{beatname_lc}-input-{type}-common-options"]
include::../inputs/input-common-options.asciidoc[]

Expand Down
12 changes: 6 additions & 6 deletions filebeat/input/udp/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,19 @@ func newInputMetrics(id, device string, buflen uint64) *inputMetrics {
if id == "" {
return nil
}
reg, unreg := inputmon.NewInputRegistry("udp", id+"::"+device, nil)
reg, unreg := inputmon.NewInputRegistry("udp", id, nil)
out := &inputMetrics{
unregister: unreg,
bufferLen: monitoring.NewUint(reg, "udp_read_buffer_length"),
bufferLen: monitoring.NewUint(reg, "udp_read_buffer_length_gauge"),
device: monitoring.NewString(reg, "device"),
packets: monitoring.NewUint(reg, "udp_packets"),
bytes: monitoring.NewUint(reg, "udp_bytes"),
packets: monitoring.NewUint(reg, "received_events_total"),
bytes: monitoring.NewUint(reg, "received_bytes_total"),
arrivalPeriod: metrics.NewUniformSample(1024),
processingTime: metrics.NewUniformSample(1024),
}
_ = adapter.NewGoMetrics(reg, "udp_arrival_period", adapter.Accept).
_ = adapter.NewGoMetrics(reg, "arrival_period", adapter.Accept).
Register("histogram", metrics.NewHistogram(out.arrivalPeriod))
_ = adapter.NewGoMetrics(reg, "udp_processing_time", adapter.Accept).
_ = adapter.NewGoMetrics(reg, "processing_time", adapter.Accept).
Register("histogram", metrics.NewHistogram(out.processingTime))

out.device.Set(device)
Expand Down

0 comments on commit 923a290

Please sign in to comment.