-
Notifications
You must be signed in to change notification settings - Fork 169
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
Application usage statistics #2387
base: master
Are you sure you want to change the base?
Conversation
|
||
@Controller | ||
@Path("/statistic/") | ||
@ConditionalOnProperty(value = "audit.trail.enabled", havingValue = "true") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Audit Trail feature is not enabled the Controller is not efficient
private StatisticService service; | ||
|
||
public enum ResponseFormat { | ||
CSV, JSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both CSV and JSON output formats should be supported
.header("Content-Disposition", String.format("attachment; filename=\"%s\"", filename)) | ||
.build(); | ||
} catch (Exception ex) { | ||
throw new RuntimeException(ex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may add some logging here
} | ||
} | ||
|
||
private void updateExecutionStatisticsHeader(boolean showUserInformation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both methods to be replaced by extra two static constants!
private String sourceName; | ||
private String executionName; | ||
private String executionDate; | ||
private String userID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
userId
protected final Logger LOG = LoggerFactory.getLogger(getClass()); | ||
|
||
@Value("${audit.trail.log.file}") | ||
// TODO remove value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be configured via properties
@@ -0,0 +1,2 @@ | |||
UPDATE ${ohdsiSchema}.sec_permission SET value='statistic:executions:post' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may combine both scripts into one
Addressing #2329
Business logic is based on parsing Audit Trail log entries. As some of the Analysis Execution entries were identified as duplicates a filter has been introduced to count each Analysis Execution precisely once
Usage examples (for the second one {} is used in the 'urlPattern' parameter to indicated a dynamic part of the URL):