logstash-output-scalyr 0.1.8 → 0.1.9

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67c7ee2ee65ab144dc7eebd1fa6a553ef1fb4d6c89558c023f334d8a728e5f2e
4
- data.tar.gz: 48027aa03b3d0d5ccf51db08e0b2f2bed125c2d571a07bd64dac2e853485cd48
3
+ metadata.gz: 542910023101687e2d9bce1d355f3353a9f9eab2dbc8190ae47c948b17b1db58
4
+ data.tar.gz: 478acd0ae33f8b102da138ecfebe3a1ecab68f7d4b2d3779695812184e7a5618
5
5
  SHA512:
6
- metadata.gz: 0cb175245132cb45a1e243383b544b9ee1483084b10eac4a4e44ce7fc1e149fb7bba083a3e6df399e090a25693d4637117abf0f5f765a63fad3cb8c293337b4d
7
- data.tar.gz: bb8fc93d41d6a05f517c87bbc1e2e86ec4ceb939f1d08b017434a43057e54aa2919f6e052efe435c7aacb1f9ccc6e61a9ee05409fcebccc5ac44a07d72d556b6
6
+ metadata.gz: 60777fcaababf8cc08559a582380fba24fa5a506a4751a0bb63e2a46957723dd4cbaf8c232ccb0ccfa91694c9723c24c054e708e27f59476c4734b58e1cd8269
7
+ data.tar.gz: f0f19ab3392f2d7a8f463b6c74b6e204024701502a86640bbfa3a207554ff69a25f53e36075aa14f65561f3187e2c24b0ae1db2f6ec7ac0630e3c83232a12ce4
data/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
1
  # Beta
2
+
3
+ ## 0.1.9
4
+
5
+ - Add support for logging status messages with metrics to stdout in addition to sending this
6
+ data to Scalyr by setting ``log_status_messages_to_stdout`` config option. By default those
7
+ lines are logged under INFO log level and you may need to enable / configure pluggin logging
8
+ as per https://www.elastic.co/guide/en/logstash/current/logging.html.
9
+ - Update metric reporting code to round float values to 4 decimal points so we also record sub
10
+ millisecond values for per event metrics.
11
+
2
12
  ## 0.1.8
3
13
 
4
14
  - Add additional metrics.
data/README.md CHANGED
@@ -10,7 +10,7 @@ You can view documentation for this plugin [on the Scalyr website](https://app.s
10
10
  # Quick start
11
11
 
12
12
  1. Build the gem, run `gem build logstash-output-scalyr.gemspec`
13
- 2. Install the gem into a Logstash installation, run `/usr/share/logstash/bin/logstash-plugin install logstash-output-scalyr-0.1.8.gem` or follow the latest official instructions on working with plugins from Logstash.
13
+ 2. Install the gem into a Logstash installation, run `/usr/share/logstash/bin/logstash-plugin install logstash-output-scalyr-0.1.9.gem` or follow the latest official instructions on working with plugins from Logstash.
14
14
  3. Configure the output plugin (e.g. add it to a pipeline .conf)
15
15
  4. Restart Logstash
16
16
 
@@ -378,6 +378,7 @@ The changelog should also be updated with the latest version and changes of note
378
378
  To deploy the current code on your machine run these commands:
379
379
 
380
380
  ```
381
+ rm -rf vendor/
381
382
  bundle check --path vendor/bundle || bundle install --deployment
382
383
  curl -u RUBY_USER:RUBY_PASSWORD https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
383
384
  chmod 0600 ~/.gem/credentials
@@ -109,6 +109,10 @@ class LogStash::Outputs::Scalyr < LogStash::Outputs::Base
109
109
  # minutes.
110
110
  config :status_report_interval, :validate => :number, :default => 300
111
111
 
112
+ # Set to true to also log status messages with various metrics to stdout in addition to sending
113
+ # this data to Scalyr
114
+ config :log_status_messages_to_stdout, :validate => :boolean, :default => false
115
+
112
116
  # Whether or not to count status event uploads in the statistics such as request latency etc.
113
117
  config :record_stats_for_status, :validate => :boolean, :default => false
114
118
 
@@ -690,14 +694,14 @@ class LogStash::Outputs::Scalyr < LogStash::Outputs::Base
690
694
  msg = 'plugin_status: '
691
695
  cnt = 0
692
696
  @client_session.get_stats.each do |k, v|
693
- val = v.instance_of?(Float) ? sprintf("%.3f", v) : v
697
+ val = v.instance_of?(Float) ? sprintf("%.4f", v) : v
694
698
  val = val.nil? ? 0 : val
695
699
  msg << ' ' if cnt > 0
696
700
  msg << "#{k.to_s}=#{val}"
697
701
  cnt += 1
698
702
  end
699
703
  get_stats.each do |k, v|
700
- val = v.instance_of?(Float) ? sprintf("%.3f", v) : v
704
+ val = v.instance_of?(Float) ? sprintf("%.4f", v) : v
701
705
  val = val.nil? ? 0 : val
702
706
  msg << ' ' if cnt > 0
703
707
  msg << "#{k.to_s}=#{val}"
@@ -710,6 +714,10 @@ class LogStash::Outputs::Scalyr < LogStash::Outputs::Base
710
714
  multi_event_request = create_multi_event_request([status_event], nil, nil)
711
715
  @client_session.post_add_events(multi_event_request[:body], true, 0)
712
716
  @last_status_transmit_time = Time.now()
717
+
718
+ if @log_status_messages_to_stdout
719
+ @logger.info msg
720
+ end
713
721
  status_event
714
722
  end
715
723
 
@@ -275,7 +275,7 @@ class ClientSession
275
275
 
276
276
  post = Net::HTTP::Post.new uri_path
277
277
  post.add_field('Content-Type', 'application/json')
278
- version = 'output-logstash-scalyr 0.1.8'
278
+ version = 'output-logstash-scalyr 0.1.9'
279
279
  post.add_field('User-Agent', version + ';' + RUBY_VERSION + ';' + RUBY_PLATFORM)
280
280
 
281
281
  if not encoding.nil?
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-scalyr'
3
- s.version = '0.1.8'
3
+ s.version = '0.1.9'
4
4
  s.licenses = ['Apache-2.0']
5
5
  s.summary = "Scalyr output plugin for Logstash"
6
6
  s.description = "Sends log data collected by Logstash to Scalyr (https://www.scalyr.com)"
@@ -88,7 +88,7 @@ describe LogStash::Outputs::Scalyr do
88
88
  plugin1.instance_variable_set(:@multi_receive_statistics, {:total_multi_receive_secs => 0})
89
89
 
90
90
  status_event = plugin1.send_status
91
- expect(status_event[:attrs]["message"]).to eq("plugin_status: total_requests_sent=20 total_requests_failed=10 total_request_bytes_sent=100 total_compressed_request_bytes_sent=50 total_response_bytes_received=100 total_request_latency_secs=100 total_serialization_duration_secs=100.500 total_compression_duration_secs=10.200 compression_type=deflate compression_level=9 total_multi_receive_secs=0 multi_receive_duration_p50=1 multi_receive_duration_p90=1 multi_receive_duration_p99=1 multi_receive_event_count_p50=0 multi_receive_event_count_p90=0 multi_receive_event_count_p99=0 event_attributes_count_p50=0 event_attributes_count_p90=0 event_attributes_count_p99=0")
91
+ expect(status_event[:attrs]["message"]).to eq("plugin_status: total_requests_sent=20 total_requests_failed=10 total_request_bytes_sent=100 total_compressed_request_bytes_sent=50 total_response_bytes_received=100 total_request_latency_secs=100 total_serialization_duration_secs=100.5000 total_compression_duration_secs=10.2000 compression_type=deflate compression_level=9 total_multi_receive_secs=0 multi_receive_duration_p50=1 multi_receive_duration_p90=1 multi_receive_duration_p99=1 multi_receive_event_count_p50=0 multi_receive_event_count_p90=0 multi_receive_event_count_p99=0 event_attributes_count_p50=0 event_attributes_count_p90=0 event_attributes_count_p99=0")
92
92
  end
93
93
 
94
94
  it "returns and sends correct status event on send_stats on initial and subsequent send" do
@@ -115,7 +115,7 @@ describe LogStash::Outputs::Scalyr do
115
115
 
116
116
  plugin.instance_variable_set(:@multi_receive_statistics, {:total_multi_receive_secs => 0})
117
117
  status_event = plugin.send_status
118
- expect(status_event[:attrs]["message"]).to eq("plugin_status: total_requests_sent=20 total_requests_failed=10 total_request_bytes_sent=100 total_compressed_request_bytes_sent=50 total_response_bytes_received=100 total_request_latency_secs=100 total_serialization_duration_secs=100.500 total_compression_duration_secs=10.200 compression_type=deflate compression_level=9 total_multi_receive_secs=0 multi_receive_duration_p50=10 multi_receive_duration_p90=18 multi_receive_duration_p99=19 multi_receive_event_count_p50=0 multi_receive_event_count_p90=0 multi_receive_event_count_p99=0 event_attributes_count_p50=0 event_attributes_count_p90=0 event_attributes_count_p99=0 flatten_values_duration_secs_p50=0 flatten_values_duration_secs_p90=0 flatten_values_duration_secs_p99=0")
118
+ expect(status_event[:attrs]["message"]).to eq("plugin_status: total_requests_sent=20 total_requests_failed=10 total_request_bytes_sent=100 total_compressed_request_bytes_sent=50 total_response_bytes_received=100 total_request_latency_secs=100 total_serialization_duration_secs=100.5000 total_compression_duration_secs=10.2000 compression_type=deflate compression_level=9 total_multi_receive_secs=0 multi_receive_duration_p50=10 multi_receive_duration_p90=18 multi_receive_duration_p99=19 multi_receive_event_count_p50=0 multi_receive_event_count_p90=0 multi_receive_event_count_p99=0 event_attributes_count_p50=0 event_attributes_count_p90=0 event_attributes_count_p99=0 flatten_values_duration_secs_p50=0 flatten_values_duration_secs_p90=0 flatten_values_duration_secs_p99=0")
119
119
  end
120
120
 
121
121
  it "send_stats is called when events list is empty, but otherwise noop" do
@@ -1,6 +1,6 @@
1
1
  #!/bin/sh
2
2
  'exec' "jruby" '-x' "$0" "$@"
3
- #!/home/kami/.rvm/rubies/jruby-9.2.9.0/bin/jruby
3
+ #!/Users/yans/.rvm/rubies/jruby-9.2.9.0/bin/jruby
4
4
  #
5
5
  # This file was generated by RubyGems.
6
6
  #
@@ -1,6 +1,6 @@
1
1
  #!/bin/sh
2
2
  'exec' "jruby" '-x' "$0" "$@"
3
- #!/home/kami/.rvm/rubies/jruby-9.2.9.0/bin/jruby
3
+ #!/Users/yans/.rvm/rubies/jruby-9.2.9.0/bin/jruby
4
4
  #
5
5
  # This file was generated by RubyGems.
6
6
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-scalyr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edward Chee