Skip to content

(PE-2675) Change the order that filters are applied for events#820

Closed
cprice404 wants to merge 4 commits intopuppetlabs:1.5.3.xfrom
cprice404:bug/1.5.x/PE-2675-change-filter-order-for-distinct-resource-events
Closed

(PE-2675) Change the order that filters are applied for events#820
cprice404 wants to merge 4 commits intopuppetlabs:1.5.3.xfrom
cprice404:bug/1.5.x/PE-2675-change-filter-order-for-distinct-resource-events

Conversation

@cprice404
Copy link

When using the `distinct-resources` flag of an event query, the
previous behavior was that we would do the filtering of the events
*before* we would eliminate duplicate resources.  This was not
the expected behavior in many cases in the UI; for example,
when filtering events based on event status, the desired behavior
was to find all of the most recent events for each resource *first*,
and then apply the filter to that set of resources.  If we did the
status filtering first, then we might end up in a state where we
found the most recent 'failed' event and showed it in the UI even
if there were 'success' events on that resource afterwards.

This commit changes the order that the filtering happens in.  We
now do the `distinct` portion of the query before we do the filtering.

However, in order to achieve reasonable performance, we need to
at least include timestamp filtering in the `distinct` query; otherwise
that portion of the query has to work against the entire table,
and becomes prohibitively expensive.

Since the existing timestamp filtering can be nested arbitrarily
inside of the query (inside of boolean logic, etc.), it was not
going to be possible to re-use that to handle the timestamp filtering
for the `distinct` part of the query; thus, we had to introduce
two new query parameters to go along with `distinct-resources`:
`distinct-start-time` and `distinct-end-time`.  These are now
required when using `distinct-resources`.

This functionality is fairly specific to PE and should probably
be separated into a PE-specific query endpoint in the future.

kbarber and others added 4 commits January 30, 2014 11:19
This patch fixes an rspec failure we were having on the terminus due to the
recent bump from mocha from 0.14.1 to 1.0.0.

Previously mocha seems to have been ignoring private method calls for whatever
reason. With the new version of mocha it is throwing exceptions (as it rightly
should).

This patch removes the use of the `private` declaration and converts all of
these methods to be document `@api private` in YARD instead migrating a
language enforcement to a documentation enforcement instead.

As an aside I noticed that char_encoding.rb had a 3 space indent convention,
this has been converted to 2 space as per our standard.

Signed-off-by: Ken Barber <ken@bob.sh>

Conflicts:
	Gemfile
When using the `distinct-resources` flag of an event query, the
previous behavior was that we would do the filtering of the events
*before* we would eliminate duplicate resources.  This was not
the expected behavior in many cases in the UI; for example,
when filtering events based on event status, the desired behavior
was to find all of the most recent events for each resource *first*,
and then apply the filter to that set of resources.  If we did the
status filtering first, then we might end up in a state where we
found the most recent 'failed' event and showed it in the UI even
if there were 'success' events on that resource afterwards.

This commit changes the order that the filtering happens in.  We
now do the `distinct` portion of the query before we do the filtering.

However, in order to achieve reasonable performance, we need to
at least include timestamp filtering in the `distinct` query; otherwise
that portion of the query has to work against the entire table,
and becomes prohibitively expensive.

Since the existing timestamp filtering can be nested arbitrarily
inside of the query (inside of boolean logic, etc.), it was not
going to be possible to re-use that to handle the timestamp filtering
for the `distinct` part of the query; thus, we had to introduce
two new query parameters to go along with `distinct-resources`:
`distinct-start-time` and `distinct-end-time`.  These are now
required when using `distinct-resources`.

This functionality is fairly specific to PE and should probably
be separated into a PE-specific query endpoint in the future.
@puppetlabs-jenkins
Copy link
Contributor

🔴 Test failed.
Refer to this link for build results: https://jenkins.puppetlabs.com/job/PuppetDB%20Acceptance%20-%20Pull%20Requests/181/

@puppetlabs-jenkins
Copy link
Contributor

🔴 Test failed.
Refer to this link for build results: https://jenkins.puppetlabs.com/job/PuppetDB%20Acceptance%20-%20Pull%20Requests/182/

@kbarber
Copy link
Contributor

kbarber commented Jan 30, 2014

@puppetlabs-jenkins retest this please.

@puppetlabs-jenkins
Copy link
Contributor

🔴 Test failed.
Refer to this link for build results: https://jenkins.puppetlabs.com/job/PuppetDB%20Acceptance%20-%20Pull%20Requests/183/

@cprice404 cprice404 closed this Jan 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants