{"id":21056937,"url":"https://github.com/fluent-plugins-nursery/fluent-plugin-elapsed-time","last_synced_at":"2025-03-14T00:23:52.770Z","repository":{"id":13454116,"uuid":"16143673","full_name":"fluent-plugins-nursery/fluent-plugin-elapsed-time","owner":"fluent-plugins-nursery","description":"Fluentd plugin to measure elapsed time to process messages","archived":false,"fork":false,"pushed_at":"2017-02-09T03:05:21.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T05:55:17.183Z","etag":null,"topics":["fluentd-output-plugin","fluentd-plugin","multioutput","v10","v12","v14"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluent-plugins-nursery.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-22T15:49:52.000Z","updated_at":"2024-04-21T13:14:15.000Z","dependencies_parsed_at":"2022-07-30T14:48:03.577Z","dependency_job_id":null,"html_url":"https://github.com/fluent-plugins-nursery/fluent-plugin-elapsed-time","commit_stats":null,"previous_names":["sonots/fluent-plugin-elapsed-time"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluent-plugins-nursery%2Ffluent-plugin-elapsed-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluent-plugins-nursery%2Ffluent-plugin-elapsed-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluent-plugins-nursery%2Ffluent-plugin-elapsed-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluent-plugins-nursery%2Ffluent-plugin-elapsed-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluent-plugins-nursery","download_url":"https://codeload.github.com/fluent-plugins-nursery/fluent-plugin-elapsed-time/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243500852,"owners_count":20300797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fluentd-output-plugin","fluentd-plugin","multioutput","v10","v12","v14"],"created_at":"2024-11-19T16:55:12.723Z","updated_at":"2025-03-14T00:23:52.739Z","avatar_url":"https://github.com/fluent-plugins-nursery.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fluent-plugin-elapsed-time\n\n[![Build Status](https://secure.travis-ci.org/sonots/fluent-plugin-elapsed-time.png?branch=master)](http://travis-ci.org/sonots/fluent-plugin-elapsed-time)\n\nFluentd plugin to measure elapsed time to process messages\n\n## Installation\n\nUse RubyGems:\n\n    gem install fluent-plugin-elapsed-time\n\n## Illustration\n\nThis illustration draws how fluent-plugin-elapsed-time measures elapsed times.\n\n```\n     +–––––––––––––+    +––––––––––––––+   +––––––––––––––+   +–––––––––––––––+\n     |   Input     |    |  ElapsedTime |   |   Output     |   |   Output      |\n     +––––––+––––––+    +––––––+–––––––+   +––––––+–––––––+   +–––––––+–––––––+\n#on_message |                  |                  |                   |\n            +––––––––––––––––––\u003e                  |                   |\n            |      #emit       | start = Time.now |                   |\n            |                  +––––––––––––––––––\u003e                   |\n            |                  |      #emit       +–––––––––––––––––––\u003e        \n            |                  |                  |     #emit         |        \n            |                  |                  \u003c– – – – –  – – – – +        \n            |                  \u003c– – – – – – – – – +                   |\n            |                  | elapsed = Time.now - start           |\n            \u003c– – – – – - – – – +                  |                   |\n            |                  |                  |                   |\n            +                  +                  +                   +\n```\n\n## Configuration\n\nExample:\n\nFollowing example measures the max and average time taken to process [fluent-plugin-grep](https://github.com/sonots/fluent-plugin-grep) =\u003e out_stdout chain in messages. Please notice that this plugin measures the total processing time until match chain finishes.\n\n```apache\n\u003cmatch greped.**\u003e\n  type stdout\n\u003c/match\u003e\n\n\u003cmatch elapsed\u003e\n  type stdout\n\u003c/match\u003e\n\n\u003cmatch **\u003e\n  type elapsed_time\n  tag elapsed\n  interval 60\n  each message\n  \u003cstore\u003e\n    type grep\n    exclude foobar\n    add_tag_prefix greped\n  \u003c/store\u003e\n\u003c/match\u003e\n```\n\nOutput will be like\n\n```\nelapsed: {\"max\":1.011,\"avg\":0.002\",\"num\":10}\n```\n\nwhere `max` and `avg` are the maximum and average elapsed times, and `num` is the number of messages.\n\n## Option Parameters\n\n* interval\n\n    The time interval to emit measurement results\n\n* each\n\n    Measure time for each `message` or `es` (event stream). Please notice that the event stream (would be a msgpack) will be unpacked if `message` is specified, which would cause performance degradation. Default is `es`.\n\n* tag\n\n    The output tag name. Default is `elapsed`\n\n* add_tag_prefix\n\n    Add tag prefix for output message\n\n* remove_tag_prefix\n\n    Remove tag prefix for output message\n\n* remove_tag_slice *min..max*\n\n    Remove tag parts by slice function. FYI: This option behaves like `tag.split('.').slice(min..max)`.\n\n    For example,\n\n        remove_tag_slice 0..-2\n\n    changes an input tag `foo.bar.host1` to `foo.bar`. \n\n* aggregate\n\n    Measure and emit outputs for each `tag` or `all`. Default is `all`.\n\n    `all` measures `max` and `avg` for all input messages.\n    `tag` measures `max` and `avg` for each tag *modified* by `add_tag_prefix`, `remove_tag_prefix`, or `remove_tag_slice`. \n\n* zero_emit *bool*\n\n    Emit 0 on the next interval. This is useful for some software which requires resetting data such as [GrowthForecast](http://kazeburo.github.io/GrowthForecast).\n\n        elapsed: {\"max\":1.013,\"avg\":0.123,\"num\"=\u003e0}\n        # after @interval later\n        elapsed: {\"max\":0,\"avg\":0,\"num\"=\u003e0}\n\n## Relatives\n\n* [fluent-plugin-measure_time](https://github.com/sonots/fluent-plugin-measure_time)\n\n  * This plugin make possible to measure the elapsed time of not only output plugins but also input plugins.\n  * Also, this plugin has a flexibility to measure arbitrary methods of plugins. \n  * But, this does not have flexibility of output messages such as `add_tag_prefix`, `aggregate` options because of its limitaion of internal mechanism.\n\n## ChangeLog\n\nSee [CHANGELOG.md](CHANGELOG.md) for details.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new [Pull Request](../../pull/new/master)\n\n## Copyright\n\nCopyright (c) 2014 Naotoshi Seo. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluent-plugins-nursery%2Ffluent-plugin-elapsed-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluent-plugins-nursery%2Ffluent-plugin-elapsed-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluent-plugins-nursery%2Ffluent-plugin-elapsed-time/lists"}