Commit f5d0c56
authored
enhancement(observability): Add metrics to measure total event processing time (#24481)
* chore(core): Add `ingest_timestamp` to `EventMetadata`
We want to record the time at which events are ingested in order to track
latency as each travels through the topology. This is currently recorded for log
events using the Vector namespace in the `vector.ingest_timestamp` metadata
field, but we want it to be usable for all event types. As such, we need a new
field in `struct EventMetadata`.
This change adds the new field as an `Option` so as to retain sane semantics for
`Default` implementations and to avoid extra calls to `Utc::now`. The
`SourceSender::send` method sets this if the source doesn't so as to ensure
complete coverage.
For backward compatibility, this metadata is still inserted into the Vector log
namespace metadata, taken from this new field. Since this metadata is set up
before passing the events to the `SourceSender`, the ingest timestamp is set
manually in sources that can create Vector namespace logs.
* Add new `EwmaGauge` wrapper to handle both in one update step
* enhancement(observability): Add metrics to measure total event processing time
This adds an optional `trait BufferInstrumentation` hook to `struct
BufferSender` which is called at the very start of the buffer send path. We use
that hook to take the previously added universal event `ingest_timestamp`
metadata and from it calculate the total time spent processing the event,
including buffering delays. This time is emitted in internal metrics as a
`event_processing_time_seconds` histogram and
`event_processing_time_mean_seconds` gauge, the latter using an EWMA to smooth
the mean over time.
* Update wording on the lognamespacing tutorial docs.
* Pre-create metrics to avoid extraneous labels
* Fix tests
* Move setting ingest timestamp back into `insert_standard_vector_source_metadata`
* Assert an upper limit on the average latency gauge too1 parent 249657b commit f5d0c56
File tree
42 files changed
+673
-67
lines changed- changelog.d
- docs/tutorials
- lib
- vector-buffers/src
- topology/channel
- vector-common/src/stats
- vector-core/src
- config
- event
- source_sender
- src
- config
- sources
- aws_kinesis_firehose
- aws_s3
- docker_logs
- file_descriptors
- fluent
- kubernetes_logs
- util
- websocket
- test_util/mock
- sinks
- topology
- test
- website/cue/reference
- components
- sources
- generated
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
42 files changed
+673
-67
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
111 | 118 | | |
112 | 119 | | |
113 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 23 | | |
29 | 24 | | |
30 | 25 | | |
| |||
114 | 109 | | |
115 | 110 | | |
116 | 111 | | |
117 | | - | |
118 | | - | |
| 112 | + | |
119 | 113 | | |
120 | 114 | | |
121 | 115 | | |
| |||
150 | 144 | | |
151 | 145 | | |
152 | 146 | | |
153 | | - | |
154 | 147 | | |
155 | 148 | | |
156 | 149 | | |
157 | 150 | | |
158 | 151 | | |
| 152 | + | |
159 | 153 | | |
160 | 154 | | |
161 | 155 | | |
162 | 156 | | |
163 | 157 | | |
164 | 158 | | |
165 | | - | |
| 159 | + | |
166 | 160 | | |
167 | | - | |
168 | 161 | | |
169 | 162 | | |
170 | 163 | | |
171 | 164 | | |
172 | 165 | | |
173 | 166 | | |
174 | 167 | | |
| 168 | + | |
175 | 169 | | |
176 | 170 | | |
177 | 171 | | |
178 | 172 | | |
179 | 173 | | |
180 | 174 | | |
181 | | - | |
| 175 | + | |
182 | 176 | | |
183 | | - | |
184 | 177 | | |
185 | 178 | | |
186 | 179 | | |
| |||
192 | 185 | | |
193 | 186 | | |
194 | 187 | | |
195 | | - | |
196 | | - | |
| 188 | + | |
197 | 189 | | |
198 | 190 | | |
199 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
149 | | - | |
| 151 | + | |
150 | 152 | | |
| 153 | + | |
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
| |||
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
160 | | - | |
| 163 | + | |
161 | 164 | | |
| 165 | + | |
162 | 166 | | |
163 | 167 | | |
164 | 168 | | |
| |||
174 | 178 | | |
175 | 179 | | |
176 | 180 | | |
177 | | - | |
| 181 | + | |
178 | 182 | | |
179 | 183 | | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
184 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
185 | 194 | | |
186 | 195 | | |
187 | 196 | | |
| |||
197 | 206 | | |
198 | 207 | | |
199 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
200 | 212 | | |
201 | | - | |
| 213 | + | |
202 | 214 | | |
203 | 215 | | |
204 | 216 | | |
205 | 217 | | |
206 | 218 | | |
207 | | - | |
| 219 | + | |
208 | 220 | | |
209 | 221 | | |
210 | 222 | | |
| |||
229 | 241 | | |
230 | 242 | | |
231 | 243 | | |
232 | | - | |
| 244 | + | |
233 | 245 | | |
234 | 246 | | |
235 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
0 commit comments