Skip to content

Commit

Permalink
add health manager component for all health-related things (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniszewski committed Mar 30, 2020
1 parent 17681d5 commit 8cd09b3
Show file tree
Hide file tree
Showing 22 changed files with 579 additions and 541 deletions.
5 changes: 2 additions & 3 deletions sdk/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import (
"os"
"testing"

"github.com/vapor-ware/synse-sdk/sdk/errors"
"github.com/vapor-ware/synse-sdk/sdk/policy"

"github.com/stretchr/testify/assert"
"github.com/vapor-ware/synse-sdk/internal/test"
"github.com/vapor-ware/synse-sdk/sdk/errors"
"github.com/vapor-ware/synse-sdk/sdk/policy"
)

func TestNewYamlLoader(t *testing.T) {
Expand Down
7 changes: 6 additions & 1 deletion sdk/config/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ func (conf *Plugin) Log() {
log.Infof(" DynamicRegistration:")
log.Infof(" Config: %v", conf.DynamicRegistration.Config)
log.Infof(" Health:")
log.Infof(" HealthFile: %s", conf.Health.HealthFile)
log.Infof(" HealthFile: %s", conf.Health.HealthFile)
log.Infof(" UpdateInterval: %s", conf.Health.UpdateInterval)
log.Infof(" Checks:")
log.Infof(" DisableDefaults: %v", conf.Health.Checks.DisableDefaults)
}
Expand Down Expand Up @@ -295,6 +296,10 @@ type HealthSettings struct {
// "/etc/synse/plugin/healthy".
HealthFile string `default:"/etc/synse/plugin/healthy" yaml:"healthFile,omitempty"`

// UpdateInterval is the frequency with which the health file will be updated
// to designate the health status of the plugin.
UpdateInterval time.Duration `default:"30s" yaml:"updateInterval,omitempty"`

// Checks are the settings for plugin health checks.
Checks *HealthCheckSettings `default:"{}" yaml:"checks,omitempty"`
}
Expand Down
29 changes: 29 additions & 0 deletions sdk/health/checks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Synse SDK
// Copyright (c) 2019 Vapor IO
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package health

// CheckType defines the type of a health Check.
type CheckType string

// Check is an interface which all health checks should implement.
type Check interface {
GetName() string
GetType() CheckType
Status() *Status
Update()
Run()
}
17 changes: 17 additions & 0 deletions sdk/health/checks_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Synse SDK
// Copyright (c) 2019 Vapor IO
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

package health
216 changes: 0 additions & 216 deletions sdk/health/health.go

This file was deleted.

Loading

0 comments on commit 8cd09b3

Please sign in to comment.