Skip to content

Add a duration field to operator metrics #3713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

dominiklohmann
Copy link
Member

@dominiklohmann dominiklohmann commented Dec 6, 2023

This makes it possible to calculate aggregate ingress and egress metrics in pipelines. For example, the following pipeline shows the total events and bytes per second of ingress of all deployed pipelines with a 5 second granularity.

export --internal
| where #schema == "tenzir.metrics.operator"
| where source == true && hidden == false && internal == false
| summarize ingress=sum(output.elements), duration=sum(duration), unit=sample(output.unit) by pipeline_id, timestamp resolution 5s
| sort timestamp
| sort pipeline_id
| python "self.ingress = f\"{self.ingress / self.duration.total_seconds():.2f} {self.unit}/s\""
| drop duration, unit

Example output:

pipeline_id timestamp ingress
0 2023-12-06T09:51:05.000000 6782452.52 bytes/s
0 2023-12-06T09:51:10.000000 4995643.56 bytes/s
0 2023-12-06T09:51:15.000000 5642430.84 bytes/s
1 2023-12-06T09:51:05.000000 2240839.32 bytes/s
1 2023-12-06T09:51:10.000000 173627.65 bytes/s
1 2023-12-06T09:51:15.000000 203006.98 bytes/s
1 2023-12-06T09:51:20.000000 317132.65 bytes/s
1 2023-12-06T09:51:25.000000 290796.72 bytes/s
1 2023-12-06T09:51:30.000000 342776.31 bytes/s
1 2023-12-06T09:51:35.000000 340050.00 bytes/s
1 2023-12-06T09:51:40.000000 375395.74 bytes/s
1 2023-12-06T09:51:45.000000 437817.19 bytes/s
1 2023-12-06T09:51:50.000000 384628.06 bytes/s
1 2023-12-06T09:51:55.000000 388829.54 bytes/s
1 2023-12-06T09:52:00.000000 364684.71 bytes/s
1 2023-12-06T09:52:05.000000 294056.10 bytes/s
1 2023-12-06T09:52:10.000000 338736.52 bytes/s
1 2023-12-06T09:52:15.000000 361886.25 bytes/s
1 2023-12-06T09:52:20.000000 288960.65 bytes/s
1 2023-12-06T09:52:25.000000 335634.20 bytes/s
1 2023-12-06T09:52:30.000000 358305.64 bytes/s
1 2023-12-06T09:52:35.000000 364837.38 bytes/s
1 2023-12-06T09:52:40.000000 538662.45 bytes/s
1 2023-12-06T09:52:45.000000 512991.94 bytes/s
1 2023-12-06T09:52:50.000000 281204.12 bytes/s

@dominiklohmann dominiklohmann added the improvement An incremental enhancement of an existing feature label Dec 6, 2023
@dominiklohmann dominiklohmann force-pushed the topic/duration-in-pipeline-metrics branch 2 times, most recently from 4e04d9b to 8e526d9 Compare December 6, 2023 10:40
@dominiklohmann dominiklohmann requested a review from tobim December 6, 2023 10:40
This makes it possible to calculate aggregate ingress and egress metrics
in pipelines. For example, the following pipeline shows the total events
and bytes per second of ingress of all deployed pipelines with a 5
second granularity.

```
export --internal
| where #schema == "tenzir.metrics.operator"
| where source == true && hidden == false && internal == false
| summarize ingress=sum(output.elements), duration=sum(duration), unit=sample(output.unit) by pipeline_id, timestamp resolution 5s
| sort timestamp
| sort pipeline_id
| python "self.ingress = f\"{self.ingress / self.duration.total_seconds():.2f} {self.unit}/s\""
| drop duration, unit
```

Example output:

|pipeline_id|timestamp                 |ingress           |
|-----------|--------------------------|------------------|
|0          |2023-12-06T09:51:05.000000|6782452.52 bytes/s|
|0          |2023-12-06T09:51:10.000000|4995643.56 bytes/s|
|0          |2023-12-06T09:51:15.000000|5642430.84 bytes/s|
|1          |2023-12-06T09:51:05.000000|2240839.32 bytes/s|
|1          |2023-12-06T09:51:10.000000|173627.65 bytes/s |
|1          |2023-12-06T09:51:15.000000|203006.98 bytes/s |
|1          |2023-12-06T09:51:20.000000|317132.65 bytes/s |
|1          |2023-12-06T09:51:25.000000|290796.72 bytes/s |
|1          |2023-12-06T09:51:30.000000|342776.31 bytes/s |
|1          |2023-12-06T09:51:35.000000|340050.00 bytes/s |
|1          |2023-12-06T09:51:40.000000|375395.74 bytes/s |
|1          |2023-12-06T09:51:45.000000|437817.19 bytes/s |
|1          |2023-12-06T09:51:50.000000|384628.06 bytes/s |
|1          |2023-12-06T09:51:55.000000|388829.54 bytes/s |
|1          |2023-12-06T09:52:00.000000|364684.71 bytes/s |
|1          |2023-12-06T09:52:05.000000|294056.10 bytes/s |
|1          |2023-12-06T09:52:10.000000|338736.52 bytes/s |
|1          |2023-12-06T09:52:15.000000|361886.25 bytes/s |
|1          |2023-12-06T09:52:20.000000|288960.65 bytes/s |
|1          |2023-12-06T09:52:25.000000|335634.20 bytes/s |
|1          |2023-12-06T09:52:30.000000|358305.64 bytes/s |
|1          |2023-12-06T09:52:35.000000|364837.38 bytes/s |
|1          |2023-12-06T09:52:40.000000|538662.45 bytes/s |
|1          |2023-12-06T09:52:45.000000|512991.94 bytes/s |
|1          |2023-12-06T09:52:50.000000|281204.12 bytes/s |
@dominiklohmann dominiklohmann force-pushed the topic/duration-in-pipeline-metrics branch from 8e526d9 to 06254d0 Compare December 6, 2023 16:48
@dominiklohmann dominiklohmann merged commit 037019f into main Dec 6, 2023
@dominiklohmann dominiklohmann deleted the topic/duration-in-pipeline-metrics branch December 6, 2023 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement An incremental enhancement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants