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

Add timing for query parsing to GraphQLController #214

Merged
merged 2 commits into from
Oct 17, 2017

Conversation

bryankane
Copy link
Contributor

This will let us see if there are random slowdowns in query parsing. If not, we'll instrument more!

PTAL @yifan-coursera or @mkovacs-coursera

This will let us see if there are random slowdowns in query parsing. If not, we'll instrument more!
Copy link

@keith-coursera keith-coursera left a comment

Choose a reason for hiding this comment

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

LGTM; optional suggestions, most important one is to add operationName to what's logged.

val before = System.currentTimeMillis()
val res = f
val after = System.currentTimeMillis()
logger.info(s"Parsed query in ${after - before}ms")

Choose a reason for hiding this comment

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

This message would be much more useful if you passed in and logged operation here. Maybe some graphQL queries are slower than others.

Choose a reason for hiding this comment

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

Another note about this. This is going to probably cause a lot of logging. Consider logging at debug level, then we turn it on while triaging? I'm not sure how you guys normally do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This MetricsCollector isn't designed to be used in production (we override this with a DatadogMetricsCollector in our repo), so this is mostly just used for debugging in the example project

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, but I could tag the metric with operation name. good point

QueryParser.parse(query) match {
val parsedQuery = metricsCollector.timeQueryParsing {
QueryParser.parse(query)
}

Choose a reason for hiding this comment

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

This is a start. Do you think the later assignments to incomingQuery, filterFn and the call to filterFn(incomingQuery) are worth tracking, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this doesn't give us any actionable data, we can add some more tracking in. I'm pretty sure those are all very cheap operations, so I don't want to over-collect data. But it's easy enough to add it in later.

Choose a reason for hiding this comment

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

agreed

@bryankane bryankane merged commit d3b633b into coursera:master Oct 17, 2017
@bryankane bryankane deleted the graphql-query-parse-timing branch October 17, 2017 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants