Skip to content
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

feat: table view support for cumulative & delta metrics #3110

Merged
merged 17 commits into from
Jul 17, 2023

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented Jul 12, 2023

Part of #2842

Attempts at showing what happens with an example. I will be happy to answer any questions or explain in more detail.

signoz_metrics.samples_v2

id t v(cumulative) v(delta)
S1 12.00 0 0
S1 12.05 12 12
S1 12.10 14 2
S1 12.15 16 2
S1 12.20 22 6
S1 12.25 25 3
S1 12.30 32 7
S1 12.35 37 5
S1 12.40 45 8
S1 12.45 49 4
S1 12.50 59 10
S1 12.55 66 7
S2 12.00 0 0
S2 12.05 15 15
S2 12.10 17 2
S2 12.15 21 4
S2 12.20 34 13
S2 12.25 36 2
S2 12.30 45 9
S2 12.35 47 2
S2 12.40 49 2
S2 12.45 51 2
S2 12.50 62 11
S2 12.55 71 9

signoz_metrics.time_series_v2

id labels
S1 {service_name:frontend, operation:GET}
S2 {service_name:frontend, operation:POST}

Assume you wanted a request rate for the service frontend.

Here is what we would do for the delta. We join the both the table on the id and then on the result we use sum(value)/duration to get the rate.

Here is the intermediary result of the join.

id t v(cumulative) v(delta) labels
S1 12.00 0 0 {service_name:frontend, operation:GET}
S1 12.05 12 12 {service_name:frontend, operation:GET}
S1 12.10 14 2 {service_name:frontend, operation:GET}
S1 12.15 16 2 {service_name:frontend, operation:GET}
S1 12.20 22 6 {service_name:frontend, operation:GET}
S1 12.25 25 3 {service_name:frontend, operation:GET}
S1 12.30 32 7 {service_name:frontend, operation:GET}
S1 12.35 37 5 {service_name:frontend, operation:GET}
S1 12.40 45 8 {service_name:frontend, operation:GET}
S1 12.45 49 4 {service_name:frontend, operation:GET}
S1 12.50 59 10 {service_name:frontend, operation:GET}
S1 12.55 66 7 {service_name:frontend, operation:GET}
S2 12.00 0 0 {service_name:frontend, operation:POST}
S2 12.05 15 15 {service_name:frontend, operation:POST}
S2 12.10 17 2 {service_name:frontend, operation:POST}
S2 12.15 21 4 {service_name:frontend, operation:POST}
S2 12.20 34 13 {service_name:frontend, operation:POST}
S2 12.25 36 2 {service_name:frontend, operation:POST}
S2 12.30 45 9 {service_name:frontend, operation:POST}
S2 12.35 47 2 {service_name:frontend, operation:POST}
S2 12.40 49 2 {service_name:frontend, operation:POST}
S2 12.45 51 2 {service_name:frontend, operation:POST}
S2 12.50 62 11 {service_name:frontend, operation:POST}
S2 12.55 71 9 {service_name:frontend, operation:POST}

For delta we would sum the value column group by the service_name:

service_name sum(v)/ duration
frontend (12 + 2 + 2 + 6 + 3 + 7 + 5 + 8 + 4 + 10 + 7 + 15 + 2 + 4 + 13 + 2 + 9 + 2 + 2 + 2 + 11 + 9)/ 60

For cumulative we would would first need to calculate the rate of change for each series and then sum them up.

service_name t runningRate
frontend 12.05 (12-0)/0.5
frontend 12.10 (14-12)/0.5
frontend 12.15 (16-14)/0.5
frontend 12.20 (22-16)/0.5
frontend 12.25 (25-22)/0.5
frontend 12.30 (32-25)/0.5
frontend 12.35 (37-32)/0.5
frontend 12.40 (45-37)/0.5
frontend 12.45 (49-45)/0.5
frontend 12.50 (59-49)/0.5
frontend 12.55 (66-59)/0.5
frontend 12.05 (15-0)/0.5
frontend 12.10 (17-15)/0.5
frontend 12.15 (21-17)/0.5
frontend 12.20 (34-21)/0.5
frontend 12.25 (36-34)/0.5
frontend 12.30 (45-36)/0.5
frontend 12.35 (47-45)/0.5
frontend 12.40 (49-47)/0.5
frontend 12.45 (51-49)/0.5
frontend 12.50 (62-51)/0.5
frontend 12.55 (71-62)/0.5

Now we sum the runningRate column and divide by the duration.

service_name sum(runningRate)/ duration
frontend (12 + 2 + 2 + 6 + 3 + 7 + 5 + 8 + 4 + 10 + 7 + 15 + 2 + 4 + 13 + 2 + 9 + 2 + 2 + 2 + 11 + 9)/ (5minutes * 10points)

@github-actions github-actions bot added the enhancement New feature or request label Jul 12, 2023
Base automatically changed from delta to develop July 13, 2023 13:22
@srikanthccv srikanthccv marked this pull request as ready for review July 14, 2023 02:48
@nityanandagohain
Copy link
Member

Will take some time to read about cumulative and delta metrics and then review this.

@srikanthccv
Copy link
Member Author

Appreciate it. I have written a descriptive comment here to explain the difference #2505. I will do the same with little more details and queries to help understand changes better.

@srikanthccv
Copy link
Member Author

I updated the PR description with an example to show what is the underlying table structure and how is a final value calculated and how does it relate to the query written.

@srikanthccv
Copy link
Member Author

Please find some time to review. Let me know if there is something I can help understand any part better or could improve.

@nityanandagohain
Copy link
Member

Will review today

Copy link
Member

@nityanandagohain nityanandagohain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining the concept, looks good to me.

@srikanthccv srikanthccv merged commit 5e89211 into develop Jul 17, 2023
@srikanthccv srikanthccv deleted the table-view-metrics-initial branch July 17, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants