Commit graph

211 commits

Author SHA1 Message Date
Armin
753c798ee2 #6696 validate evaluation result
Fixes #7411
2017-06-13 10:17:19 -07:00
Andrew Cholakian
12b1ddbebf Make test for pipeline flushing more resilient.
Instead of depending on the now deprecated multiline filter we use a
dummy filter that just emits events. This simplifies the test and
dramatically reduces timing issues.

I also increased the max-wait for the timer just in case

Fixes #7024

Fixes #7131
2017-05-22 20:12:34 +00:00
Joao Duarte
8f2e25904f backport agent_spec fixes to 5.x
Fixes #7146
2017-05-18 15:13:07 +00:00
Pier-Hugues Pellerin
34f486d6d8 consistency in naming
Fixes #7103
2017-05-16 14:20:34 +00:00
Pier-Hugues Pellerin
8707953d2c Make the test for the write WrappedWriteClient more robust
Instead of using sleep we start two threads and we join them to do the
expectation.

Fixes: #7031 #7032

Fixes #7103
2017-05-16 14:20:34 +00:00
Jordan Sissel
754773b328 Skip a flakey test failing since November 2016
The failure:

    Failures:

      1) LogStash::Pipeline defaulting the pipeline workers based on thread safety when there are threadsafe filters only starts multiple filter threads
         Failure/Error: expect(pipeline.worker_threads.size).to eq(worker_thread_count)

           expected: 5
                got: 8

Related issues: #6855, #6245, #6355

Fixes #7071
2017-05-11 09:45:19 +00:00
Pier-Hugues Pellerin
8e099d49bd testing logic
Fixes #6943
2017-04-24 17:01:56 +00:00
Pier-Hugues Pellerin
111c95c254 Allow Finite pipeline to shutdown internal pipelines
With the creation of the x-pack we have added our first internal
pipeline, but if you were running the monitoring pipeline with a
finite pipeline (LIKE generator count => X) when the finite has
completed processing all the events logstash would refuse to stop.

This PR fixes the problem by adding a new pipeline settings called
system in the shutdown loop we will check if all the user defined
pipeline are completed if its the case we will shutdown any internal
pipeline and logtash will stop gracefully.

Fixes #6943
2017-04-24 17:01:56 +00:00
Colin Surprenant
c29d00c034 add acked_queue concurrent stress spec, fixes #6930
introduce rake test:core-fast and rake test:core-slow

remove custom rspec config
2017-04-21 14:42:56 -06:00
Pier-Hugues Pellerin
42166f3d52 Make the load_average linux more robust by allow to inject the content of the load_average file
Fixes: #6867

Fixes #6886
2017-04-19 19:45:29 +00:00
Pier-Hugues Pellerin
a159ac2db4 Replace the internal list of listeners with a set
Because we sync listeners with emitters when adding or creating hook
this could lead to duplicates of listeners, this PR fixes the problem by using a set
instead of a list. Making sure we can only have one instance of a specific
listener at any time.

Fixes #6916
2017-04-13 20:09:45 +00:00
Pier-Hugues Pellerin
2dd135a162
ExecutionContext for the plugins
This PR add the initial building block to pass some `ExecutionContext`
from the pipeline to the plugin, currently we only pass the `pipeline_id`.

We use the accessor `execution_context=` to set the context, in a future
refactor we will pass the object to the constructor.

Fixes #6890
2017-04-07 13:13:35 -04:00
Josh Soref
df57e410cc Spelling fixes (#6806)
Spelling fixes across the board.
2017-04-04 12:07:16 -07:00
Andrew Cholakian
80b8086ad8 Input#clone should also clone that input's codec
Some codecs are context-specific and not threadsafe. If, for instance,
you want to use `generator { threads => 3 }` you will run into buggy
behavior with the line and multiline codecs which are not threadsafe.

This patch is a quick workaround for this behavior. This does not fix
this issue for inputs that do their own multithreading. Those inputs
should handle codec cloning / lifecycle internally according to their
specific requirements.

Fixes #6865
2017-03-31 17:26:05 -04:00
Pier-Hugues Pellerin
cf57bcb99e Adding tests for the heap calculation, also changed the visibility
In retrospect, it just easier to expose the methods in the jvm spec
monitoring to be able to test them in isolation.

Fixes #6827
2017-03-26 20:43:13 -04:00
Andrew Cholakian
a7bf577bfe Move input metrics to be nested under 'events' for consistency
Filters/outputs nest their 'out' metric under 'events'.
Inputs should not be different.

Fixes #6835
2017-03-23 19:32:58 -04:00
Pier-Hugues Pellerin
584a3860a0 Implements #has_metric?(*path)
Add a new method that uses the `fast_lookup` has to find if a specific
metric exist instead of relying on exceptions.

Usage:

```ruby
metric_store.has_metric?(:node, :sashimi, :pipelines, :pipeline01, :plugins, :"logstash-output-elasticsearch", :event_in) # true
metric_store.has_metric?(:node, :sashimi, :pipelines, :pipeline01, :plugins, :"logstash-output-elasticsearch", :do_not_exist) # false
```
Fixes: #6533

Fixes #6759
2017-03-14 20:32:01 -04:00
Pier-Hugues Pellerin
2fedad3c7d Record the events.in related statistic in the right place
This PR changes where the `events.in` are calculated, previously the
values were calculated in the `ReadClient` which was fine before the
addition of the PQ, but this make the stats not accurate when the PQ was
enabled and the producer are a lot faster than the consumer.

These commits change the collection of the metric inside an
instrumented `WriteClient` so both implementation of the client queues will use
the same code.

This also make possible to record `events.out` for every inputs and the
time waiting to push to the queue.

The API is now exposing theses values for each plugins, the events level
and and the pipeline.

Using a pipeline with a sleep filter and PQ we will see this kind of
response from the API.

```json
{
  "duration_in_millis": 438624,
  "in": 3011436,
  "filtered": 2189,
  "out": 2189,
  "queue_push_duration_in_millis": 49845
}
```

Fixes: #6512

Fixes #6532
2017-03-02 16:31:50 -05:00
Tal Levy
1643cfefaf remove old legacy logstash-core-event (#6783)
and migrate spec tests to core
Conflicts:
	logstash-core-event/lib/logstash-core-event/version.rb
	versions.yml
2017-03-02 10:56:43 -08:00
Tal Levy
7c75b59814 migrate logstash-core-event-java to logstash-core (#6760)
Conflicts:
	logstash-core-event-java/lib/logstash-core-event-java/version.rb
	versions.yml
2017-03-01 15:37:41 -08:00
Colin Surprenant
154ce65c3a add queue drain option support
wip queue drain option

metrics on empty batches

reenabled spec

cosmetic fixes

stats collection, mutex, specs, empty batch handling

start_metrics
2017-03-01 14:14:36 -05:00
Suyog Rao
8a8f04ab1d Add tests for deep nested env variables 2017-02-21 14:16:24 -08:00
Andrew Cholakian
9a130f2de1 Setting --path.data on CLI should also change path.queue
This change was harder than it first appeared! Due to the complicated
interactions between our Setting class and our monkey-patched Clamp
classes this required adding some new hooks into various places to
properly intercept the settings at the right point and set this
dynamically.

Crucially, this only changes path.queue when the user has *not*
overriden it explicitly in the settings.yml file.

Fixes #6378 and #6387

Fixes #6731
2017-02-17 16:43:07 -05:00
Colin Surprenant
46e1068af6 support exclusive locking of PQ dir access
fix agent and pipeline and specs for queue exclusive access

added comments and swapped all sleep 0.01 to 0.1

revert explicit pipeline close in specs using sample helper

fix multiple pipelines specs

use BasePipeline for config validation which does not instantiate a new queue

review modifications

improve queue exception message
2017-02-10 17:38:03 -05:00
Joao Duarte
acdd400e97 add setting class that coerces value to array
Fixes #6630
2017-02-07 06:42:57 -05:00
Joao Duarte
ffa9c710a2 make SafeURI class clone deeper
Fixes #6645
2017-02-06 17:29:26 -05:00
Colin Surprenant
eba90f911d refactor agent pipeline reloading to avoid double live pipelines with same settings
extracted BasePipeline class to support complete config validation

minor review changes

added comment
2017-02-03 18:17:47 -05:00
Joao Duarte
d6d0c672ae ensure pipeline.id is correctly propagated
Fixes #6530
2017-01-26 11:15:36 -05:00
Joao Duarte
b4c7c97452 include pipeline id in queue path
create queue sub directory based on pipeline id

Fixes #6540
2017-01-26 10:27:04 -05:00
Pier-Hugues Pellerin
f2486324af missing specs for the refactoring
Fixes #6499
2017-01-25 08:55:47 -05:00
Joao Duarte
d73a2a90d4 use running instead of read in some agent specs
the pipeline class two state predicates: ready? and running?

ready? becomes true after `start_workers` terminates (succesfuly or not)
running? becomes true before calling `start_flusher`, which means that
`start_workers` is guaranteed to have terminated successfuly

Whenever possible, we should use `running?` instead of `ready?` in the
spec setup blocks. The only place where this may be bad is when the
pipeline execution is short lived (e.g. generator w/small count) and the
spec may never observe pipeline.running? == true

Fixes #6574
2017-01-24 05:29:35 -05:00
Pier-Hugues Pellerin
8e57042e25 Extract the creation of the queue into a factory
I've move the initialization code into a factory for future work on the
pipeline.

Fixes #6498
2017-01-16 12:28:37 -05:00
Suyog Rao
c9391e964e Renamed cgroups metric to number_of_elapsed_periods
Renamed number_of_periods to number_of_elapsed_periods to be consistent with ES.

Fixes #6536
2017-01-16 12:20:16 -05:00
Colin Surprenant
8c4d8b83fc avoid resetting inexisting tags field back to empty array plus specs
Fixes #6477
2017-01-03 22:31:31 -05:00
Pier-Hugues Pellerin
94a67cb4e0 Record the execution time for each output in the pipeline
Record the wall clock time for each output a new `duration_in_millis`
key will now be available for each output in the api located at http://localhost:9600/_node/stats

This commit also change some expectations in the output_delegator_spec
that were not working as intended with the `have_received` matcher.

Fixes #6458
2016-12-29 12:51:41 -05:00
Pier-Hugues Pellerin
7715fabdc2 Initialize the metric values in the batch to the correct type
When we were initilizing the `duration_in_millis` in the the batch we
were using a `Gauge` instead of a counter, since all the object have the
same signature when the were actually recording the time the value was
replaced instead of incremented.

Fixes #6465
2016-12-29 11:12:32 -05:00
Pier-Hugues Pellerin
8cd4ae5319 Add a test to make sure the Collector#snapshot_metric returns a cloned metric store.
Fixes #6456
2016-12-29 08:59:53 -05:00
Pier-Hugues Pellerin
cc5b283035 Do not log a warning if a plugin is not from in #print_notice_version
When a plugin is loaded using the `plugins.path` option or is from a
universal plugin there no gemspec can be found for the specific plugin.

We should not print any warning on that case.

Fixes: #6444

Fixes #6448
2016-12-21 09:44:37 -05:00
Pier-Hugues Pellerin
ad763c81a3 Initialize with default values global events and pipeline events related metric
The metric store has no concept is a metric need to exist so as a rule
of thumb we need to defined them with 0 values and send them to the
store when we initialize something.

This PR make sure the batch object is recording the right default values

Fixes: #6449

Fixes #6450
2016-12-21 09:43:29 -05:00
Joao Duarte
90c364e903 ensure metric collection is disabled when metric.collect is false
Fixes #6445
2016-12-21 07:20:23 -05:00
Joao Duarte
a9e474f0e1 add tests for webserver metric
Fixes #6385
2016-12-19 12:43:25 -05:00
Pier-Hugues Pellerin
f0ab5fd955 rename cgroup usage to usage_nanos to align with ES' api
Fixes #6428
2016-12-16 10:19:59 -05:00
Pier-Hugues Pellerin
a611ebf64f Add cgroup information to the api
When logstash is run under a linux container we will gather statistic about the cgroup and the
cpu usage. This information will should in the /_node/stats api and the result will look like this:

```
  "os" : {
    "cgroup" : {
      "cpuacct" : {
        "usage" : 789470280230,
        "control_group" : "/user.slice/user-1000.slice"
      },
      "cpu" : {
        "cfs_quota_micros" : -1,
        "control_group" : "/user.slice/user-1000.slice",
        "stat" : {
          "number_of_times_throttled" : 0,
          "time_throttled_nanos" : 0,
          "number_of_periods" : 0
        },
        "cfs_period_micros" : 100000
      }
    }
  }
```

Fixes: #6252

Fixes #6357
2016-12-15 15:46:38 -05:00
Suyog Rao
678ebd1efc Add reload stats at the instance level
Reload stats are currently reported at the pipeline level. The instance
level aggregates these stats across the pipelines

Fixes #6350

Fixes #6367
2016-12-13 00:59:24 -05:00
Pier-Hugues Pellerin
9bd6a2b6a9 Change the assertions in the config reloading spec
The assertions was using dummy outputs and kept received events into an
array in memory, but the test actually only needed to match the number
of events it received, this PR add a DroppingDummyOutput that wont
retain the events in memory.

The previous implementation was causing a OOM issue when running the
test on a very fast machine.

Fixes: #6335

Fixes #6346
2016-12-02 13:24:08 -05:00
Guy Boertje
23df3d1506 Allow for exception instances to get serialized in JSON logging 2016-11-30 15:45:45 -08:00
Joao Duarte
265d45f3ce rename queueMaxSizeInBytes to queueMaxBytes and currentSize to currentByteSize
Fixes #6297
2016-11-29 05:10:43 -05:00
Joao Duarte
ce608b0921 add ruby wiring to the queue.max_size setting
Fixes #6297
2016-11-29 05:10:43 -05:00
Colin Surprenant
38fc84b367 add support for queue.checkpoint.{acks|writes} settings
add queue.max_acked_checkpoint and queue.checkpoint_rate settings

now using checkpoint.max_acks, checkpoint.max_writes and checkpoint.max_interval

rename options

wip rework checkpointing

refactored full acked pages handling on acking and recovery

correclty close queue

proper queue open/recovery

checkpoint dump utility

checkpoint on writes

removed debug code and added missing newline

added better comment on contiguous checkpoints

fix spec for new pipeline setting
2016-11-22 15:55:32 -05:00
Andrew Cholakian
f66145a596 Fix filter 'id' naming to be consistent with inputs / outputs
The filters were the only category prefixing IDs with their plugin names

Fixes #6259
2016-11-22 14:42:44 -05:00