fluent-plugin-mongo-slow-query 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzJhM2VkMGUzMTA2ZTczMTg1ZjU1ZDVmNjdjYTI2MjUwOWI5OTBiOA==
4
+ MzU3MTIyMzEzNTlkMDY5Nzg4OWE4NGUxYzNjYTI5ZGQxZjY0NDFiOQ==
5
5
  data.tar.gz: !binary |-
6
- ZjQxMDYwOWYyMzYzNWRiYjZhZjc4MjZlOTQyNTU3YWQ1YWVjNjlmZg==
6
+ YjhmZWFlMmE3YTA5MjY3NGY5M2QxMzgwYWZiZGY4NTg4MDViYjE3YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWQ4M2FmNDFmM2RhZTQ5Y2JmYTRlZWRiMmQ1NDU2OTg3ZDBlZWRjZGI5MGI1
10
- ZjViZDlmNjcwZWM0Y2NkNDk1MDAxMGM1NTIxZDEyMjI0MWY4ZTU4ZWRhNzIw
11
- YjIxN2Q4NDFjMGE3ZjFiOWZmODkyYTgwOGRjMDQ0ZTM3MDg5OWY=
9
+ NDJkOTE2ODVmNGUyNGFjMzg5N2YxYjQ2NmMxYjJiNjg0OGYxOTk4ZGQ0YTg1
10
+ YmNiMTZmYzE1MzIzMDJkYjg0MTQwZTJiOGM1ZDExOTA0MWVkOWVkOTJjMmU5
11
+ MjJlNTI5ZDlhYzcwYjliMTdiNjZmZWIyNTkwMGYzMDQwMzYzYjc=
12
12
  data.tar.gz: !binary |-
13
- NDRmMTdiYWRhODE1ZGM4NjZmMDZiOTE0YWQwMmQwMWMwYjNiOTBiZTBkNGMx
14
- MTRjZGQ5NzlmNGVhNDU4YzRmNTFkZWRjZjkyMTMxZWJhNjExZmU4MmYwZGYw
15
- OGI2YjQyMmNhYzNhMDcxYjdiNzk0ZGUzZWM4NGE4ZWE4ZmUwMzU=
13
+ NTNkZjVhOWU2NGJjMDNlM2UzZGU0OGY2OGIyNzdhMTE4YmQyZmI2MzViMWZm
14
+ MjYzNGJiODg2NzI1NmYxZWE2ZjVjNDVmNTNkOWM2NDYyZGNhMDg0MDY2Mzdm
15
+ NTI0ZDJlODlkNjFjZGIzNmU4MmU2MjQyYmQ3MzkxMjNiY2IzNDI=
@@ -11,7 +11,7 @@ module Fluent
11
11
  # If the configuration is invalid, raise Fluent::ConfigError.
12
12
  def configure(conf)
13
13
  # load log format for MongoDB
14
- conf["format"] = '/^(?<time>.*?)(?:\s+\w\s\w+\s*)? \[conn\d+\] (?<op>\w+) (?<ns>\S+) (?<detail>(?:(?:query: (?<query>\{.+\}) update: \{.*\})|(?:query: (?<query>\{.*\}) planSummary: \w+(?: \{.*\})?)|(?:query: (?<query>\{.*\}))|(?:command: \{.*\}))) (?<stat>.*) (?<ms>\d+)ms$/'
14
+ conf["format"] = '/^(?<time>.*?)(?:\s+\w\s\w+\s*)? \[conn\d+\] (?<op>\w+) (?<ns>\S+) (?<detail>query: (?<query>\{(?:\g<query>|[^\{\}])*\})(?: update: (?<update>\{(?:\g<update>|[^\{\}])*\}))?|command:.*?(?<command>\{(?:\g<command>|[^\{\}])*\})|.*?) (?<stat>.*?)(?: locks:\{.*\})? (?<ms>\d+)ms$/'
15
15
 
16
16
  # not set "time_format"
17
17
  # default use Ruby's DateTime.parse() to pase time
@@ -37,7 +37,11 @@ module Fluent
37
37
  line.chomp! # remove \n
38
38
  time, record = parse_line(line)
39
39
  if time && record
40
- record["query"] = get_query_prototype(record["query"]) if record["query"]
40
+ if record.has_key?("query")
41
+ record["query"] = get_query_prototype(record["query"])
42
+ else
43
+ record["query"] = ""
44
+ end
41
45
  record["ms"] = record["ms"].to_i
42
46
  record["ts"] = time
43
47
 
@@ -115,7 +119,7 @@ module Fluent
115
119
  ns_array += extract_query_prototype(val, ns)
116
120
  elsif val.class == Array
117
121
  val.each do |item|
118
- if item.class == Hash # e.g. $eq $gt $gte $lt $lte $ne $in $nin
122
+ if item.class == Hash # e.g. $eq $gt $gte $lt $lte $ne $in $nin
119
123
  ns_array += extract_query_prototype(item, ns)
120
124
  else # e.g. $and $or $nor
121
125
  ns_array << ns
metadata CHANGED
@@ -1,17 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-mongo-slow-query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Caosiyang
7
+ - Siyang Cao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-27 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Fluent plugin for MongoDB slow operation. It's helpful to statistics
14
- the slow queries and build indexes
13
+ description: Fluent input plugin for MongoDB to collect slow operation log
15
14
  email: csy3228@gmail.com
16
15
  executables: []
17
16
  extensions: []
@@ -41,6 +40,5 @@ rubyforge_project:
41
40
  rubygems_version: 2.4.5
42
41
  signing_key:
43
42
  specification_version: 4
44
- summary: Fluent plugin for MongoDB slow operation. It's helpful to statistics the
45
- slow queries and build indexes
43
+ summary: Fluent input plugin for MongoDB to collect slow operation log
46
44
  test_files: []