Commit graph

11 commits

Author SHA1 Message Date
Pier-Hugues Pellerin
643568038f 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
Pier-Hugues Pellerin
b1c62da570 rescope the mock classes
Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
202221edc1 fixing the tests
Fixes #6109
2016-11-11 09:43:44 -05:00
Andrew Cholakian
efefe7f32a Add Persistent UUID for Agent
This adds two new fields 'id', and 'name' to the base metadata for API requests.
These fields are now returned at all API endpoints by default.

The `id` field is the persisted UUID, the name field is the custom name
the user has passed in (defaulted to the hostname).

I renamed `node_uuid` and `node_name` to just `id` and `name` to be
inline with Elasticsearch.

This also fixed a broken test double in `webserver_spec.rb` that was
using doubles across threads which created hidden errors.

Fixes #6224
2016-11-09 07:40:47 -05:00
Colin Surprenant
3fe1bfc935 fix for cancelled events issue #6055
update comments

preserve abort_on_exception state
2016-10-14 19:43:22 +02:00
Pier-Hugues Pellerin
e6b744c80a Return 404 on non existant resources
This PR introduce a changes to make sure the API endpoint correctly
return 404 in every case. To make it work it uses an exception that get
pickup up in the base class by the `error` handler.

Using the exception template allow the code to be dry and make sure all
other errors can be returned with the same format.

Example or a 404.
```json
{
"error": { "message": "Not Found"},
"path": "/this-should-not-exist"
"status": 404
}
```

The code will also set the content-type and the right error code in the
header.

Fixes: #5874, #5622

Fixes #5897
2016-09-13 14:15:43 -04:00
Pier-Hugues Pellerin
81187da733 Silence PUMA errors when an exception occur in logstash core
When Logstash encounter an exception Puma was getting really noisy about
the file descriptor it used. Its because Puma has an infinite loop into
his reactor and when logstash is dying from the exception the FD get
removed under the puma threads.

Puma is using the constants `STDERR` and `STDOUT` to give information
about the errors, there is no easy way to provide Puma with a custom IO.
This PR hacks the Puma name to redefine both constants and send the
information to the logger using the `debug` level.

Also when we start the server we can pass a custom Puma::Events instance
to record some of the errors happening in the internal threads, this PR
also make sure we send all theses message to the configured logger.

Fixes: #5822

Fixes #5869
2016-09-08 09:39:45 -04:00
Pier-Hugues Pellerin
0105547f57 Add more testing around the NullMetric implementation
The current test where only checking if the `NullMetric` Interface was
matching the original metric interface, this PR add more test around the
actual methods and fix an issue with `decrement` using too much
arguments in the context of a namespaced metric.

The test were also move into a shared example to be used in both the `NullMetric`
and the `NamedspacedMetric`.

Also the NullMetric class will no use the same validation for keys as the namespaced class and will
reject empty or nil keys.

Fixes #5545
2016-06-27 11:27:20 -04:00
Pier-Hugues Pellerin
1502fc9348 Fix a thread safety issue with the agent.
Make sure we pass the metric when we create a pipeline this make sure
the metric is correctly visible in the pipeline and remove the need to
lock the variables.

Make the expectation more robust in the metric reload scenario.

Fixes #5400 for the greater good.

Fixes #5446
2016-06-10 09:51:37 -04:00
Pier-Hugues Pellerin
62c609f135 Clear the collector when logstash reload configuration
When logstash reload a configuration the collector should remove all the
collected metrics from the store since it wont make any sense with a new
configuration. You should have the same behavior as when you restart
logstash.

Fixes #4801
2016-04-18 20:03:28 +00:00
Pier-Hugues Pellerin
a04da0f76d Collecting Logstash metrics at runtime
This commit introduce the collection of the main metrics inside the
logstash pipeline and records it to the metric store. This code is also
the initial stone to define an internal metric api.

Collected metrics from the pipeline and system will be exposed by the web
api.

This work was done in collaboration by @ph and @purbon, commits were
squashed to simplify the merging process.

Fixes #4653
2016-02-12 19:00:09 +00:00