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 metrics to the native queries underpinning SQL. #4561

Merged
merged 5 commits into from
Jul 25, 2017

Conversation

gianm
Copy link
Contributor

@gianm gianm commented Jul 18, 2017

This is done by factoring out the metrics and request log emitting
code from QueryResource into a new QueryLifecycle class. That class
is used by both QueryResource and the SQL DruidSchema and QueryMaker.

Also fixes a couple of bugs in QueryResource:

  • RequestLogLine start time was set to TimeUnit.NANOSECONDS.toMillis(startNs),
    which is incorrect since absolute nanos cannot be converted to millis.
  • DruidMetrics.makeRequestMetrics was called with null query on
    unparseable queries, which led to spurious "Unable to log query"
    errors.

Partial fix for #4047.

@gianm gianm added this to the 0.11.0 milestone Jul 18, 2017
@gianm gianm force-pushed the sql-metrics-and-such branch from 8140730 to 66ccd29 Compare July 18, 2017 02:17
@gianm gianm requested a review from jon-wei July 18, 2017 18:05
@gianm gianm force-pushed the sql-metrics-and-such branch 4 times, most recently from 66e6f90 to 57fec55 Compare July 24, 2017 17:24
@gianm
Copy link
Contributor Author

gianm commented Jul 24, 2017

Resolved merge conflicts and force pushed, since I think nobody has looked at this yet.

This is done by factoring out the metrics and request log emitting
code from QueryResource into a new QueryLifecycle class. That class
is used by both QueryResource and the SQL DruidSchema and QueryMaker.

Also fixes a couple of bugs in QueryResource:

- RequestLogLine start time was set to `TimeUnit.NANOSECONDS.toMillis(startNs)`,
  which is incorrect since absolute nanos cannot be converted to millis.
- DruidMetrics.makeRequestMetrics was called with null `query` on
  unparseable queries, which led to spurious "Unable to log query"
  errors.

Partial fix for apache#4047.
Copy link
Contributor

@jon-wei jon-wei left a comment

Choose a reason for hiding this comment

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

LGTM

@jon-wei jon-wei merged commit 5048ab3 into apache:master Jul 25, 2017
@gianm gianm deleted the sql-metrics-and-such branch July 25, 2017 06:39
@leventov
Copy link
Member

leventov commented Aug 7, 2017

RequestLogLine start time was set to TimeUnit.NANOSECONDS.toMillis(startNs),
which is incorrect since absolute nanos cannot be converted to millis.

I think a fix for this bug should be backported to 0.10.1

gianm added a commit to gianm/druid that referenced this pull request Aug 7, 2017
A similar fix is included in apache#4561 but this patch has been cut down
for the 0.10.1 branch.
fjy pushed a commit that referenced this pull request Aug 7, 2017
* QueryResource: Fix incorrect request log start times.

A similar fix is included in #4561 but this patch has been cut down
for the 0.10.1 branch.

* Fixups
gianm added a commit to implydata/druid-public that referenced this pull request Aug 14, 2017
* Add metrics to the native queries underpinning SQL.

This is done by factoring out the metrics and request log emitting
code from QueryResource into a new QueryLifecycle class. That class
is used by both QueryResource and the SQL DruidSchema and QueryMaker.

Also fixes a couple of bugs in QueryResource:

- RequestLogLine start time was set to `TimeUnit.NANOSECONDS.toMillis(startNs)`,
  which is incorrect since absolute nanos cannot be converted to millis.
- DruidMetrics.makeRequestMetrics was called with null `query` on
  unparseable queries, which led to spurious "Unable to log query"
  errors.

Partial fix for apache#4047.

* Code style

* Remove unused imports.

* Fix tests.

* Remove unused import.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants