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(2911): Support pipeline metrics in templateFactory #583

Merged
merged 26 commits into from
Aug 31, 2023
Merged

feat(2911): Support pipeline metrics in templateFactory #583

merged 26 commits into from
Aug 31, 2023

Conversation

nathom
Copy link
Contributor

@nathom nathom commented Jul 31, 2023

Context

It has been requested that template maintainers are able to see who is using which version, so that once
a new version has been released, those using an old version can be notified.

Objective

Show the Pipelines that use a template version.

References

screwdriver-cd/screwdriver#2911

License

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
@nathom nathom marked this pull request as draft August 1, 2023 22:14
@nathom nathom changed the title Add pipeline IDs and counts to template feat(2911): Support pipeline metrics in templateFactory Aug 11, 2023
lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
Comment on lines 275 to 278
const metricPipelinesConfig = {
params: { templateId: templateIds },
readOnly: true
};
Copy link
Member

Choose a reason for hiding this comment

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

This is not an optimal solution. This approach loads the all the fields of job objects from the DB to memory and perform aggregation here.

As we had discussed, we should enhance datastore-sequelize to accept input and generate below SQL query so that the aggregation is performed at source (DB)

select count(distinct(pipelineId)), templateId
from jobs
group by templateId;

lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
nathom and others added 7 commits August 22, 2023 13:40
Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>
Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>
Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>
Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>
@nathom nathom marked this pull request as ready for review August 28, 2023 19:30
lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
lib/templateFactory.js Outdated Show resolved Hide resolved
test/lib/templateFactory.test.js Outdated Show resolved Hide resolved
test/lib/templateFactory.test.js Outdated Show resolved Hide resolved
lib/templateFactory.js Show resolved Hide resolved
test/lib/templateFactory.test.js Outdated Show resolved Hide resolved
test/lib/templateFactory.test.js Show resolved Hide resolved
test/lib/templateFactory.test.js Show resolved Hide resolved
test/lib/templateFactory.test.js Show resolved Hide resolved
Remove comment

Add filter

Fix filter

Update lib/templateFactory.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Update test/lib/templateFactory.test.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Update test/lib/templateFactory.test.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Update lib/templateFactory.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Update lib/templateFactory.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Update lib/templateFactory.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Update lib/templateFactory.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Improve test data

Update lib/templateFactory.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Update lib/templateFactory.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Update test/lib/templateFactory.test.js

Co-authored-by: Dayanand Sagar <sagar1312@gmail.com>

Fix pipelineUsage tests

Remove unnecessary mocks

Add test

Verify calls

Remove only
@sagar1312 sagar1312 merged commit e18952f into screwdriver-cd:master Aug 31, 2023
@sd-buildbot
Copy link

🎉 This PR is included in version 29.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants