-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Start collection daily pub api stats (#7016)
* feature: Start collection daily pub api stats * fix: Delete event stats in tests * fix: Remove unused class * feature: Add ip table to event and event_stats --------- Co-authored-by: Daniel Palafox <[email protected]>
- Loading branch information
1 parent
e2208b0
commit ceb7ce3
Showing
31 changed files
with
414 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
orcid-persistence/src/main/resources/db/updates/add_ip_col_in_events.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> | ||
|
||
<changeSet id="ADD-FIELD-TO-EVENT" author="Daniel Palafox"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<columnExists tableName="event" columnName="ip"/> | ||
</not> | ||
</preConditions> | ||
<sql>ALTER TABLE event ADD ip VARCHAR(15);</sql> | ||
</changeSet> | ||
|
||
<changeSet id="ADD-FIELD-TO-EVENT_STATS" author="Daniel Palafox"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not> | ||
<columnExists tableName="event_stats" columnName="ip"/> | ||
</not> | ||
</preConditions> | ||
<sql>ALTER TABLE event_stats ADD ip VARCHAR(15);</sql> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |
45 changes: 45 additions & 0 deletions
45
orcid-persistence/src/main/resources/db/updates/dw_papi_event_stats.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> | ||
|
||
<changeSet id="DROP-VIEW-FOR-EVENT" author="Daniel Palafox" dbms="postgresql"> | ||
<dropView viewName="dw_event_stats"/> | ||
</changeSet> | ||
|
||
<changeSet id="CREATE-DW-EVENT-STATS-VIEW" author="Daniel Palafox" dbms="postgresql"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not><viewExists viewName="dw_event_stats"/></not> | ||
</preConditions> | ||
<createView viewName="dw_event_stats"> | ||
SELECT event_type, client_id, count, DATE_TRUNC('day', date), DATE_TRUNC('day', date) as last_modified | ||
FROM event_stats WHERE event_type != 'Public-API' | ||
ORDER BY DATE_TRUNC('day', date_created) DESC; | ||
</createView> | ||
</changeSet> | ||
|
||
<changeSet id="GRANT-READ-TO-DW_USER-TO-DW_EVENT-STATS-VIEW" author="Daniel Palafox" dbms="postgresql"> | ||
<preConditions> | ||
<sqlCheck expectedResult="1">SELECT 1 FROM pg_roles WHERE rolname='dw_user'</sqlCheck> | ||
</preConditions> | ||
<sql>GRANT SELECT ON TABLE dw_event_stats to dw_user;</sql> | ||
</changeSet> | ||
|
||
<changeSet id="CREATE-DW-PAPI-EVENT-STATS-VIEW" author="Daniel Palafox" dbms="postgresql"> | ||
<preConditions onFail="MARK_RAN"> | ||
<not><viewExists viewName="dw_papi_event_stats"/></not> | ||
</preConditions> | ||
<createView viewName="dw_papi_event_stats"> | ||
SELECT event_type, client_id, ip, count, DATE_TRUNC('day', date), DATE_TRUNC('day', date) as last_modified | ||
FROM event_stats WHERE event_type = 'Public-API' | ||
ORDER BY DATE_TRUNC('day', date_created) DESC; | ||
</createView> | ||
</changeSet> | ||
|
||
<changeSet id="GRANT-READ-TO-DW-USER-TO-DW-PAPI-EVENT-STATS-VIEW" author="Daniel Palafox" dbms="postgresql"> | ||
<preConditions> | ||
<sqlCheck expectedResult="1">SELECT 1 FROM pg_roles WHERE rolname='dw_user'</sqlCheck> | ||
</preConditions> | ||
<sql>GRANT SELECT ON TABLE dw_papi_event_stats to dw_user;</sql> | ||
</changeSet> | ||
|
||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.