File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ def metrics
34
34
pactVersions : {
35
35
count : PactBroker ::Pacts ::PactVersion . count
36
36
} ,
37
+ pactRevisions : {
38
+ counts : pact_revision_counts
39
+ } ,
37
40
verificationResults : {
38
41
count : PactBroker ::Domain ::Verification . count ,
39
42
first : format_date_time ( PactBroker ::Domain ::Verification . order ( :id ) . first . created_at ) ,
@@ -59,6 +62,13 @@ def metrics
59
62
}
60
63
}
61
64
end
65
+
66
+ def pact_revision_counts
67
+ query = "select revision_count as number_of_revisions, count(consumer_version_id) as consumer_version_count
68
+ from (select consumer_version_id, count(*) as revision_count from pact_publications group by consumer_version_id) foo
69
+ group by revision_count"
70
+ PactBroker ::Pacts ::PactPublication . db [ query ] . all . each_with_object ( { } ) { |row , hash | hash [ row [ :number_of_revisions ] ] = row [ :consumer_version_count ] }
71
+ end
62
72
end
63
73
end
64
74
end
You can’t perform that action at this time.
0 commit comments