Skip to content

Conversation

@dechdev
Copy link
Contributor

@dechdev dechdev commented Dec 1, 2021

In order to support histograms, pie charts, and other charting in Firefly-UI, an endpoint is needed to fetch an array of row counts in a table, where each index (bucket) of the array is the count for the corresponding time interval between the start and end time.

time interval = startTime - endTime / buckets

GET /api/v1/namespaces/default/metrics with the following params:
startTime: unix time stamp to specify the start time of the data you want to fetch (ex. 1638279785)
endTime: unix time stamp to specify the end time of the data you want to fetch (ex. 1638366185)
buckets: number of buckets to divide the data into between the start and end time
type: the table name of the data you want to fetch data for

Typical response times for this endpoint are 50-100ms. The buckets param is hard capped at 100 buckets to prevent expensive queries to the DB

David Echelberger added 5 commits November 24, 2021 00:29
Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
@dechdev dechdev changed the title Metrics endpoint to support charting Metrics endpoint to support charting (WIP: Unit Tests) Dec 1, 2021
Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2021

Codecov Report

Merging #341 (59e4f15) into main (4682849) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              main      #341    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          234       237     +3     
  Lines        12796     12896   +100     
==========================================
+ Hits         12796     12896   +100     
Impacted Files Coverage Δ
internal/orchestrator/orchestrator.go 100.00% <ø> (ø)
internal/apiserver/route_get_chart_histogram.go 100.00% <100.00%> (ø)
internal/database/sqlcommon/chart_sql.go 100.00% <100.00%> (ø)
internal/orchestrator/chart.go 100.00% <100.00%> (ø)
internal/assets/token_transfer.go 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4682849...59e4f15. Read the comment docs.

@dechdev dechdev changed the title Metrics endpoint to support charting (WIP: Unit Tests) Metrics endpoint to support charting Dec 2, 2021
Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
David Echelberger added 3 commits December 3, 2021 13:36
Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
Copy link
Contributor

@awrichar awrichar left a comment

Choose a reason for hiding this comment

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

Looks good! Noted one small change inline on error messages.

Signed-off-by: David Echelberger <david.echelberger@kaleido.io>
@shorsher shorsher merged commit 31b917c into hyperledger:main Dec 6, 2021
@dechdev dechdev deleted the metrics branch February 11, 2022 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants