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

Convert second(Integer class) to nanosecond precision #1656

Merged

Conversation

takanabe
Copy link
Contributor

@takanabe takanabe commented Feb 7, 2020

What this PR does / why we need it:

The commits to convert second precision to nanosecond prevision should be considered not only Fluent::EventTime object but Integer object. Otherwise, this causes the following error.

td-agent.log:482992:2020-01-30 03:40:48 +0000 [warn]: #0 [forward_to_loki] got unrecoverable error in primary and no secondary error_class=NoMethodError error="undefined method `nsec' for 1580355636:Integer\nDid you mean?  inspect"
td-agent.log:482994:2020-01-30 03:40:48 +0000 [warn]: #0 [forward_to_loki] bad chunk is moved to /tmp/fluent/backup/worker0/forward_to_loki/59d53385f435fa0b70e60a0101e7091d.log

This is because Integer does not have nsec method

irb(main):001:0> 1.class
=> Integer
irb(main):002:0> 1.nsec
Traceback (most recent call last):
        4: from /Users/takayuki-watanabe/.rbenv/versions/2.6/bin/irb:23:in `<main>'
        3: from /Users/takayuki-watanabe/.rbenv/versions/2.6/bin/irb:23:in `load'
        2: from /Users/takayuki-watanabe/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/irb-1.2.0/exe/irb:11:in `<top (required)>'
        1: from (irb):2
NoMethodError (undefined method `nsec' for 1:Integer)

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

This PR should be merged after I add some specs but it will take time since the current specs are broken. #1645

Checklist

  • Tests updated: Not yet

@takanabe takanabe changed the title Convert integer to nanosecond precision Convert second(Integer class) to nanosecond precision Feb 7, 2020
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

@cyriltovena cyriltovena merged commit 675a5f3 into grafana:master Feb 7, 2020
billimek added a commit to billimek/loki that referenced this pull request Feb 13, 2020
* 'extraPorts' of github.com:billimek/loki: (25 commits)
  Ensure status codes are set correctly in the frontend. (grafana#1684)
  --dry-run Promtail. (grafana#1652)
  Fix logcli --quiet parameter parsing issue (grafana#1682)
  This improves the log ouput for statistics in the logcli. (grafana#1644)
  Loki stack helm chart can deploy datasources without Grafana (grafana#1688)
  Automatically prune metrics from the /metrics output of the promtail metrics pipeline stage after an idle period.
  Allow a metric defined as a counter to match all lines, useful for creating line count metrics which include all your labels. Found a bug in the the test runner where it didn't fail if the actual error was nil but the test expected an error Added some tests to the counters to test valid configs
  maintainer links & usernames (grafana#1675)
  Binary operators in LogQL (grafana#1662)
  Pipe data to Promtail (grafana#1649)
  Add Owen to the maintainer team. (grafana#1673)
  Update tanka.md so that promtail.yml is in the correct format (grafana#1671)
  Correcte syntax of rate example (grafana#1641)
  Frontend & Querier query statistics instrumentation. (grafana#1661)
  loki-canary: fix indent of DaemonSet manifest written in .md file (grafana#1648)
  Query frontend service should be headless. (grafana#1665)
  Support custom prefix name in metrics stage (grafana#1664)
  pkg/promtail/positions: handle empty positions file (grafana#1660)
  Convert second(Integer class) to nanosecond precision (grafana#1656)
  Unite docs for fluentd plugin (grafana#1634)
  ...
@nomatterz
Copy link

Events from in_forward plugin are not getting to the Loki without this fix.
Nice job!
Is there a way to change time type in original event using default fluentd plugins ( so it's not Integer)? Or there should be strict alignment between input and output plugins?

@cyriltovena
Copy link
Contributor

I still need to push the gem, for this PR.

@takanabe takanabe deleted the convert_integer_to_nanosecond_precision branch February 16, 2020 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants