Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@svonworl
Copy link
Contributor

@svonworl svonworl commented Jun 26, 2025

Description
This PR adds a new TimeSeriesMetric entity and corresponding database table to the webservice. It also adds a dailyExecutionCounts time series property to MetricsByStatus.

In this configuration, our metrics system will be able to store the daily run counts for any combination of platform (including ALL) and execution status. However, to avoid bloating the database and the metrics responses, the initial plan is to modify the aggregator to only generate a single time series per workflow version, corresponding to daily successful executions on all platforms.

We define a time series as a list of numeric values sampled at a regular time interval. Per that definition, a time series consists of a list of sample values, the date/time of the first sample, and the interval between samples (hour, day, month, etc). Per the storytime discussion, rather than sliding bins, we'll aggregate into fixed bins that span each hour, day, etc. For example, 10:00-10:59, 11:00-11:59, 12:00-12:59, or Monday, Tuesday, Wednesday, etc

We have a choice regarding how to store the samples: either as individual rows in a samples table which we would join to each time series, or as an array in a column in the time series table itself. We chose the latter, because it's more compact and less work for the db server. If we intended to do elaborate queries on the samples themselves, or update/add/delete individual samples, piecemeal, we'd probably choose the former.

For now, I went with a jsonb representation for the list of sample values. Alternatively, we could use sql arrays. It's not yet clear which representation is better supported by Hibernate/HQL, so this may change.

There's intentionally not much testing at the moment. After a prototype is done, I'll survey the coverage, and add tests as necessary.

Note that the branch name contains the wrong ticket name/number.

Review Instructions
Confirm the presence of the new database table and that openapi.yaml contains a description of the new entity.

Issue
https://ucsc-cgl.atlassian.net/browse/SEAB-7194

Security and Privacy

If there are any concerns that require extra attention from the security team, highlight them here and check the box when complete.

  • Security and Privacy assessed

e.g. Does this change...

  • Any user data we collect, or data location?
  • Access control, authentication or authorization?
  • Encryption features?

Please make sure that you've checked the following before submitting your pull request. Thanks!

  • Check that you pass the basic style checks and unit tests by running mvn clean install
  • Ensure that the PR targets the correct branch. Check the milestone or fix version of the ticket.
  • Follow the existing JPA patterns for queries, using named parameters, to avoid SQL injection
  • If you are changing dependencies, check the Snyk status check or the dashboard to ensure you are not introducing new high/critical vulnerabilities
  • Assume that inputs to the API can be malicious, and sanitize and/or check for Denial of Service type values, e.g., massive sizes
  • Do not serve user-uploaded binary images through the Dockstore API
  • Ensure that endpoints that only allow privileged access enforce that with the @RolesAllowed annotation
  • Do not create cookies, although this may change in the future
  • If this PR is for a user-facing feature, create and link a documentation ticket for this feature (usually in the same milestone as the linked issue). Style points if you create a documentation PR directly and link that instead.

@svonworl svonworl self-assigned this Jun 26, 2025
@codecov
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

❌ Patch coverage is 10.71429% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.11%. Comparing base (2aac613) to head (0f263a2).
⚠️ Report is 23 commits behind head on develop.

Files with missing lines Patch % Lines
...tore/webservice/core/metrics/TimeSeriesMetric.java 8.33% 22 Missing ⚠️
...store/webservice/core/metrics/MetricsByStatus.java 33.33% 2 Missing ⚠️
...ore/webservice/DockstoreWebserviceApplication.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #6127      +/-   ##
=============================================
- Coverage      74.21%   74.11%   -0.10%     
- Complexity      5662     5663       +1     
=============================================
  Files            389      390       +1     
  Lines          20335    20362      +27     
  Branches        2101     2101              
=============================================
+ Hits           15091    15092       +1     
- Misses          4246     4272      +26     
  Partials         998      998              
Flag Coverage Δ
bitbuckettests 25.91% <7.14%> (-0.03%) ⬇️
hoverflytests 27.59% <7.14%> (-0.03%) ⬇️
integrationtests 56.06% <7.14%> (-0.07%) ⬇️
languageparsingtests 10.81% <7.14%> (-0.01%) ⬇️
localstacktests 21.32% <10.71%> (-0.02%) ⬇️
toolintegrationtests 29.85% <7.14%> (-0.03%) ⬇️
unit-tests_and_non-confidential-tests 26.28% <7.14%> (-0.03%) ⬇️
workflowintegrationtests 37.38% <7.14%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@svonworl svonworl requested review from denis-yuen and kathy-t June 26, 2025 20:33
@denis-yuen
Copy link
Member

For now, I went with a jsonb representation for the list of sample values. Alternatively, we could use sql arrays. It's not yet clear which representation is better supported by Hibernate/HQL, so this may change.

This is a question that I have or are curious about as well

Copy link
Member

@denis-yuen denis-yuen left a comment

Choose a reason for hiding this comment

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

Some general thoughts/questions, general direction makes sense

@JdbcTypeCode(SqlTypes.JSON)
@Column(nullable = false)
@NotNull
@ArraySchema(arraySchema = @Schema(description = "List of sample values, oldest values first"), schema = @Schema(description = "Sample value"))
Copy link
Member

Choose a reason for hiding this comment

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

One wrinkle of daily is that adding a day and ordering oldest values first is we need to rewrite the whole array. On second thought, may be unavoidable with daily and a fixed number of days
Not sure if there's any way to avoid rewriting everything every new day we run the aggregator

Copy link
Contributor Author

@svonworl svonworl Jul 1, 2025

Choose a reason for hiding this comment

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

One wrinkle of daily is that adding a day and ordering oldest values first is we need to rewrite the whole array. On second thought, may be unavoidable with daily and a fixed number of days Not sure if there's any way to avoid rewriting everything every new day we run the aggregator

Given the current "compute and overwrite the entire metric record on update" semantics of the aggregator, my assumption is that, we'll be updating the entire time series (along with all of the other computed metrics) every time the execution data for a workflow version changes, in the near term, at least. I can imagine optimizing the system to make the time series metrics (and potentially other metrics) incrementally computable/updatable, but it's far from a simple thing, especially if you're supporting updates to existing execution information, in addition to information about new executions.

@svonworl svonworl requested a review from denis-yuen July 2, 2025 16:15
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
10.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Member

@denis-yuen denis-yuen left a comment

Choose a reason for hiding this comment

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

Flagging for knowledge

@svonworl svonworl requested a review from denis-yuen August 6, 2025 21:41
@svonworl svonworl merged commit 6f54f7b into develop Aug 11, 2025
21 of 24 checks passed
@svonworl svonworl deleted the feature/dock-2603/add-time-series-metric-entity branch August 11, 2025 15:42
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