-
Notifications
You must be signed in to change notification settings - Fork 13
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
Log some study definition stats and timings #782
Conversation
From the suggestions in the issue, the one that I haven't implemented is the suggestion to log
Min/max dates can be dynamic and involve other queries, not just dates, so I'm deferring figuring out how to deal with those until Seb's back and I can ask him |
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.
This is wonderful. It will really help figuring stuff out.
Have left a scatter shot of minor questions and comments.
|
||
|
||
def log_stats(logger, **kwargs): | ||
logger.info("cohortextractor-stats", **kwargs) |
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.
Mild nit: I think the "cohortextractor" prefix is a possibly redundant, I'd probably prefer just "stats"
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.
I'm not very familiar with structlog or cohortextractor logging, but will this result in all stats being logged when running a cohortextractor job in with opensafely run
?
I think we only want to enable this logging in production, as with dummy data its a) not very useful and b) noisy
Could we possibly disable this when running against the expectations backend? And also maybe enabled environment variable for testing/debugging?
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.
Hmm, I just realised most of the logging will only happen in prod anyway, as it's in the tpp/emis bits. But some would still happen in local running too, so probably still worth checking if it's noisy or confusing.
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.
Mild nit: I think the "cohortextractor" prefix is a possibly redundant, I'd probably prefer just "stats"
The prefix was Dave's suggestion, but I'm sure he's not commited to it :). I think we want something unique for greppableness - "stats" might be too likely to turn up in places other than the stats log name
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.
Fair point.
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.
Hmm, I just realised most of the logging will only happen in prod anyway, as it's in the tpp/emis bits. But some would still happen in local running too, so probably still worth checking if it's noisy or confusing.
Yes, all the particularly noisy things (SQL logging) will only happen on prod. I ran the SRO measures study locally to see what it produces, and I think it's ok - this is the log for the main cohort generation:
generate_study_population.log
It has all the codelist variables and sizes, which could possibly be useful in a local run, and it has the timing for the overall generate_cohort
for each index date, which isn't particularly useful in a local run, but it's not that much noise
@bloodearnest I think this is ready for another review now - thanks for all the suggestions! |
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.
This is fab. ONWARDS!
Log some study definition stats and execution timings:
see #777