api for getting alert states
This commit is contained in:
@@ -10,9 +10,11 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/journal/alerting"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
||||
@@ -21,6 +23,7 @@ var session = uuid.New()
|
||||
type CommonAPI struct {
|
||||
fx.In
|
||||
|
||||
Alerting *alerting.Alerting
|
||||
APISecret *dtypes.APIAlg
|
||||
ShutdownChan dtypes.ShutdownChan
|
||||
}
|
||||
@@ -72,6 +75,10 @@ func (a *CommonAPI) LogSetLevel(ctx context.Context, subsystem, level string) er
|
||||
return logging.SetLogLevel(subsystem, level)
|
||||
}
|
||||
|
||||
func (a *CommonAPI) LogAlerts(ctx context.Context) ([]alerting.Alert, error) {
|
||||
return a.Alerting.GetAlerts(), nil
|
||||
}
|
||||
|
||||
func (a *CommonAPI) Shutdown(ctx context.Context) error {
|
||||
a.ShutdownChan <- struct{}{}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user