Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LastOk to Event (#1034) #1062

Merged
merged 1 commit into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set when importing legacy settings.
- Configured and enabled etcd autocompaction.
- Add event metrics type, implementing the Sensu Metrics Format.
- Added non-functional selections for resolving and silencing to web ui
- Add LastOk to check type. This will be updated to reflect the last timestamp of a succesful check

### Changed
- Refactor Check data structure to not depend on CheckConfig. This is a breaking
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Otherwise, see the **for non-C++ users** [instructions here.](https://github.com

### Quick Start

Once you make a change to any `*.proto` file within the **types** package, you will need regenerate the associated `*.pb.go` file. To do so, simply run the [genproto.sh](https://github.com/sensu/sensu-go/blob/master/scripts/genproto.sh) script, which will install all required dependencies and launch the code generation.
Once you make a change to any `*.proto` file within the **types** package, you will need to regenerate the associated `*.pb.go` file. To do so, simply run the [genproto.sh](https://github.com/sensu/sensu-go/blob/master/scripts/genproto.sh) script, which will install all required dependencies and launch the code generation (be sure to run the below `./build.sh deps` first though).

## Dependencies

Expand Down
1 change: 1 addition & 0 deletions backend/eventd/eventd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func TestEventHandling(t *testing.T) {

// Make sure the event has been marked with the proper state
assert.Equal(t, types.EventPassingState, event.Check.State)
assert.Equal(t, event.Timestamp, event.Check.LastOK)
}

func TestEventMonitor(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions backend/eventd/flapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func state(event *types.Event) {
event.Check.State = types.EventFlappingState
} else if event.Check.Status == 0 {
event.Check.State = types.EventPassingState
event.Check.LastOK = event.Timestamp
} else {
event.Check.State = types.EventFailingState
}
Expand Down
1 change: 1 addition & 0 deletions types/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ func (c *Check) MergeWith(chk *Check) {
}

c.History = history
c.LastOK = chk.LastOK
}

// FixtureCheckRequest returns a fixture for a CheckRequest object.
Expand Down
167 changes: 107 additions & 60 deletions types/check.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions types/check.proto
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ message Check {
// check's history
uint32 total_state_change = 29;

// LastOK displays last time this check was ok; if event status is 0 this is set to timestamp
int64 last_ok = 30 [(gogoproto.customname) = "LastOK"];

// ExtendedAttributes store serialized arbitrary JSON-encoded data
bytes ExtendedAttributes = 99 [(gogoproto.jsontag) = "-"];
}
Expand Down
2 changes: 1 addition & 1 deletion types/metrics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.