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

[audit] No longer record state transition #163

Merged
merged 2 commits into from
Jul 4, 2019
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
17 changes: 17 additions & 0 deletions gql/resolver_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sort"
"time"

"github.com/cybozu-go/log"
"github.com/cybozu-go/sabakan/v2"
"github.com/vektah/gqlparser/gqlerror"
)
Expand Down Expand Up @@ -110,6 +111,11 @@ type mutationResolver struct{ *Resolver }
func (r *mutationResolver) SetMachineState(ctx context.Context, serial string, state sabakan.MachineState) (*sabakan.MachineStatus, error) {
now := time.Now()

log.Info("SetMachineState is called", map[string]interface{}{
"serial": serial,
"state": state,
})

err := r.Model.Machine.SetState(ctx, serial, state)
if err != nil {
switch err {
Expand Down Expand Up @@ -175,6 +181,11 @@ type queryResolver struct{ *Resolver }

func (r *queryResolver) Machine(ctx context.Context, serial string) (*sabakan.Machine, error) {
now := time.Now()

log.Info("Machine is called", map[string]interface{}{
"serial": serial,
})

machine, err := r.Model.Machine.Get(ctx, serial)
if err != nil {
return &sabakan.Machine{}, err
Expand All @@ -184,6 +195,12 @@ func (r *queryResolver) Machine(ctx context.Context, serial string) (*sabakan.Ma
}
func (r *queryResolver) SearchMachines(ctx context.Context, having, notHaving *MachineParams) ([]sabakan.Machine, error) {
now := time.Now()

log.Info("SearchMachines is called", map[string]interface{}{
"having": having,
"nothaving": notHaving,
})

machines, err := r.Model.Machine.Query(ctx, sabakan.Query{})
if err != nil {
return nil, err
Expand Down
2 changes: 0 additions & 2 deletions models/etcd/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ RETRY:
}
}

d.addLog(ctx, time.Now(), tresp.Header.Revision, sabakan.AuditMachines, serial,
"state", state.String())
return nil
}

Expand Down