From c374dbfe1326b43a62e4481ed2bdd1bf1223ef93 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Thu, 19 Mar 2020 14:31:38 -0700 Subject: [PATCH 1/6] Add stub API for top config mgmt errors Signed-off-by: Daniel DeLeo --- api/external/cfgmgmt/cfgmgmt.pb.go | 183 +++++++++++------ api/external/cfgmgmt/cfgmgmt.pb.gw.go | 77 ++++++++ api/external/cfgmgmt/cfgmgmt.pb.policy.go | 3 + api/external/cfgmgmt/cfgmgmt.proto | 20 ++ api/external/cfgmgmt/cfgmgmt.swagger.json | 67 +++++++ api/external/cfgmgmt/request/errors.pb.go | 98 ++++++++++ api/external/cfgmgmt/request/errors.proto | 16 ++ api/external/cfgmgmt/response/errors.pb.go | 147 ++++++++++++++ api/external/cfgmgmt/response/errors.proto | 20 ++ .../cfgmgmt/service/cfgmgmt.pb.client_mock.go | 185 +++++++++++------- .../cfgmgmt/service/cfgmgmt.pb.go | 135 ++++++++----- .../cfgmgmt/service/cfgmgmt.proto | 3 + .../api/cfgmgmt.pb.swagger.go | 67 +++++++ .../automate-gateway/handler/cfgmgmt.go | 9 + .../config-mgmt-service/grpcserver/nodes.go | 5 + 15 files changed, 851 insertions(+), 184 deletions(-) create mode 100644 api/external/cfgmgmt/request/errors.pb.go create mode 100644 api/external/cfgmgmt/request/errors.proto create mode 100644 api/external/cfgmgmt/response/errors.pb.go create mode 100644 api/external/cfgmgmt/response/errors.proto diff --git a/api/external/cfgmgmt/cfgmgmt.pb.go b/api/external/cfgmgmt/cfgmgmt.pb.go index 19363c9e6c4..cf3825361c8 100644 --- a/api/external/cfgmgmt/cfgmgmt.pb.go +++ b/api/external/cfgmgmt/cfgmgmt.pb.go @@ -38,69 +38,72 @@ func init() { } var fileDescriptor_ee30e63cf8458da6 = []byte{ - // 988 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0x97, 0x23, 0x14, 0xaa, 0x41, 0x69, 0xc3, 0x53, 0x93, 0x6e, 0xd6, 0x29, 0x08, 0xf3, 0xe1, - 0x34, 0xe0, 0x5d, 0x4a, 0x39, 0x99, 0x0b, 0x25, 0x12, 0x56, 0x25, 0xbe, 0xe4, 0xa2, 0x1e, 0x7a, - 0x31, 0xe3, 0xf5, 0xf3, 0x66, 0x14, 0xef, 0xcc, 0x66, 0x66, 0x36, 0x10, 0xaa, 0x5e, 0x7c, 0x0c, - 0x82, 0x03, 0xfd, 0x1f, 0x38, 0x71, 0xf5, 0x85, 0x0b, 0x17, 0x4e, 0x5c, 0xfb, 0x0f, 0x70, 0x80, - 0x7f, 0x01, 0xc4, 0x0d, 0xed, 0xec, 0x87, 0x77, 0xdd, 0xec, 0xb2, 0x6d, 0x73, 0x5a, 0x25, 0xf3, - 0x7b, 0x6f, 0xde, 0xef, 0xfd, 0xde, 0xc7, 0x98, 0x74, 0x68, 0xc8, 0x5c, 0xfc, 0x46, 0xa3, 0xe4, - 0x74, 0xe6, 0x7a, 0x53, 0x3f, 0xf0, 0x03, 0x9d, 0x7d, 0x9d, 0x50, 0x0a, 0x2d, 0x60, 0xc7, 0x3b, - 0xc4, 0xa9, 0x43, 0x23, 0x2d, 0x02, 0xaa, 0xd1, 0xa1, 0x21, 0x73, 0x52, 0x80, 0xbd, 0x7f, 0xae, - 0xb9, 0xc4, 0xe3, 0x08, 0x95, 0x76, 0xa9, 0xa7, 0x99, 0xe0, 0x2a, 0x71, 0x63, 0xef, 0xd5, 0x62, - 0xb9, 0x98, 0x60, 0x33, 0xa4, 0xd2, 0x54, 0x67, 0xc8, 0x6e, 0x2d, 0x52, 0x0a, 0x91, 0x72, 0xb0, - 0xdf, 0xae, 0x00, 0xaa, 0x50, 0x70, 0x85, 0x2b, 0x91, 0xde, 0xa8, 0x07, 0x17, 0x43, 0xfd, 0x1f, - 0x68, 0x31, 0xd6, 0x95, 0x5c, 0x89, 0x20, 0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x99, 0x3a, 0x7d, 0x62, - 0x8a, 0xb6, 0xc9, 0x4e, 0x49, 0xff, 0x22, 0xb0, 0xa6, 0xe6, 0x8b, 0xa3, 0x34, 0x79, 0xcb, 0x8e, - 0x32, 0x4b, 0xb7, 0xe4, 0xe3, 0x23, 0xf7, 0x7e, 0xcf, 0x67, 0xfa, 0x30, 0x1a, 0xc7, 0xca, 0xc5, - 0xcb, 0x66, 0x9a, 0xbf, 0x8a, 0xdd, 0xf3, 0x7e, 0x57, 0x8c, 0xd7, 0x4d, 0xb3, 0xde, 0xfa, 0x2f, - 0x00, 0x00, 0xff, 0xff, 0xf7, 0x16, 0x9b, 0x5e, 0xb6, 0x0d, 0x00, 0x00, + // 1034 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0x4d, 0x73, 0xdb, 0x44, + 0x18, 0xc7, 0xc7, 0x19, 0x26, 0x94, 0x65, 0xd2, 0xa4, 0xcf, 0xb4, 0x89, 0xa2, 0xa4, 0x30, 0x88, + 0x17, 0x27, 0x06, 0x4b, 0x94, 0x72, 0x32, 0x17, 0x4a, 0x06, 0x3c, 0x9d, 0xe1, 0x6d, 0x5c, 0xa6, + 0x87, 0x72, 0x30, 0xb2, 0xfc, 0x58, 0xd9, 0x89, 0xb5, 0xab, 0xec, 0xae, 0x02, 0xa1, 0xd3, 0x8b, + 0x8f, 0xe1, 0xe5, 0x40, 0xbf, 0x03, 0x27, 0xae, 0xbe, 0x70, 0xe1, 0xc2, 0x37, 0xe8, 0x17, 0xe0, + 0x00, 0x5f, 0x01, 0x86, 0x1b, 0x23, 0xad, 0x24, 0x4b, 0x6e, 0x24, 0xd4, 0x36, 0x27, 0x4d, 0xb2, + 0xbf, 0xe7, 0xd9, 0xe7, 0xff, 0xbc, 0xec, 0xae, 0x89, 0xe5, 0x86, 0xd4, 0xc1, 0x6f, 0x14, 0x0a, + 0xe6, 0x4e, 0x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, 0xdc, 0xdc, 0xfc, 0x2f, 0x00, 0x00, + 0xff, 0xff, 0xc7, 0xcd, 0xfe, 0x56, 0xcf, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -257,6 +260,16 @@ type ConfigMgmtClient interface { //infra:nodes:list //``` GetPolicyCookbooks(ctx context.Context, in *request.PolicyRevision, opts ...grpc.CallOption) (*response.PolicyCookbooks, error) + // + //GetErrors + // + //Returns a list of the most common errors reported for infra nodes' most recent Chef Client runs. + // + //Authorization Action: + //``` + //infra:nodes:list + //``` + GetErrors(ctx context.Context, in *request.Errors, opts ...grpc.CallOption) (*response.Errors, error) } type configMgmtClient struct { @@ -375,6 +388,15 @@ func (c *configMgmtClient) GetPolicyCookbooks(ctx context.Context, in *request.P return out, nil } +func (c *configMgmtClient) GetErrors(ctx context.Context, in *request.Errors, opts ...grpc.CallOption) (*response.Errors, error) { + out := new(response.Errors) + err := c.cc.Invoke(ctx, "/chef.automate.api.cfgmgmt.ConfigMgmt/GetErrors", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ConfigMgmtServer is the server API for ConfigMgmt service. type ConfigMgmtServer interface { // @@ -519,6 +541,16 @@ type ConfigMgmtServer interface { //infra:nodes:list //``` GetPolicyCookbooks(context.Context, *request.PolicyRevision) (*response.PolicyCookbooks, error) + // + //GetErrors + // + //Returns a list of the most common errors reported for infra nodes' most recent Chef Client runs. + // + //Authorization Action: + //``` + //infra:nodes:list + //``` + GetErrors(context.Context, *request.Errors) (*response.Errors, error) } // UnimplementedConfigMgmtServer can be embedded to have forward compatible implementations. @@ -561,6 +593,9 @@ func (*UnimplementedConfigMgmtServer) GetVersion(ctx context.Context, req *versi func (*UnimplementedConfigMgmtServer) GetPolicyCookbooks(ctx context.Context, req *request.PolicyRevision) (*response.PolicyCookbooks, error) { return nil, status.Errorf(codes.Unimplemented, "method GetPolicyCookbooks not implemented") } +func (*UnimplementedConfigMgmtServer) GetErrors(ctx context.Context, req *request.Errors) (*response.Errors, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetErrors not implemented") +} func RegisterConfigMgmtServer(s *grpc.Server, srv ConfigMgmtServer) { s.RegisterService(&_ConfigMgmt_serviceDesc, srv) @@ -782,6 +817,24 @@ func _ConfigMgmt_GetPolicyCookbooks_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +func _ConfigMgmt_GetErrors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(request.Errors) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ConfigMgmtServer).GetErrors(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/chef.automate.api.cfgmgmt.ConfigMgmt/GetErrors", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ConfigMgmtServer).GetErrors(ctx, req.(*request.Errors)) + } + return interceptor(ctx, in, info, handler) +} + var _ConfigMgmt_serviceDesc = grpc.ServiceDesc{ ServiceName: "chef.automate.api.cfgmgmt.ConfigMgmt", HandlerType: (*ConfigMgmtServer)(nil), @@ -834,6 +887,10 @@ var _ConfigMgmt_serviceDesc = grpc.ServiceDesc{ MethodName: "GetPolicyCookbooks", Handler: _ConfigMgmt_GetPolicyCookbooks_Handler, }, + { + MethodName: "GetErrors", + Handler: _ConfigMgmt_GetErrors_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/external/cfgmgmt/cfgmgmt.proto", diff --git a/api/external/cfgmgmt/cfgmgmt.pb.gw.go b/api/external/cfgmgmt/cfgmgmt.pb.gw.go index d3561872397..f5fa9703426 100644 --- a/api/external/cfgmgmt/cfgmgmt.pb.gw.go +++ b/api/external/cfgmgmt/cfgmgmt.pb.gw.go @@ -521,6 +521,39 @@ func local_request_ConfigMgmt_GetPolicyCookbooks_0(ctx context.Context, marshale } +var ( + filter_ConfigMgmt_GetErrors_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_ConfigMgmt_GetErrors_0(ctx context.Context, marshaler runtime.Marshaler, client ConfigMgmtClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq request.Errors + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ConfigMgmt_GetErrors_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetErrors(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ConfigMgmt_GetErrors_0(ctx context.Context, marshaler runtime.Marshaler, server ConfigMgmtServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq request.Errors + var metadata runtime.ServerMetadata + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ConfigMgmt_GetErrors_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetErrors(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterConfigMgmtHandlerServer registers the http handlers for service ConfigMgmt to "mux". // UnaryRPC :call ConfigMgmtServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -766,6 +799,26 @@ func RegisterConfigMgmtHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_ConfigMgmt_GetErrors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ConfigMgmt_GetErrors_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ConfigMgmt_GetErrors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1047,6 +1100,26 @@ func RegisterConfigMgmtHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_ConfigMgmt_GetErrors_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ConfigMgmt_GetErrors_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ConfigMgmt_GetErrors_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1074,6 +1147,8 @@ var ( pattern_ConfigMgmt_GetVersion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cfgmgmt", "version"}, "", runtime.AssumeColonVerbOpt(true))) pattern_ConfigMgmt_GetPolicyCookbooks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"cfgmgmt", "policy_revision", "revision_id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_ConfigMgmt_GetErrors_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cfgmgmt", "errors"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -1100,4 +1175,6 @@ var ( forward_ConfigMgmt_GetVersion_0 = runtime.ForwardResponseMessage forward_ConfigMgmt_GetPolicyCookbooks_0 = runtime.ForwardResponseMessage + + forward_ConfigMgmt_GetErrors_0 = runtime.ForwardResponseMessage ) diff --git a/api/external/cfgmgmt/cfgmgmt.pb.policy.go b/api/external/cfgmgmt/cfgmgmt.pb.policy.go index 7b64d3f1f5b..aea58057f81 100644 --- a/api/external/cfgmgmt/cfgmgmt.pb.policy.go +++ b/api/external/cfgmgmt/cfgmgmt.pb.policy.go @@ -118,4 +118,7 @@ func init() { } return "" }) + policy.MapMethodTo("/chef.automate.api.cfgmgmt.ConfigMgmt/GetErrors", "infra:nodes", "infra:nodes:list", "GET", "/cfgmgmt/errors", func(unexpandedResource string, input interface{}) string { + return unexpandedResource + }) } diff --git a/api/external/cfgmgmt/cfgmgmt.proto b/api/external/cfgmgmt/cfgmgmt.proto index 9deb099645f..d9d7b9f637b 100644 --- a/api/external/cfgmgmt/cfgmgmt.proto +++ b/api/external/cfgmgmt/cfgmgmt.proto @@ -7,11 +7,13 @@ option go_package = "github.com/chef/automate/api/external/cfgmgmt"; import "api/external/cfgmgmt/request/actions.proto"; import "api/external/cfgmgmt/request/nodes.proto"; import "api/external/cfgmgmt/request/stats.proto"; +import "api/external/cfgmgmt/request/errors.proto"; import "api/external/cfgmgmt/request/root.proto"; import "api/external/cfgmgmt/response/actions.proto"; import "api/external/cfgmgmt/response/nodes.proto"; import "api/external/cfgmgmt/response/stats.proto"; +import "api/external/cfgmgmt/response/errors.proto"; import "api/external/common/query/parameters.proto"; import "api/external/common/version/version.proto"; @@ -268,4 +270,22 @@ service ConfigMgmt { option (chef.automate.api.iam.policy).resource = "infra:nodes:{revision_id}"; option (chef.automate.api.iam.policy).action = "infra:nodes:list"; }; + + /* + GetErrors + + Returns a list of the most common errors reported for infra nodes' most recent Chef Client runs. + + Authorization Action: + ``` + infra:nodes:list + ``` + */ + rpc GetErrors(cfgmgmt.request.Errors) returns (cfgmgmt.response.Errors) { + option (google.api.http).get = "/cfgmgmt/errors"; + option (chef.automate.api.policy).resource = "cfgmgmt:nodes"; + option (chef.automate.api.policy).action = "read"; + option (chef.automate.api.iam.policy).resource = "infra:nodes"; + option (chef.automate.api.iam.policy).action = "infra:nodes:list"; + } } diff --git a/api/external/cfgmgmt/cfgmgmt.swagger.json b/api/external/cfgmgmt/cfgmgmt.swagger.json index adfe14b19c6..48930c010f3 100644 --- a/api/external/cfgmgmt/cfgmgmt.swagger.json +++ b/api/external/cfgmgmt/cfgmgmt.swagger.json @@ -11,6 +11,45 @@ "application/json" ], "paths": { + "/cfgmgmt/errors": { + "get": { + "summary": "GetErrors", + "description": "Returns a list of the most common errors reported for infra nodes' most recent Chef Client runs.\n\nAuthorization Action:\n```\ninfra:nodes:list\n```", + "operationId": "GetErrors", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/chef.automate.api.cfgmgmt.response.Errors" + } + } + }, + "parameters": [ + { + "name": "size", + "description": "The number of results to return.\nIf set to zero, the default size of 10 will be used. Set to a negative\nvalue for unlimited results.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "filter", + "description": "Filters in the request select the nodes from which the errors are\ncollected. The same filters may be specified for this request as for other\nNodes requests, with the exception of 'status' which is not valid for this\nrequest.", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + } + ], + "tags": [ + "ConfigMgmt" + ] + } + }, "/cfgmgmt/nodes": { "get": { "summary": "GetNodes", @@ -578,6 +617,34 @@ } } }, + "chef.automate.api.cfgmgmt.response.ErrorCount": { + "type": "object", + "properties": { + "count": { + "type": "integer", + "format": "int32" + }, + "type": { + "type": "string" + }, + "error_message": { + "type": "string" + } + }, + "title": "ErrorCount gives the number of occurrences (count) of the error specified by\nthe type and message among the nodes included by the request parameters" + }, + "chef.automate.api.cfgmgmt.response.Errors": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/definitions/chef.automate.api.cfgmgmt.response.ErrorCount" + } + } + }, + "description": "Errors contains a list of the most common Chef Infra error type/message\ncombinations among nodes in the active project as filtered according to the\nrequest." + }, "chef.automate.api.cfgmgmt.response.ExpandedRunList": { "type": "object", "properties": { diff --git a/api/external/cfgmgmt/request/errors.pb.go b/api/external/cfgmgmt/request/errors.pb.go new file mode 100644 index 00000000000..b1e8d99ffb1 --- /dev/null +++ b/api/external/cfgmgmt/request/errors.pb.go @@ -0,0 +1,98 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: api/external/cfgmgmt/request/errors.proto + +package request + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Errors struct { + // The number of results to return. + // If set to zero, the default size of 10 will be used. Set to a negative + // value for unlimited results. + Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` + // Filters in the request select the nodes from which the errors are + // collected. The same filters may be specified for this request as for other + // Nodes requests, with the exception of 'status' which is not valid for this + // request. + Filter []string `protobuf:"bytes,2,rep,name=filter,proto3" json:"filter,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Errors) Reset() { *m = Errors{} } +func (m *Errors) String() string { return proto.CompactTextString(m) } +func (*Errors) ProtoMessage() {} +func (*Errors) Descriptor() ([]byte, []int) { + return fileDescriptor_44d092708d357ea5, []int{0} +} + +func (m *Errors) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Errors.Unmarshal(m, b) +} +func (m *Errors) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Errors.Marshal(b, m, deterministic) +} +func (m *Errors) XXX_Merge(src proto.Message) { + xxx_messageInfo_Errors.Merge(m, src) +} +func (m *Errors) XXX_Size() int { + return xxx_messageInfo_Errors.Size(m) +} +func (m *Errors) XXX_DiscardUnknown() { + xxx_messageInfo_Errors.DiscardUnknown(m) +} + +var xxx_messageInfo_Errors proto.InternalMessageInfo + +func (m *Errors) GetSize() int32 { + if m != nil { + return m.Size + } + return 0 +} + +func (m *Errors) GetFilter() []string { + if m != nil { + return m.Filter + } + return nil +} + +func init() { + proto.RegisterType((*Errors)(nil), "chef.automate.api.cfgmgmt.request.Errors") +} + +func init() { + proto.RegisterFile("api/external/cfgmgmt/request/errors.proto", fileDescriptor_44d092708d357ea5) +} + +var fileDescriptor_44d092708d357ea5 = []byte{ + // 164 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4c, 0x2c, 0xc8, 0xd4, + 0x4f, 0xad, 0x28, 0x49, 0x2d, 0xca, 0x4b, 0xcc, 0xd1, 0x4f, 0x4e, 0x4b, 0xcf, 0x4d, 0xcf, 0x2d, + 0xd1, 0x2f, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0xd1, 0x4f, 0x2d, 0x2a, 0xca, 0x2f, 0x2a, 0xd6, + 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x4c, 0xce, 0x48, 0x4d, 0xd3, 0x4b, 0x2c, 0x2d, 0xc9, + 0xcf, 0x4d, 0x2c, 0x49, 0xd5, 0x4b, 0x2c, 0xc8, 0xd4, 0x83, 0xaa, 0xd7, 0x83, 0xaa, 0x57, 0x32, + 0xe1, 0x62, 0x73, 0x05, 0x6b, 0x11, 0x12, 0xe2, 0x62, 0x29, 0xce, 0xac, 0x4a, 0x95, 0x60, 0x54, + 0x60, 0xd4, 0x60, 0x0d, 0x02, 0xb3, 0x85, 0xc4, 0xb8, 0xd8, 0xd2, 0x32, 0x73, 0x4a, 0x52, 0x8b, + 0x24, 0x98, 0x14, 0x98, 0x35, 0x38, 0x83, 0xa0, 0x3c, 0x27, 0xf3, 0x28, 0xd3, 0xf4, 0xcc, 0x92, + 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x90, 0x2d, 0xfa, 0x30, 0x5b, 0xf4, 0xf1, 0x39, + 0x2f, 0x89, 0x0d, 0xec, 0x30, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xa7, 0xf4, 0x6f, + 0xc5, 0x00, 0x00, 0x00, +} diff --git a/api/external/cfgmgmt/request/errors.proto b/api/external/cfgmgmt/request/errors.proto new file mode 100644 index 00000000000..bdd2ce78c54 --- /dev/null +++ b/api/external/cfgmgmt/request/errors.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package chef.automate.api.cfgmgmt.request; +option go_package = "github.com/chef/automate/api/external/cfgmgmt/request"; + +message Errors { + // The number of results to return. + // If set to zero, the default size of 10 will be used. Set to a negative + // value for unlimited results. + int32 size = 1; + // Filters in the request select the nodes from which the errors are + // collected. The same filters may be specified for this request as for other + // Nodes requests, with the exception of 'status' which is not valid for this + // request. + repeated string filter = 2; +} diff --git a/api/external/cfgmgmt/response/errors.pb.go b/api/external/cfgmgmt/response/errors.pb.go new file mode 100644 index 00000000000..430ecc72298 --- /dev/null +++ b/api/external/cfgmgmt/response/errors.pb.go @@ -0,0 +1,147 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: api/external/cfgmgmt/response/errors.proto + +package response + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Errors contains a list of the most common Chef Infra error type/message +// combinations among nodes in the active project as filtered according to the +// request. +type Errors struct { + Errors []*ErrorCount `protobuf:"bytes,1,rep,name=errors,proto3" json:"errors,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Errors) Reset() { *m = Errors{} } +func (m *Errors) String() string { return proto.CompactTextString(m) } +func (*Errors) ProtoMessage() {} +func (*Errors) Descriptor() ([]byte, []int) { + return fileDescriptor_60d6c59ae1c33042, []int{0} +} + +func (m *Errors) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Errors.Unmarshal(m, b) +} +func (m *Errors) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Errors.Marshal(b, m, deterministic) +} +func (m *Errors) XXX_Merge(src proto.Message) { + xxx_messageInfo_Errors.Merge(m, src) +} +func (m *Errors) XXX_Size() int { + return xxx_messageInfo_Errors.Size(m) +} +func (m *Errors) XXX_DiscardUnknown() { + xxx_messageInfo_Errors.DiscardUnknown(m) +} + +var xxx_messageInfo_Errors proto.InternalMessageInfo + +func (m *Errors) GetErrors() []*ErrorCount { + if m != nil { + return m.Errors + } + return nil +} + +// ErrorCount gives the number of occurrences (count) of the error specified by +// the type and message among the nodes included by the request parameters +type ErrorCount struct { + Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + ErrorMessage string `protobuf:"bytes,3,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ErrorCount) Reset() { *m = ErrorCount{} } +func (m *ErrorCount) String() string { return proto.CompactTextString(m) } +func (*ErrorCount) ProtoMessage() {} +func (*ErrorCount) Descriptor() ([]byte, []int) { + return fileDescriptor_60d6c59ae1c33042, []int{1} +} + +func (m *ErrorCount) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ErrorCount.Unmarshal(m, b) +} +func (m *ErrorCount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ErrorCount.Marshal(b, m, deterministic) +} +func (m *ErrorCount) XXX_Merge(src proto.Message) { + xxx_messageInfo_ErrorCount.Merge(m, src) +} +func (m *ErrorCount) XXX_Size() int { + return xxx_messageInfo_ErrorCount.Size(m) +} +func (m *ErrorCount) XXX_DiscardUnknown() { + xxx_messageInfo_ErrorCount.DiscardUnknown(m) +} + +var xxx_messageInfo_ErrorCount proto.InternalMessageInfo + +func (m *ErrorCount) GetCount() int32 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *ErrorCount) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *ErrorCount) GetErrorMessage() string { + if m != nil { + return m.ErrorMessage + } + return "" +} + +func init() { + proto.RegisterType((*Errors)(nil), "chef.automate.api.cfgmgmt.response.Errors") + proto.RegisterType((*ErrorCount)(nil), "chef.automate.api.cfgmgmt.response.ErrorCount") +} + +func init() { + proto.RegisterFile("api/external/cfgmgmt/response/errors.proto", fileDescriptor_60d6c59ae1c33042) +} + +var fileDescriptor_60d6c59ae1c33042 = []byte{ + // 215 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0xd0, 0xb1, 0x4b, 0xc5, 0x30, + 0x10, 0x06, 0x70, 0xe2, 0xf3, 0x15, 0x3c, 0x75, 0x09, 0x0e, 0x19, 0x4b, 0x5d, 0x8a, 0xc3, 0x05, + 0x14, 0xc4, 0x59, 0xd1, 0x4d, 0x90, 0x8e, 0x3a, 0x48, 0x5e, 0xb8, 0x97, 0x57, 0x30, 0x4d, 0x48, + 0xae, 0xa0, 0xff, 0xbd, 0x34, 0x6d, 0x71, 0xf3, 0x6d, 0x97, 0x2f, 0xfc, 0x8e, 0xe3, 0x83, 0x1b, + 0x13, 0x7b, 0x4d, 0xdf, 0x4c, 0x69, 0x30, 0x5f, 0xda, 0xee, 0x9d, 0x77, 0x9e, 0x75, 0xa2, 0x1c, + 0xc3, 0x90, 0x49, 0x53, 0x4a, 0x21, 0x65, 0x8c, 0x29, 0x70, 0x90, 0x8d, 0x3d, 0xd0, 0x1e, 0xcd, + 0xc8, 0xc1, 0x1b, 0x26, 0x34, 0xb1, 0xc7, 0x05, 0xe0, 0x0a, 0x9a, 0x37, 0xa8, 0x9e, 0x8b, 0x91, + 0x2f, 0x50, 0xcd, 0x5a, 0x89, 0x7a, 0xd3, 0x9e, 0xdf, 0x22, 0x1e, 0xe7, 0x58, 0xec, 0x53, 0x18, + 0x07, 0xee, 0x16, 0xdd, 0x7c, 0x00, 0xfc, 0xa5, 0xf2, 0x0a, 0xb6, 0x76, 0x1a, 0x94, 0xa8, 0x45, + 0xbb, 0xed, 0xe6, 0x87, 0x94, 0x70, 0xca, 0x3f, 0x91, 0xd4, 0x49, 0x2d, 0xda, 0xb3, 0xae, 0xcc, + 0xf2, 0x1a, 0x2e, 0xcb, 0x86, 0x4f, 0x4f, 0x39, 0x1b, 0x47, 0x6a, 0x53, 0x3e, 0x2f, 0x4a, 0xf8, + 0x3a, 0x67, 0x8f, 0x0f, 0xef, 0xf7, 0xae, 0xe7, 0xc3, 0xb8, 0x43, 0x1b, 0xbc, 0x9e, 0x0e, 0xd4, + 0xeb, 0x81, 0xfa, 0xdf, 0x66, 0x76, 0x55, 0xe9, 0xe4, 0xee, 0x37, 0x00, 0x00, 0xff, 0xff, 0x76, + 0xe8, 0xe8, 0x70, 0x41, 0x01, 0x00, 0x00, +} diff --git a/api/external/cfgmgmt/response/errors.proto b/api/external/cfgmgmt/response/errors.proto new file mode 100644 index 00000000000..e4f13676445 --- /dev/null +++ b/api/external/cfgmgmt/response/errors.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package chef.automate.api.cfgmgmt.response; +option go_package = "github.com/chef/automate/api/external/cfgmgmt/response"; + +// Errors contains a list of the most common Chef Infra error type/message +// combinations among nodes in the active project as filtered according to the +// request. +message Errors { + repeated ErrorCount errors = 1; +} + +// ErrorCount gives the number of occurrences (count) of the error specified by +// the type and message among the nodes included by the request parameters +message ErrorCount { + int32 count = 1; + string type = 2; + string error_message = 3; +} + diff --git a/api/interservice/cfgmgmt/service/cfgmgmt.pb.client_mock.go b/api/interservice/cfgmgmt/service/cfgmgmt.pb.client_mock.go index cee6b01418f..aaea156fcad 100644 --- a/api/interservice/cfgmgmt/service/cfgmgmt.pb.client_mock.go +++ b/api/interservice/cfgmgmt/service/cfgmgmt.pb.client_mock.go @@ -6,8 +6,10 @@ package service import ( context "context" - request "github.com/chef/automate/api/interservice/cfgmgmt/request" - response "github.com/chef/automate/api/interservice/cfgmgmt/response" + request "github.com/chef/automate/api/external/cfgmgmt/request" + response "github.com/chef/automate/api/external/cfgmgmt/response" + request0 "github.com/chef/automate/api/interservice/cfgmgmt/request" + response0 "github.com/chef/automate/api/interservice/cfgmgmt/response" gomock "github.com/golang/mock/gomock" struct0 "github.com/golang/protobuf/ptypes/struct" grpc "google.golang.org/grpc" @@ -39,14 +41,14 @@ func (m *MockCfgMgmtClient) EXPECT() *MockCfgMgmtClientMockRecorder { } // GetAttributes mocks base method -func (m *MockCfgMgmtClient) GetAttributes(arg0 context.Context, arg1 *request.Node, arg2 ...grpc.CallOption) (*response.NodeAttribute, error) { +func (m *MockCfgMgmtClient) GetAttributes(arg0 context.Context, arg1 *request0.Node, arg2 ...grpc.CallOption) (*response0.NodeAttribute, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetAttributes", varargs...) - ret0, _ := ret[0].(*response.NodeAttribute) + ret0, _ := ret[0].(*response0.NodeAttribute) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -59,14 +61,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetAttributes(arg0, arg1 interface{}, a } // GetCheckInCountsTimeSeries mocks base method -func (m *MockCfgMgmtClient) GetCheckInCountsTimeSeries(arg0 context.Context, arg1 *request.CheckInCountsTimeSeries, arg2 ...grpc.CallOption) (*response.CheckInCountsTimeSeries, error) { +func (m *MockCfgMgmtClient) GetCheckInCountsTimeSeries(arg0 context.Context, arg1 *request0.CheckInCountsTimeSeries, arg2 ...grpc.CallOption) (*response0.CheckInCountsTimeSeries, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetCheckInCountsTimeSeries", varargs...) - ret0, _ := ret[0].(*response.CheckInCountsTimeSeries) + ret0, _ := ret[0].(*response0.CheckInCountsTimeSeries) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -78,15 +80,35 @@ func (mr *MockCfgMgmtClientMockRecorder) GetCheckInCountsTimeSeries(arg0, arg1 i return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCheckInCountsTimeSeries", reflect.TypeOf((*MockCfgMgmtClient)(nil).GetCheckInCountsTimeSeries), varargs...) } +// GetErrors mocks base method +func (m *MockCfgMgmtClient) GetErrors(arg0 context.Context, arg1 *request.Errors, arg2 ...grpc.CallOption) (*response.Errors, error) { + m.ctrl.T.Helper() + varargs := []interface{}{arg0, arg1} + for _, a := range arg2 { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetErrors", varargs...) + ret0, _ := ret[0].(*response.Errors) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetErrors indicates an expected call of GetErrors +func (mr *MockCfgMgmtClientMockRecorder) GetErrors(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{arg0, arg1}, arg2...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetErrors", reflect.TypeOf((*MockCfgMgmtClient)(nil).GetErrors), varargs...) +} + // GetEventFeed mocks base method -func (m *MockCfgMgmtClient) GetEventFeed(arg0 context.Context, arg1 *request.EventFilter, arg2 ...grpc.CallOption) (*response.Events, error) { +func (m *MockCfgMgmtClient) GetEventFeed(arg0 context.Context, arg1 *request0.EventFilter, arg2 ...grpc.CallOption) (*response0.Events, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetEventFeed", varargs...) - ret0, _ := ret[0].(*response.Events) + ret0, _ := ret[0].(*response0.Events) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -99,14 +121,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetEventFeed(arg0, arg1 interface{}, ar } // GetEventStringBuckets mocks base method -func (m *MockCfgMgmtClient) GetEventStringBuckets(arg0 context.Context, arg1 *request.EventStrings, arg2 ...grpc.CallOption) (*response.EventStrings, error) { +func (m *MockCfgMgmtClient) GetEventStringBuckets(arg0 context.Context, arg1 *request0.EventStrings, arg2 ...grpc.CallOption) (*response0.EventStrings, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetEventStringBuckets", varargs...) - ret0, _ := ret[0].(*response.EventStrings) + ret0, _ := ret[0].(*response0.EventStrings) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -119,14 +141,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetEventStringBuckets(arg0, arg1 interf } // GetEventTaskCounts mocks base method -func (m *MockCfgMgmtClient) GetEventTaskCounts(arg0 context.Context, arg1 *request.EventCountsFilter, arg2 ...grpc.CallOption) (*response.EventCounts, error) { +func (m *MockCfgMgmtClient) GetEventTaskCounts(arg0 context.Context, arg1 *request0.EventCountsFilter, arg2 ...grpc.CallOption) (*response0.EventCounts, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetEventTaskCounts", varargs...) - ret0, _ := ret[0].(*response.EventCounts) + ret0, _ := ret[0].(*response0.EventCounts) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -139,14 +161,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetEventTaskCounts(arg0, arg1 interface } // GetEventTypeCounts mocks base method -func (m *MockCfgMgmtClient) GetEventTypeCounts(arg0 context.Context, arg1 *request.EventCountsFilter, arg2 ...grpc.CallOption) (*response.EventCounts, error) { +func (m *MockCfgMgmtClient) GetEventTypeCounts(arg0 context.Context, arg1 *request0.EventCountsFilter, arg2 ...grpc.CallOption) (*response0.EventCounts, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetEventTypeCounts", varargs...) - ret0, _ := ret[0].(*response.EventCounts) + ret0, _ := ret[0].(*response0.EventCounts) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -159,14 +181,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetEventTypeCounts(arg0, arg1 interface } // GetHealth mocks base method -func (m *MockCfgMgmtClient) GetHealth(arg0 context.Context, arg1 *request.Health, arg2 ...grpc.CallOption) (*response.Health, error) { +func (m *MockCfgMgmtClient) GetHealth(arg0 context.Context, arg1 *request0.Health, arg2 ...grpc.CallOption) (*response0.Health, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetHealth", varargs...) - ret0, _ := ret[0].(*response.Health) + ret0, _ := ret[0].(*response0.Health) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -179,14 +201,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetHealth(arg0, arg1 interface{}, arg2 } // GetInventoryNodes mocks base method -func (m *MockCfgMgmtClient) GetInventoryNodes(arg0 context.Context, arg1 *request.InventoryNodes, arg2 ...grpc.CallOption) (*response.InventoryNodes, error) { +func (m *MockCfgMgmtClient) GetInventoryNodes(arg0 context.Context, arg1 *request0.InventoryNodes, arg2 ...grpc.CallOption) (*response0.InventoryNodes, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetInventoryNodes", varargs...) - ret0, _ := ret[0].(*response.InventoryNodes) + ret0, _ := ret[0].(*response0.InventoryNodes) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -199,14 +221,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetInventoryNodes(arg0, arg1 interface{ } // GetNodeRun mocks base method -func (m *MockCfgMgmtClient) GetNodeRun(arg0 context.Context, arg1 *request.NodeRun, arg2 ...grpc.CallOption) (*response.Run, error) { +func (m *MockCfgMgmtClient) GetNodeRun(arg0 context.Context, arg1 *request0.NodeRun, arg2 ...grpc.CallOption) (*response0.Run, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetNodeRun", varargs...) - ret0, _ := ret[0].(*response.Run) + ret0, _ := ret[0].(*response0.Run) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -219,7 +241,7 @@ func (mr *MockCfgMgmtClientMockRecorder) GetNodeRun(arg0, arg1 interface{}, arg2 } // GetNodes mocks base method -func (m *MockCfgMgmtClient) GetNodes(arg0 context.Context, arg1 *request.Nodes, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { +func (m *MockCfgMgmtClient) GetNodes(arg0 context.Context, arg1 *request0.Nodes, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { @@ -239,14 +261,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetNodes(arg0, arg1 interface{}, arg2 . } // GetNodesCounts mocks base method -func (m *MockCfgMgmtClient) GetNodesCounts(arg0 context.Context, arg1 *request.NodesCounts, arg2 ...grpc.CallOption) (*response.NodesCounts, error) { +func (m *MockCfgMgmtClient) GetNodesCounts(arg0 context.Context, arg1 *request0.NodesCounts, arg2 ...grpc.CallOption) (*response0.NodesCounts, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetNodesCounts", varargs...) - ret0, _ := ret[0].(*response.NodesCounts) + ret0, _ := ret[0].(*response0.NodesCounts) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -259,7 +281,7 @@ func (mr *MockCfgMgmtClientMockRecorder) GetNodesCounts(arg0, arg1 interface{}, } // GetOrganizations mocks base method -func (m *MockCfgMgmtClient) GetOrganizations(arg0 context.Context, arg1 *request.Organizations, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { +func (m *MockCfgMgmtClient) GetOrganizations(arg0 context.Context, arg1 *request0.Organizations, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { @@ -279,14 +301,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetOrganizations(arg0, arg1 interface{} } // GetPolicyCookbooks mocks base method -func (m *MockCfgMgmtClient) GetPolicyCookbooks(arg0 context.Context, arg1 *request.PolicyRevision, arg2 ...grpc.CallOption) (*response.PolicyCookbooks, error) { +func (m *MockCfgMgmtClient) GetPolicyCookbooks(arg0 context.Context, arg1 *request0.PolicyRevision, arg2 ...grpc.CallOption) (*response0.PolicyCookbooks, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetPolicyCookbooks", varargs...) - ret0, _ := ret[0].(*response.PolicyCookbooks) + ret0, _ := ret[0].(*response0.PolicyCookbooks) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -299,7 +321,7 @@ func (mr *MockCfgMgmtClientMockRecorder) GetPolicyCookbooks(arg0, arg1 interface } // GetRuns mocks base method -func (m *MockCfgMgmtClient) GetRuns(arg0 context.Context, arg1 *request.Runs, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { +func (m *MockCfgMgmtClient) GetRuns(arg0 context.Context, arg1 *request0.Runs, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { @@ -319,14 +341,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetRuns(arg0, arg1 interface{}, arg2 .. } // GetRunsCounts mocks base method -func (m *MockCfgMgmtClient) GetRunsCounts(arg0 context.Context, arg1 *request.RunsCounts, arg2 ...grpc.CallOption) (*response.RunsCounts, error) { +func (m *MockCfgMgmtClient) GetRunsCounts(arg0 context.Context, arg1 *request0.RunsCounts, arg2 ...grpc.CallOption) (*response0.RunsCounts, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetRunsCounts", varargs...) - ret0, _ := ret[0].(*response.RunsCounts) + ret0, _ := ret[0].(*response0.RunsCounts) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -339,7 +361,7 @@ func (mr *MockCfgMgmtClientMockRecorder) GetRunsCounts(arg0, arg1 interface{}, a } // GetSourceFqdns mocks base method -func (m *MockCfgMgmtClient) GetSourceFqdns(arg0 context.Context, arg1 *request.SourceFQDNS, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { +func (m *MockCfgMgmtClient) GetSourceFqdns(arg0 context.Context, arg1 *request0.SourceFQDNS, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { @@ -359,7 +381,7 @@ func (mr *MockCfgMgmtClientMockRecorder) GetSourceFqdns(arg0, arg1 interface{}, } // GetSuggestions mocks base method -func (m *MockCfgMgmtClient) GetSuggestions(arg0 context.Context, arg1 *request.Suggestion, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { +func (m *MockCfgMgmtClient) GetSuggestions(arg0 context.Context, arg1 *request0.Suggestion, arg2 ...grpc.CallOption) (*struct0.ListValue, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { @@ -379,14 +401,14 @@ func (mr *MockCfgMgmtClientMockRecorder) GetSuggestions(arg0, arg1 interface{}, } // GetVersion mocks base method -func (m *MockCfgMgmtClient) GetVersion(arg0 context.Context, arg1 *request.VersionInfo, arg2 ...grpc.CallOption) (*response.VersionInfo, error) { +func (m *MockCfgMgmtClient) GetVersion(arg0 context.Context, arg1 *request0.VersionInfo, arg2 ...grpc.CallOption) (*response0.VersionInfo, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetVersion", varargs...) - ret0, _ := ret[0].(*response.VersionInfo) + ret0, _ := ret[0].(*response0.VersionInfo) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -399,7 +421,7 @@ func (mr *MockCfgMgmtClientMockRecorder) GetVersion(arg0, arg1 interface{}, arg2 } // NodeExport mocks base method -func (m *MockCfgMgmtClient) NodeExport(arg0 context.Context, arg1 *request.NodeExport, arg2 ...grpc.CallOption) (CfgMgmt_NodeExportClient, error) { +func (m *MockCfgMgmtClient) NodeExport(arg0 context.Context, arg1 *request0.NodeExport, arg2 ...grpc.CallOption) (CfgMgmt_NodeExportClient, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { @@ -419,7 +441,7 @@ func (mr *MockCfgMgmtClientMockRecorder) NodeExport(arg0, arg1 interface{}, arg2 } // ReportExport mocks base method -func (m *MockCfgMgmtClient) ReportExport(arg0 context.Context, arg1 *request.ReportExport, arg2 ...grpc.CallOption) (CfgMgmt_ReportExportClient, error) { +func (m *MockCfgMgmtClient) ReportExport(arg0 context.Context, arg1 *request0.ReportExport, arg2 ...grpc.CallOption) (CfgMgmt_ReportExportClient, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { @@ -505,10 +527,10 @@ func (mr *MockCfgMgmt_NodeExportClientMockRecorder) Header() *gomock.Call { } // Recv mocks base method -func (m *MockCfgMgmt_NodeExportClient) Recv() (*response.ExportData, error) { +func (m *MockCfgMgmt_NodeExportClient) Recv() (*response0.ExportData, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Recv") - ret0, _ := ret[0].(*response.ExportData) + ret0, _ := ret[0].(*response0.ExportData) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -628,10 +650,10 @@ func (mr *MockCfgMgmt_ReportExportClientMockRecorder) Header() *gomock.Call { } // Recv mocks base method -func (m *MockCfgMgmt_ReportExportClient) Recv() (*response.ReportExportData, error) { +func (m *MockCfgMgmt_ReportExportClient) Recv() (*response0.ReportExportData, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Recv") - ret0, _ := ret[0].(*response.ReportExportData) + ret0, _ := ret[0].(*response0.ReportExportData) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -708,10 +730,10 @@ func (m *MockCfgMgmtServer) EXPECT() *MockCfgMgmtServerMockRecorder { } // GetAttributes mocks base method -func (m *MockCfgMgmtServer) GetAttributes(arg0 context.Context, arg1 *request.Node) (*response.NodeAttribute, error) { +func (m *MockCfgMgmtServer) GetAttributes(arg0 context.Context, arg1 *request0.Node) (*response0.NodeAttribute, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAttributes", arg0, arg1) - ret0, _ := ret[0].(*response.NodeAttribute) + ret0, _ := ret[0].(*response0.NodeAttribute) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -723,10 +745,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetAttributes(arg0, arg1 interface{}) * } // GetCheckInCountsTimeSeries mocks base method -func (m *MockCfgMgmtServer) GetCheckInCountsTimeSeries(arg0 context.Context, arg1 *request.CheckInCountsTimeSeries) (*response.CheckInCountsTimeSeries, error) { +func (m *MockCfgMgmtServer) GetCheckInCountsTimeSeries(arg0 context.Context, arg1 *request0.CheckInCountsTimeSeries) (*response0.CheckInCountsTimeSeries, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetCheckInCountsTimeSeries", arg0, arg1) - ret0, _ := ret[0].(*response.CheckInCountsTimeSeries) + ret0, _ := ret[0].(*response0.CheckInCountsTimeSeries) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -737,11 +759,26 @@ func (mr *MockCfgMgmtServerMockRecorder) GetCheckInCountsTimeSeries(arg0, arg1 i return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCheckInCountsTimeSeries", reflect.TypeOf((*MockCfgMgmtServer)(nil).GetCheckInCountsTimeSeries), arg0, arg1) } +// GetErrors mocks base method +func (m *MockCfgMgmtServer) GetErrors(arg0 context.Context, arg1 *request.Errors) (*response.Errors, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetErrors", arg0, arg1) + ret0, _ := ret[0].(*response.Errors) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetErrors indicates an expected call of GetErrors +func (mr *MockCfgMgmtServerMockRecorder) GetErrors(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetErrors", reflect.TypeOf((*MockCfgMgmtServer)(nil).GetErrors), arg0, arg1) +} + // GetEventFeed mocks base method -func (m *MockCfgMgmtServer) GetEventFeed(arg0 context.Context, arg1 *request.EventFilter) (*response.Events, error) { +func (m *MockCfgMgmtServer) GetEventFeed(arg0 context.Context, arg1 *request0.EventFilter) (*response0.Events, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetEventFeed", arg0, arg1) - ret0, _ := ret[0].(*response.Events) + ret0, _ := ret[0].(*response0.Events) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -753,10 +790,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetEventFeed(arg0, arg1 interface{}) *g } // GetEventStringBuckets mocks base method -func (m *MockCfgMgmtServer) GetEventStringBuckets(arg0 context.Context, arg1 *request.EventStrings) (*response.EventStrings, error) { +func (m *MockCfgMgmtServer) GetEventStringBuckets(arg0 context.Context, arg1 *request0.EventStrings) (*response0.EventStrings, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetEventStringBuckets", arg0, arg1) - ret0, _ := ret[0].(*response.EventStrings) + ret0, _ := ret[0].(*response0.EventStrings) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -768,10 +805,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetEventStringBuckets(arg0, arg1 interf } // GetEventTaskCounts mocks base method -func (m *MockCfgMgmtServer) GetEventTaskCounts(arg0 context.Context, arg1 *request.EventCountsFilter) (*response.EventCounts, error) { +func (m *MockCfgMgmtServer) GetEventTaskCounts(arg0 context.Context, arg1 *request0.EventCountsFilter) (*response0.EventCounts, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetEventTaskCounts", arg0, arg1) - ret0, _ := ret[0].(*response.EventCounts) + ret0, _ := ret[0].(*response0.EventCounts) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -783,10 +820,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetEventTaskCounts(arg0, arg1 interface } // GetEventTypeCounts mocks base method -func (m *MockCfgMgmtServer) GetEventTypeCounts(arg0 context.Context, arg1 *request.EventCountsFilter) (*response.EventCounts, error) { +func (m *MockCfgMgmtServer) GetEventTypeCounts(arg0 context.Context, arg1 *request0.EventCountsFilter) (*response0.EventCounts, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetEventTypeCounts", arg0, arg1) - ret0, _ := ret[0].(*response.EventCounts) + ret0, _ := ret[0].(*response0.EventCounts) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -798,10 +835,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetEventTypeCounts(arg0, arg1 interface } // GetHealth mocks base method -func (m *MockCfgMgmtServer) GetHealth(arg0 context.Context, arg1 *request.Health) (*response.Health, error) { +func (m *MockCfgMgmtServer) GetHealth(arg0 context.Context, arg1 *request0.Health) (*response0.Health, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetHealth", arg0, arg1) - ret0, _ := ret[0].(*response.Health) + ret0, _ := ret[0].(*response0.Health) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -813,10 +850,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetHealth(arg0, arg1 interface{}) *gomo } // GetInventoryNodes mocks base method -func (m *MockCfgMgmtServer) GetInventoryNodes(arg0 context.Context, arg1 *request.InventoryNodes) (*response.InventoryNodes, error) { +func (m *MockCfgMgmtServer) GetInventoryNodes(arg0 context.Context, arg1 *request0.InventoryNodes) (*response0.InventoryNodes, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetInventoryNodes", arg0, arg1) - ret0, _ := ret[0].(*response.InventoryNodes) + ret0, _ := ret[0].(*response0.InventoryNodes) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -828,10 +865,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetInventoryNodes(arg0, arg1 interface{ } // GetNodeRun mocks base method -func (m *MockCfgMgmtServer) GetNodeRun(arg0 context.Context, arg1 *request.NodeRun) (*response.Run, error) { +func (m *MockCfgMgmtServer) GetNodeRun(arg0 context.Context, arg1 *request0.NodeRun) (*response0.Run, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNodeRun", arg0, arg1) - ret0, _ := ret[0].(*response.Run) + ret0, _ := ret[0].(*response0.Run) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -843,7 +880,7 @@ func (mr *MockCfgMgmtServerMockRecorder) GetNodeRun(arg0, arg1 interface{}) *gom } // GetNodes mocks base method -func (m *MockCfgMgmtServer) GetNodes(arg0 context.Context, arg1 *request.Nodes) (*struct0.ListValue, error) { +func (m *MockCfgMgmtServer) GetNodes(arg0 context.Context, arg1 *request0.Nodes) (*struct0.ListValue, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNodes", arg0, arg1) ret0, _ := ret[0].(*struct0.ListValue) @@ -858,10 +895,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetNodes(arg0, arg1 interface{}) *gomoc } // GetNodesCounts mocks base method -func (m *MockCfgMgmtServer) GetNodesCounts(arg0 context.Context, arg1 *request.NodesCounts) (*response.NodesCounts, error) { +func (m *MockCfgMgmtServer) GetNodesCounts(arg0 context.Context, arg1 *request0.NodesCounts) (*response0.NodesCounts, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNodesCounts", arg0, arg1) - ret0, _ := ret[0].(*response.NodesCounts) + ret0, _ := ret[0].(*response0.NodesCounts) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -873,7 +910,7 @@ func (mr *MockCfgMgmtServerMockRecorder) GetNodesCounts(arg0, arg1 interface{}) } // GetOrganizations mocks base method -func (m *MockCfgMgmtServer) GetOrganizations(arg0 context.Context, arg1 *request.Organizations) (*struct0.ListValue, error) { +func (m *MockCfgMgmtServer) GetOrganizations(arg0 context.Context, arg1 *request0.Organizations) (*struct0.ListValue, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetOrganizations", arg0, arg1) ret0, _ := ret[0].(*struct0.ListValue) @@ -888,10 +925,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetOrganizations(arg0, arg1 interface{} } // GetPolicyCookbooks mocks base method -func (m *MockCfgMgmtServer) GetPolicyCookbooks(arg0 context.Context, arg1 *request.PolicyRevision) (*response.PolicyCookbooks, error) { +func (m *MockCfgMgmtServer) GetPolicyCookbooks(arg0 context.Context, arg1 *request0.PolicyRevision) (*response0.PolicyCookbooks, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetPolicyCookbooks", arg0, arg1) - ret0, _ := ret[0].(*response.PolicyCookbooks) + ret0, _ := ret[0].(*response0.PolicyCookbooks) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -903,7 +940,7 @@ func (mr *MockCfgMgmtServerMockRecorder) GetPolicyCookbooks(arg0, arg1 interface } // GetRuns mocks base method -func (m *MockCfgMgmtServer) GetRuns(arg0 context.Context, arg1 *request.Runs) (*struct0.ListValue, error) { +func (m *MockCfgMgmtServer) GetRuns(arg0 context.Context, arg1 *request0.Runs) (*struct0.ListValue, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRuns", arg0, arg1) ret0, _ := ret[0].(*struct0.ListValue) @@ -918,10 +955,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetRuns(arg0, arg1 interface{}) *gomock } // GetRunsCounts mocks base method -func (m *MockCfgMgmtServer) GetRunsCounts(arg0 context.Context, arg1 *request.RunsCounts) (*response.RunsCounts, error) { +func (m *MockCfgMgmtServer) GetRunsCounts(arg0 context.Context, arg1 *request0.RunsCounts) (*response0.RunsCounts, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRunsCounts", arg0, arg1) - ret0, _ := ret[0].(*response.RunsCounts) + ret0, _ := ret[0].(*response0.RunsCounts) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -933,7 +970,7 @@ func (mr *MockCfgMgmtServerMockRecorder) GetRunsCounts(arg0, arg1 interface{}) * } // GetSourceFqdns mocks base method -func (m *MockCfgMgmtServer) GetSourceFqdns(arg0 context.Context, arg1 *request.SourceFQDNS) (*struct0.ListValue, error) { +func (m *MockCfgMgmtServer) GetSourceFqdns(arg0 context.Context, arg1 *request0.SourceFQDNS) (*struct0.ListValue, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSourceFqdns", arg0, arg1) ret0, _ := ret[0].(*struct0.ListValue) @@ -948,7 +985,7 @@ func (mr *MockCfgMgmtServerMockRecorder) GetSourceFqdns(arg0, arg1 interface{}) } // GetSuggestions mocks base method -func (m *MockCfgMgmtServer) GetSuggestions(arg0 context.Context, arg1 *request.Suggestion) (*struct0.ListValue, error) { +func (m *MockCfgMgmtServer) GetSuggestions(arg0 context.Context, arg1 *request0.Suggestion) (*struct0.ListValue, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSuggestions", arg0, arg1) ret0, _ := ret[0].(*struct0.ListValue) @@ -963,10 +1000,10 @@ func (mr *MockCfgMgmtServerMockRecorder) GetSuggestions(arg0, arg1 interface{}) } // GetVersion mocks base method -func (m *MockCfgMgmtServer) GetVersion(arg0 context.Context, arg1 *request.VersionInfo) (*response.VersionInfo, error) { +func (m *MockCfgMgmtServer) GetVersion(arg0 context.Context, arg1 *request0.VersionInfo) (*response0.VersionInfo, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetVersion", arg0, arg1) - ret0, _ := ret[0].(*response.VersionInfo) + ret0, _ := ret[0].(*response0.VersionInfo) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -978,7 +1015,7 @@ func (mr *MockCfgMgmtServerMockRecorder) GetVersion(arg0, arg1 interface{}) *gom } // NodeExport mocks base method -func (m *MockCfgMgmtServer) NodeExport(arg0 *request.NodeExport, arg1 CfgMgmt_NodeExportServer) error { +func (m *MockCfgMgmtServer) NodeExport(arg0 *request0.NodeExport, arg1 CfgMgmt_NodeExportServer) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "NodeExport", arg0, arg1) ret0, _ := ret[0].(error) @@ -992,7 +1029,7 @@ func (mr *MockCfgMgmtServerMockRecorder) NodeExport(arg0, arg1 interface{}) *gom } // ReportExport mocks base method -func (m *MockCfgMgmtServer) ReportExport(arg0 *request.ReportExport, arg1 CfgMgmt_ReportExportServer) error { +func (m *MockCfgMgmtServer) ReportExport(arg0 *request0.ReportExport, arg1 CfgMgmt_ReportExportServer) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ReportExport", arg0, arg1) ret0, _ := ret[0].(error) @@ -1057,7 +1094,7 @@ func (mr *MockCfgMgmt_NodeExportServerMockRecorder) RecvMsg(arg0 interface{}) *g } // Send mocks base method -func (m *MockCfgMgmt_NodeExportServer) Send(arg0 *response.ExportData) error { +func (m *MockCfgMgmt_NodeExportServer) Send(arg0 *response0.ExportData) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Send", arg0) ret0, _ := ret[0].(error) @@ -1176,7 +1213,7 @@ func (mr *MockCfgMgmt_ReportExportServerMockRecorder) RecvMsg(arg0 interface{}) } // Send mocks base method -func (m *MockCfgMgmt_ReportExportServer) Send(arg0 *response.ReportExportData) error { +func (m *MockCfgMgmt_ReportExportServer) Send(arg0 *response0.ReportExportData) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Send", arg0) ret0, _ := ret[0].(error) diff --git a/api/interservice/cfgmgmt/service/cfgmgmt.pb.go b/api/interservice/cfgmgmt/service/cfgmgmt.pb.go index fb420c9cb0d..e6dd109f0b4 100644 --- a/api/interservice/cfgmgmt/service/cfgmgmt.pb.go +++ b/api/interservice/cfgmgmt/service/cfgmgmt.pb.go @@ -6,6 +6,8 @@ package service import ( context "context" fmt "fmt" + request1 "github.com/chef/automate/api/external/cfgmgmt/request" + response1 "github.com/chef/automate/api/external/cfgmgmt/response" request "github.com/chef/automate/api/interservice/cfgmgmt/request" response "github.com/chef/automate/api/interservice/cfgmgmt/response" proto "github.com/golang/protobuf/proto" @@ -32,53 +34,56 @@ func init() { } var fileDescriptor_2d8f0c4330cc0845 = []byte{ - // 726 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x97, 0x4f, 0x6f, 0x13, 0x3b, - 0x14, 0xc5, 0x95, 0xcd, 0xeb, 0x7b, 0x56, 0x1f, 0x02, 0x4b, 0x6c, 0x2c, 0x96, 0xac, 0xfa, 0x67, - 0xa6, 0x4d, 0x4a, 0x2b, 0x84, 0x40, 0xa2, 0x69, 0x3b, 0x54, 0x82, 0x42, 0x93, 0xaa, 0x0b, 0x16, - 0x54, 0xce, 0xe4, 0x66, 0x62, 0x25, 0x63, 0xa7, 0xf6, 0x9d, 0x42, 0x91, 0x90, 0x80, 0x4f, 0x81, - 0xc4, 0x97, 0x45, 0x33, 0xe3, 0xa1, 0x93, 0x8a, 0x66, 0x6e, 0x56, 0xec, 0x3a, 0xd5, 0xf9, 0xf9, - 0x1c, 0xdf, 0x6b, 0x5f, 0x2b, 0x2c, 0x90, 0x33, 0x15, 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0x17, 0xb6, 0xda, 0x83, - 0xfc, 0xdb, 0xdb, 0x12, 0x0b, 0x5e, 0x67, 0xc4, 0x1e, 0xf5, 0xa9, 0xa8, 0x41, 0xde, 0xfe, 0x67, - 0x8b, 0x89, 0x08, 0xb0, 0x3b, 0x86, 0x78, 0x72, 0xac, 0xcb, 0xe3, 0x70, 0xa6, 0x52, 0xe8, 0x83, - 0x55, 0xe0, 0xf8, 0x73, 0x5a, 0x9a, 0x3b, 0x70, 0xf1, 0x82, 0x18, 0xec, 0x0e, 0x7e, 0xff, 0xd9, - 0xfb, 0xa7, 0x89, 0xc2, 0x71, 0x36, 0x08, 0x62, 0x93, 0x86, 0xf9, 0x5a, 0x61, 0xb5, 0x56, 0xd8, - 0xf4, 0xfb, 0x65, 0xf0, 0x4f, 0x31, 0x5a, 0x3b, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x23, - 0xa4, 0xbd, 0xea, 0x0c, 0x00, 0x00, + // 773 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x97, 0xcf, 0x6f, 0xd3, 0x30, + 0x14, 0xc7, 0xd5, 0x0b, 0x03, 0x6b, 0x20, 0xb0, 0xc4, 0xc5, 0xe2, 0xc8, 0x65, 0xbf, 0x92, 0xad, + 0x1d, 0x9b, 0x10, 0x02, 0x89, 0x75, 0x5b, 0x98, 0x04, 0x83, 0xb5, 0xd3, 0x0e, 0x1c, 0x98, 0xdc, + 0xf4, 0x35, 0xb5, 0xda, 0xd8, 0x99, 0xfd, 0x32, 0x36, 0x24, 0x24, 0xe0, 0xdf, 0xe0, 0x5f, 0xe5, + 0x80, 0x92, 0x38, 0x2c, 0xed, 0xd6, 0xc6, 0x3d, 0x71, 0x5b, 0xa6, 0xef, 0xc7, 0xdf, 0xaf, 0xdf, + 0x73, 0xfc, 0x52, 0xe2, 0xf1, 0x44, 0xf8, 0x42, 0x22, 0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33, 0xda, 0x6c, 0xc3, 0x55, 0xba, 0xdc, 0xfc, 0x43, 0xc9, 0x52, 0x7b, 0x10, 0x7d, 0x88, 0x62, + 0xa4, 0x86, 0x90, 0x00, 0xf0, 0x0c, 0xb4, 0x11, 0x4a, 0xd2, 0x2d, 0x6f, 0xee, 0xbb, 0x6c, 0x57, + 0xf3, 0xac, 0xfc, 0x48, 0x0e, 0x14, 0x6b, 0xd6, 0x21, 0xc5, 0x39, 0xab, 0x32, 0x74, 0x48, 0x1e, + 0x04, 0x80, 0xef, 0x80, 0x8f, 0x71, 0x48, 0xd7, 0xdd, 0x3c, 0x0b, 0x35, 0xdb, 0x70, 0xb4, 0xb3, + 0x8b, 0x7f, 0x25, 0x8f, 0x02, 0xc0, 0xe3, 0xac, 0xb6, 0x6d, 0x95, 0x4a, 0x34, 0xae, 0x5b, 0xac, + 0x20, 0xce, 0x5b, 0xac, 0xda, 0x20, 0x79, 0x18, 0x00, 0x76, 0x52, 0x59, 0xfe, 0x63, 0xd3, 0xcd, + 0xf7, 0x86, 0x60, 0x5b, 0x8e, 0xb6, 0x15, 0x93, 0x28, 0xef, 0x66, 0x96, 0xa3, 0x93, 0x4a, 0xba, + 0xe1, 0xbe, 0xd5, 0x4e, 0x2a, 0xd9, 0xaa, 0xbb, 0x1f, 0xed, 0x92, 0xfb, 0x65, 0x5d, 0xe9, 0xda, + 0x02, 0x15, 0x65, 0xcc, 0x2b, 0xe6, 0x80, 0x57, 0xce, 0x01, 0xef, 0xbd, 0x30, 0x78, 0xc6, 0xc7, + 0x29, 0xd0, 0x13, 0xb2, 0x64, 0x6b, 0x46, 0x57, 0xdd, 0xab, 0x35, 0x77, 0xc9, 0x2f, 0x79, 0xff, + 0xbb, 0x69, 0x14, 0x81, 0xc9, 0x5f, 0x7e, 0xd7, 0x3e, 0xdc, 0x20, 0x73, 0xd7, 0x0f, 0xc9, 0xe3, + 0x00, 0xf0, 0xa3, 0x8e, 0xb8, 0x14, 0xdf, 0x78, 0xe1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x1f, + 0x07, 0xf9, 0x1c, 0x77, 0xbd, 0x99, 0x6e, 0x08, 0xe7, 0x09, 0x51, 0xc8, 0xf7, 0x39, 0xf2, 0xcd, + 0x06, 0xfd, 0x4e, 0x96, 0x3b, 0x90, 0x3d, 0x5b, 0x5b, 0xc7, 0x82, 0x57, 0x19, 0xb6, 0xeb, 0x3a, + 0x2a, 0x2a, 0x90, 0xb5, 0xff, 0xdd, 0x20, 0x2c, 0x00, 0x6c, 0x0f, 0x21, 0x1c, 0x1d, 0xc9, 0xe2, + 0x38, 0x9c, 0x8a, 0x18, 0xba, 0xa0, 0x05, 0x18, 0xfa, 0xda, 0x2d, 0xcd, 0x0c, 0x9c, 0xbd, 0x71, + 0x0c, 0x36, 0xcb, 0xbe, 0x97, 0x7f, 0x99, 0x1c, 0xe4, 0x5f, 0x4b, 0x74, 0x65, 0x6a, 0x31, 0x9e, + 0x88, 0xdb, 0xe7, 0x30, 0x97, 0xde, 0x9a, 0x9d, 0x93, 0xd2, 0xb2, 0x0d, 0xb9, 0x76, 0xef, 0xd5, + 0xe7, 0x97, 0x91, 0xc0, 0x61, 0xda, 0xf3, 0x42, 0x15, 0xfb, 0x19, 0xe7, 0x97, 0x9c, 0x5f, 0xf7, + 0xd3, 0xab, 0x77, 0x2f, 0xbf, 0xbe, 0x5b, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x8a, 0xd1, 0x2d, + 0x1b, 0xa5, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -113,6 +118,7 @@ type CfgMgmtClient interface { NodeExport(ctx context.Context, in *request.NodeExport, opts ...grpc.CallOption) (CfgMgmt_NodeExportClient, error) ReportExport(ctx context.Context, in *request.ReportExport, opts ...grpc.CallOption) (CfgMgmt_ReportExportClient, error) GetCheckInCountsTimeSeries(ctx context.Context, in *request.CheckInCountsTimeSeries, opts ...grpc.CallOption) (*response.CheckInCountsTimeSeries, error) + GetErrors(ctx context.Context, in *request1.Errors, opts ...grpc.CallOption) (*response1.Errors, error) } type cfgMgmtClient struct { @@ -349,6 +355,15 @@ func (c *cfgMgmtClient) GetCheckInCountsTimeSeries(ctx context.Context, in *requ return out, nil } +func (c *cfgMgmtClient) GetErrors(ctx context.Context, in *request1.Errors, opts ...grpc.CallOption) (*response1.Errors, error) { + out := new(response1.Errors) + err := c.cc.Invoke(ctx, "/chef.automate.domain.cfgmgmt.service.CfgMgmt/GetErrors", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // CfgMgmtServer is the server API for CfgMgmt service. type CfgMgmtServer interface { GetVersion(context.Context, *request.VersionInfo) (*response.VersionInfo, error) @@ -371,6 +386,7 @@ type CfgMgmtServer interface { NodeExport(*request.NodeExport, CfgMgmt_NodeExportServer) error ReportExport(*request.ReportExport, CfgMgmt_ReportExportServer) error GetCheckInCountsTimeSeries(context.Context, *request.CheckInCountsTimeSeries) (*response.CheckInCountsTimeSeries, error) + GetErrors(context.Context, *request1.Errors) (*response1.Errors, error) } // UnimplementedCfgMgmtServer can be embedded to have forward compatible implementations. @@ -437,6 +453,9 @@ func (*UnimplementedCfgMgmtServer) ReportExport(req *request.ReportExport, srv C func (*UnimplementedCfgMgmtServer) GetCheckInCountsTimeSeries(ctx context.Context, req *request.CheckInCountsTimeSeries) (*response.CheckInCountsTimeSeries, error) { return nil, status.Errorf(codes.Unimplemented, "method GetCheckInCountsTimeSeries not implemented") } +func (*UnimplementedCfgMgmtServer) GetErrors(ctx context.Context, req *request1.Errors) (*response1.Errors, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetErrors not implemented") +} func RegisterCfgMgmtServer(s *grpc.Server, srv CfgMgmtServer) { s.RegisterService(&_CfgMgmt_serviceDesc, srv) @@ -808,6 +827,24 @@ func _CfgMgmt_GetCheckInCountsTimeSeries_Handler(srv interface{}, ctx context.Co return interceptor(ctx, in, info, handler) } +func _CfgMgmt_GetErrors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(request1.Errors) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CfgMgmtServer).GetErrors(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/chef.automate.domain.cfgmgmt.service.CfgMgmt/GetErrors", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CfgMgmtServer).GetErrors(ctx, req.(*request1.Errors)) + } + return interceptor(ctx, in, info, handler) +} + var _CfgMgmt_serviceDesc = grpc.ServiceDesc{ ServiceName: "chef.automate.domain.cfgmgmt.service.CfgMgmt", HandlerType: (*CfgMgmtServer)(nil), @@ -884,6 +921,10 @@ var _CfgMgmt_serviceDesc = grpc.ServiceDesc{ MethodName: "GetCheckInCountsTimeSeries", Handler: _CfgMgmt_GetCheckInCountsTimeSeries_Handler, }, + { + MethodName: "GetErrors", + Handler: _CfgMgmt_GetErrors_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/api/interservice/cfgmgmt/service/cfgmgmt.proto b/api/interservice/cfgmgmt/service/cfgmgmt.proto index 605f420d6a1..d7c28a479a0 100644 --- a/api/interservice/cfgmgmt/service/cfgmgmt.proto +++ b/api/interservice/cfgmgmt/service/cfgmgmt.proto @@ -12,6 +12,7 @@ import "api/interservice/cfgmgmt/response/actions.proto"; import "api/interservice/cfgmgmt/response/event.proto"; import "api/interservice/cfgmgmt/response/eventstrings.proto"; import "api/interservice/cfgmgmt/response/inventory_nodes.proto"; +import "api/external/cfgmgmt/response/errors.proto"; import "api/interservice/cfgmgmt/request/root.proto"; import "api/interservice/cfgmgmt/request/stats.proto"; @@ -22,6 +23,7 @@ import "api/interservice/cfgmgmt/request/event.proto"; import "api/interservice/cfgmgmt/request/eventstrings.proto"; import "api/interservice/cfgmgmt/request/inventory_nodes.proto"; import "api/interservice/cfgmgmt/request/node_export.proto"; +import "api/external/cfgmgmt/request/errors.proto"; service CfgMgmt { rpc GetVersion (chef.automate.domain.cfgmgmt.request.VersionInfo) returns (chef.automate.domain.cfgmgmt.response.VersionInfo); @@ -44,4 +46,5 @@ service CfgMgmt { rpc NodeExport(chef.automate.domain.cfgmgmt.request.NodeExport) returns (stream chef.automate.domain.cfgmgmt.response.ExportData); rpc ReportExport(chef.automate.domain.cfgmgmt.request.ReportExport) returns (stream chef.automate.domain.cfgmgmt.response.ReportExportData); rpc GetCheckInCountsTimeSeries(chef.automate.domain.cfgmgmt.request.CheckInCountsTimeSeries) returns (chef.automate.domain.cfgmgmt.response.CheckInCountsTimeSeries); + rpc GetErrors(chef.automate.api.cfgmgmt.request.Errors) returns (chef.automate.api.cfgmgmt.response.Errors); } diff --git a/components/automate-gateway/api/cfgmgmt.pb.swagger.go b/components/automate-gateway/api/cfgmgmt.pb.swagger.go index 67c429600b9..323f9957a28 100644 --- a/components/automate-gateway/api/cfgmgmt.pb.swagger.go +++ b/components/automate-gateway/api/cfgmgmt.pb.swagger.go @@ -14,6 +14,45 @@ func init() { "application/json" ], "paths": { + "/cfgmgmt/errors": { + "get": { + "summary": "GetErrors", + "description": "Returns a list of the most common errors reported for infra nodes' most recent Chef Client runs.\n\nAuthorization Action:\n` + "`" + `` + "`" + `` + "`" + `\ninfra:nodes:list\n` + "`" + `` + "`" + `` + "`" + `", + "operationId": "GetErrors", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/chef.automate.api.cfgmgmt.response.Errors" + } + } + }, + "parameters": [ + { + "name": "size", + "description": "The number of results to return.\nIf set to zero, the default size of 10 will be used. Set to a negative\nvalue for unlimited results.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "filter", + "description": "Filters in the request select the nodes from which the errors are\ncollected. The same filters may be specified for this request as for other\nNodes requests, with the exception of 'status' which is not valid for this\nrequest.", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + } + ], + "tags": [ + "ConfigMgmt" + ] + } + }, "/cfgmgmt/nodes": { "get": { "summary": "GetNodes", @@ -581,6 +620,34 @@ func init() { } } }, + "chef.automate.api.cfgmgmt.response.ErrorCount": { + "type": "object", + "properties": { + "count": { + "type": "integer", + "format": "int32" + }, + "type": { + "type": "string" + }, + "error_message": { + "type": "string" + } + }, + "title": "ErrorCount gives the number of occurrences (count) of the error specified by\nthe type and message among the nodes included by the request parameters" + }, + "chef.automate.api.cfgmgmt.response.Errors": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/definitions/chef.automate.api.cfgmgmt.response.ErrorCount" + } + } + }, + "description": "Errors contains a list of the most common Chef Infra error type/message\ncombinations among nodes in the active project as filtered according to the\nrequest." + }, "chef.automate.api.cfgmgmt.response.ExpandedRunList": { "type": "object", "properties": { diff --git a/components/automate-gateway/handler/cfgmgmt.go b/components/automate-gateway/handler/cfgmgmt.go index 3973af2349a..5a8b49a02bc 100644 --- a/components/automate-gateway/handler/cfgmgmt.go +++ b/components/automate-gateway/handler/cfgmgmt.go @@ -125,6 +125,15 @@ func (s *CfgMgmtServer) GetNodes(ctx context.Context, request *cfgReq.Nodes) (*g return s.cfgMgmtClient.GetNodes(ctx, &nodesRequest) } +func (s *CfgMgmtServer) GetErrors(ctx context.Context, request *cfgReq.Errors) (*cfgRes.Errors, error) { + log.WithFields(log.Fields{ + "request": request.String(), + "func": nameOfFunc(), + }).Debug("rpc call") + + return s.cfgMgmtClient.GetErrors(ctx, request) +} + func (s *CfgMgmtServer) GetAttributes(ctx context.Context, request *cfgReq.Node) (*cfgRes.NodeAttribute, error) { log.WithFields(log.Fields{ "request": request.String(), diff --git a/components/config-mgmt-service/grpcserver/nodes.go b/components/config-mgmt-service/grpcserver/nodes.go index 74b34190c2b..fe5673fa72a 100644 --- a/components/config-mgmt-service/grpcserver/nodes.go +++ b/components/config-mgmt-service/grpcserver/nodes.go @@ -13,6 +13,7 @@ import ( "github.com/golang/protobuf/ptypes/timestamp" log "github.com/sirupsen/logrus" + extReq "github.com/chef/automate/api/external/cfgmgmt/request" externalResp "github.com/chef/automate/api/external/cfgmgmt/response" pRequest "github.com/chef/automate/api/interservice/cfgmgmt/request" interserviceResp "github.com/chef/automate/api/interservice/cfgmgmt/response" @@ -398,3 +399,7 @@ func (s *CfgMgmtServer) nodeExistsAsync(nodeID string, projectFilters map[string return nodeExistsChan } + +func (s *CfgMgmtServer) GetErrors(ctx context.Context, req *extReq.Errors) (*externalResp.Errors, error) { + return nil, nil +} From e651d7ed6df103d79f47afe3290221b9804891d8 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Thu, 19 Mar 2020 15:46:12 -0700 Subject: [PATCH 2/6] Store CCR error class separately in node-state index Signed-off-by: Daniel DeLeo --- .../ingest-service/backend/chef_client_run.go | 1 + components/ingest-service/backend/converge.go | 1 + .../backend/elastic/mappings/node_state.go | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/components/ingest-service/backend/chef_client_run.go b/components/ingest-service/backend/chef_client_run.go index d385222da00..de46df5b724 100644 --- a/components/ingest-service/backend/chef_client_run.go +++ b/components/ingest-service/backend/chef_client_run.go @@ -154,6 +154,7 @@ func (ccr *ChefClientRun) ToNode() (nodeState Node, err error) { if ccr.Status == "failure" { nodeState.ErrorMessage = ccr.Error.Message + nodeState.ErrorType = ccr.Error.Class } } return // nolint:nakedret diff --git a/components/ingest-service/backend/converge.go b/components/ingest-service/backend/converge.go index 965a275720b..050e5d8141b 100644 --- a/components/ingest-service/backend/converge.go +++ b/components/ingest-service/backend/converge.go @@ -40,6 +40,7 @@ type Node struct { DeprecationsCount int `json:"deprecations_count"` Projects []string `json:"projects"` ErrorMessage string `json:"error_message,omitempty"` + ErrorType string `json:"error_type,omitempty"` } // NodeAttribute is the representation of the diff --git a/components/ingest-service/backend/elastic/mappings/node_state.go b/components/ingest-service/backend/elastic/mappings/node_state.go index a69e334d32e..073b150e19d 100644 --- a/components/ingest-service/backend/elastic/mappings/node_state.go +++ b/components/ingest-service/backend/elastic/mappings/node_state.go @@ -159,6 +159,19 @@ var nodeProps = ` } } }, + "error_type": { + "type": "keyword", + "fields": { + "engram" : { + "type": "text", + "analyzer": "autocomplete" + }, + "lower": { + "normalizer": "case_insensitive", + "type": "keyword" + } + } + }, "recipes": { "type": "keyword", "fields": { From 93b3b4bb4a5e3d2eea70000034cdbf4ca8f3b7ca Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Mon, 23 Mar 2020 16:10:55 -0700 Subject: [PATCH 3/6] Implement top errors API Signed-off-by: Daniel DeLeo --- .../config-mgmt-service/backend/client.go | 7 + .../backend/elastic/nodes.go | 123 +++++++++++ .../config-mgmt-service/backend/mock/mock.go | 3 + .../config-mgmt-service/grpcserver/nodes.go | 25 ++- .../integration_test/nodes_test.go | 207 ++++++++++++++++++ 5 files changed, 364 insertions(+), 1 deletion(-) diff --git a/components/config-mgmt-service/backend/client.go b/components/config-mgmt-service/backend/client.go index 39121dfa686..bca7d0176fd 100644 --- a/components/config-mgmt-service/backend/client.go +++ b/components/config-mgmt-service/backend/client.go @@ -65,6 +65,7 @@ type Client interface { GetCheckinCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) GetDeletedCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) GetCreateCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) + GetErrors() ([]*ChefErrorCount, error) } // Types that we consume from the ingest-service @@ -168,3 +169,9 @@ type EventCount struct { Name string `json:"name"` Count int64 `json:"count"` } + +type ChefErrorCount struct { + Type string + Message string + Count int32 +} diff --git a/components/config-mgmt-service/backend/elastic/nodes.go b/components/config-mgmt-service/backend/elastic/nodes.go index e596984260a..4e551b2d154 100644 --- a/components/config-mgmt-service/backend/elastic/nodes.go +++ b/components/config-mgmt-service/backend/elastic/nodes.go @@ -3,7 +3,9 @@ package elastic import ( "context" "encoding/json" + "fmt" "reflect" + "sort" "strings" "time" @@ -295,3 +297,124 @@ func (es Backend) GetAttribute(nodeID string) (backend.NodeAttribute, error) { return nodeAttribute, nil } + +func (es Backend) GetErrors() ([]*backend.ChefErrorCount, error) { + // Return the top 10 most-frequently occurring combinations of Chef Infra + // error type (class) and error message. + // + // Elasticsearch's clustered design makes this query kind of awkward. Though + // this query could be done with a nested terms aggregation, that has some + // accuracy issues when clustered: + // https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#search-aggregations-bucket-terms-aggregation-approximate-counts + // + // One option is to concatenate the fields on ingest into a single field so + // we can do a single term aggregation on that. But that approach is pretty + // ugly and requires some unappealing tradeoffs when we want to fetch/display + // the data. + // + // Contrarily, the composite aggregation matches our use case here more + // closely, but it doesn't provide any helpful ordering and forces you to + // scroll large result sets. So we fetch all pages of the result and sort + // them here. + // + // The curl version of this query is kinda like this: + // curl -X GET "localhost:10141/node-state/_search?pretty" -H 'Content-Type: application/json' -d' + // { + // "size": 10, + // "query": { + // "bool": { + // "must": [ + // { "match": { "status": "failure" } } + // ] + // } + // }, + // "aggs": { + // "group_by_error_type_and_message": { + // "composite": { + // "sources": [ + // { "error_type": {"terms": { "field": "error_type" } } }, + // { "error_message": { "terms": { "field": "error_message" } } } + // ] + // } + // } + // } + // } + // ' + boolQuery := elastic.NewBoolQuery() + boolQuery = boolQuery.Must(elastic.NewTermQuery("status", "failure")) + + agg := elastic.NewCompositeAggregation() + agg.Sources( + elastic.NewCompositeAggregationTermsValuesSource("error_type").Field("error_type"), + elastic.NewCompositeAggregationTermsValuesSource("error_message").Field("error_message"), + ) + agg.Size(1000) + + var allResultsCollected bool + var totalQueriesRan int + chefErrs := []*backend.ChefErrorCount{} + + for !allResultsCollected { + if totalQueriesRan > 10 { + return nil, fmt.Errorf("attempted too many queries to fetch top Chef error counts") + } + + result, err := es.client.Search(). + Query(boolQuery). + Index(IndexNodeState). + Aggregation("group_by_error_type_and_message", agg). + Size(0). + Do(context.Background()) + + if err != nil { + return nil, err + } + + totalQueriesRan++ + + aggs := result.Aggregations + + c, aggFound := aggs.Composite("group_by_error_type_and_message") + if !aggFound { + return nil, fmt.Errorf("elasticsearch result for 'group_by_error_type_and_message' query did not contain the expected aggregation information") + } + + if len(c.AfterKey) == 0 { + allResultsCollected = true + } else { + agg.AggregateAfter(c.AfterKey) + } + + for _, chefErrItem := range c.Buckets { + errorType, ok := chefErrItem.Key["error_type"].(string) + if !ok { + return nil, fmt.Errorf("invalid elasticsearch response for 'group_by_error_type_and_message' aggregation query") + } + errorMessage, ok := chefErrItem.Key["error_message"].(string) + if !ok { + return nil, fmt.Errorf("invalid elasticsearch response for 'group_by_error_type_and_message' aggregation query") + } + + chefErrs = append(chefErrs, &backend.ChefErrorCount{ + Count: int32(chefErrItem.DocCount), + Type: errorType, + Message: errorMessage, + }) + } + } + + sort.Slice(chefErrs, func(i, j int) bool { + if chefErrs[i].Count != chefErrs[j].Count { + // sort more errors first to get descending order + return chefErrs[i].Count > chefErrs[j].Count + } else { + return chefErrs[i].Type < chefErrs[j].Type + } + }) + + if len(chefErrs) > 10 { + chefErrs = chefErrs[:10] + } + + return chefErrs, nil +} diff --git a/components/config-mgmt-service/backend/mock/mock.go b/components/config-mgmt-service/backend/mock/mock.go index 1b7a0d41a08..e324fdf09bc 100644 --- a/components/config-mgmt-service/backend/mock/mock.go +++ b/components/config-mgmt-service/backend/mock/mock.go @@ -190,3 +190,6 @@ func (es Backend) GetDeletedCountsTimeSeries(startTime, endTime time.Time, filters map[string][]string) ([]backend.CountPeroid, error) { return []backend.CountPeroid{}, nil } +func (m Backend) GetErrors() ([]*backend.ChefErrorCount, error) { + return nil, nil +} diff --git a/components/config-mgmt-service/grpcserver/nodes.go b/components/config-mgmt-service/grpcserver/nodes.go index fe5673fa72a..1dea6ae65ff 100644 --- a/components/config-mgmt-service/grpcserver/nodes.go +++ b/components/config-mgmt-service/grpcserver/nodes.go @@ -401,5 +401,28 @@ func (s *CfgMgmtServer) nodeExistsAsync(nodeID string, projectFilters map[string } func (s *CfgMgmtServer) GetErrors(ctx context.Context, req *extReq.Errors) (*externalResp.Errors, error) { - return nil, nil + log.WithFields(log.Fields{ + "request": req, + "func": nameOfFunc(), + }).Debug("rpc call") + + chefErrors, err := s.client.GetErrors() + if err != nil { + return nil, err + } + + res := externalResp.Errors{} + for _, chefErr := range chefErrors { + res.Errors = append( + res.Errors, + &externalResp.ErrorCount{ + Count: chefErr.Count, + Type: chefErr.Type, + ErrorMessage: chefErr.Message, + }, + ) + } + + return &res, nil + } diff --git a/components/config-mgmt-service/integration_test/nodes_test.go b/components/config-mgmt-service/integration_test/nodes_test.go index f0f8dfe556a..249fcdadd96 100644 --- a/components/config-mgmt-service/integration_test/nodes_test.go +++ b/components/config-mgmt-service/integration_test/nodes_test.go @@ -7,15 +7,18 @@ import ( "testing" "time" + apiReq "github.com/chef/automate/api/external/cfgmgmt/request" external_response "github.com/chef/automate/api/external/cfgmgmt/response" "github.com/chef/automate/api/interservice/cfgmgmt/request" authzConstants "github.com/chef/automate/components/authz-service/constants" iBackend "github.com/chef/automate/components/ingest-service/backend" + "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" gp "github.com/golang/protobuf/ptypes/struct" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestNodesReturnsEmptyList(t *testing.T) { @@ -2761,6 +2764,210 @@ func TestNodesMissingRunsLatestRunIDEmpty(t *testing.T) { } } +func TestNodeRunErrors(t *testing.T) { + t.Run("Get errors with zero errors in the database", func(t *testing.T) { + nodes := []iBackend.Node{} + + suite.IngestNodes(nodes) + defer suite.DeleteAllDocuments() + + res, err := cfgmgmt.GetErrors(context.Background(), &apiReq.Errors{}) + require.NoError(t, err) + + assert.Len(t, res.Errors, 0) + }) + + t.Run("Get errors with one error in the database", func(t *testing.T) { + nodeOne := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: "a", + Status: "failure", + EntityUuid: newUUID(), + }, + ErrorMessage: "an example error occurred", + ErrorType: "FuntimeError", + Exists: true, + } + + nodes := []iBackend.Node{nodeOne} + + suite.IngestNodes(nodes) + defer suite.DeleteAllDocuments() + + res, err := cfgmgmt.GetErrors(context.Background(), &apiReq.Errors{}) + require.NoError(t, err) + + require.Len(t, res.Errors, 1) + errInfo := res.Errors[0] + + assert.Equal(t, int32(1), errInfo.Count) + assert.Equal(t, "FuntimeError", errInfo.Type) + assert.Equal(t, "an example error occurred", errInfo.ErrorMessage) + }) + + t.Run("Get errors with several errors in the database", func(t *testing.T) { + nodeOne := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: "one", + Status: "failure", + EntityUuid: newUUID(), + }, + ErrorMessage: "an example error occurred", + ErrorType: "FuntimeError", + Exists: true, + } + nodeTwo := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: "two", + Status: "failure", + EntityUuid: newUUID(), + }, + ErrorMessage: "an example error occurred", + ErrorType: "FuntimeError", + Exists: true, + } + nodeThree := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: "three", + Status: "failure", + EntityUuid: newUUID(), + }, + ErrorMessage: "an different error occurred", + ErrorType: "PuntimeError", + Exists: true, + } + + nodes := []iBackend.Node{nodeOne, nodeTwo, nodeThree} + + suite.IngestNodes(nodes) + defer suite.DeleteAllDocuments() + + res, err := cfgmgmt.GetErrors(context.Background(), &apiReq.Errors{}) + require.NoError(t, err) + + require.Len(t, res.Errors, 2) + errInfo := res.Errors[0] + + assert.Equal(t, int32(2), errInfo.Count) + assert.Equal(t, "FuntimeError", errInfo.Type) + assert.Equal(t, "an example error occurred", errInfo.ErrorMessage) + + errInfoTwo := res.Errors[1] + + assert.Equal(t, int32(1), errInfoTwo.Count) + assert.Equal(t, "PuntimeError", errInfoTwo.Type) + assert.Equal(t, "an different error occurred", errInfoTwo.ErrorMessage) + }) + + t.Run("Get errors with more than 10 error type/message combos in the database", func(t *testing.T) { + var nodes []iBackend.Node + + for i := 1; i < 16; i++ { + for j := 0; j <= (i - 1); j++ { + node := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: fmt.Sprintf("node-group-%d-instance-%d", i, j), + Status: "failure", + EntityUuid: newUUID(), + }, + ErrorMessage: fmt.Sprintf("example-%d error occurred", i), + ErrorType: fmt.Sprintf("FuntimeError%d", i), + Exists: true, + } + nodes = append(nodes, node) + } + } + + suite.IngestNodes(nodes) + defer suite.DeleteAllDocuments() + + res, err := cfgmgmt.GetErrors(context.Background(), &apiReq.Errors{}) + require.NoError(t, err) + + // The 10 top errors are returned + // They are sorted by total count descending + + require.Len(t, res.Errors, 10) + errInfo := res.Errors[0] + + assert.Equal(t, int32(15), errInfo.Count) + assert.Equal(t, "FuntimeError15", errInfo.Type) + assert.Equal(t, "example-15 error occurred", errInfo.ErrorMessage) + + errInfo = res.Errors[1] + + assert.Equal(t, int32(14), errInfo.Count) + assert.Equal(t, "FuntimeError14", errInfo.Type) + assert.Equal(t, "example-14 error occurred", errInfo.ErrorMessage) + + errInfo = res.Errors[9] + + assert.Equal(t, int32(6), errInfo.Count) + assert.Equal(t, "FuntimeError6", errInfo.Type) + assert.Equal(t, "example-6 error occurred", errInfo.ErrorMessage) + }) + + // the request to elasticsearch will have to scroll over different pages when + // there are more than 1000 total buckets of error type+message combination + t.Run("Get errors with more than 1000 error type/message combos in the database", func(t *testing.T) { + var nodes []iBackend.Node + + for i := 1; i < 1101; i++ { + node := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: fmt.Sprintf("node-instance-%d", i), + Status: "failure", + EntityUuid: newUUID(), + }, + ErrorMessage: fmt.Sprintf("example-%d error occurred", i), + ErrorType: fmt.Sprintf("FuntimeError%d", i), + Exists: true, + } + nodes = append(nodes, node) + } + // when i is a multiple of 100, add 1 to its count + for i := 100; i < 1200; i += 100 { + node := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: fmt.Sprintf("node-instance-%d", i), + Status: "failure", + EntityUuid: newUUID(), + }, + ErrorMessage: fmt.Sprintf("example-%d error occurred", i), + ErrorType: fmt.Sprintf("FuntimeError%d", i), + Exists: true, + } + nodes = append(nodes, node) + } + + suite.IngestNodes(nodes) + defer suite.DeleteAllDocuments() + + res, err := cfgmgmt.GetErrors(context.Background(), &apiReq.Errors{}) + require.NoError(t, err) + + require.Len(t, res.Errors, 10) + errInfo := res.Errors[0] + + assert.Equal(t, int32(2), errInfo.Count) + assert.Equal(t, "FuntimeError100", errInfo.Type) + assert.Equal(t, "example-100 error occurred", errInfo.ErrorMessage) + + errInfo = res.Errors[1] + + assert.Equal(t, int32(2), errInfo.Count) + assert.Equal(t, "FuntimeError1000", errInfo.Type) + assert.Equal(t, "example-1000 error occurred", errInfo.ErrorMessage) + + errInfo = res.Errors[9] + + assert.Equal(t, int32(2), errInfo.Count) + assert.Equal(t, "FuntimeError800", errInfo.Type) + assert.Equal(t, "example-800 error occurred", errInfo.ErrorMessage) + }) + +} + func ingestNodeArrayToMessageArray(nodes []iBackend.Node, hasRunsData bool) []proto.Message { messages := make([]proto.Message, len(nodes)) for i, node := range nodes { From bcdcac0f710261ebc15c7131f98c5395d8b3f2e7 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Tue, 24 Mar 2020 14:06:35 -0700 Subject: [PATCH 4/6] Implement filtering for top errors API Signed-off-by: Daniel DeLeo --- .../config-mgmt-service/backend/client.go | 2 +- .../backend/elastic/nodes.go | 12 +- .../config-mgmt-service/backend/mock/mock.go | 3 +- .../config-mgmt-service/grpcserver/nodes.go | 17 ++- .../integration_test/nodes_test.go | 125 +++++++++++++++++- 5 files changed, 148 insertions(+), 11 deletions(-) diff --git a/components/config-mgmt-service/backend/client.go b/components/config-mgmt-service/backend/client.go index bca7d0176fd..c602c63105b 100644 --- a/components/config-mgmt-service/backend/client.go +++ b/components/config-mgmt-service/backend/client.go @@ -65,7 +65,7 @@ type Client interface { GetCheckinCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) GetDeletedCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) GetCreateCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) - GetErrors() ([]*ChefErrorCount, error) + GetErrors(map[string][]string) ([]*ChefErrorCount, error) } // Types that we consume from the ingest-service diff --git a/components/config-mgmt-service/backend/elastic/nodes.go b/components/config-mgmt-service/backend/elastic/nodes.go index 4e551b2d154..713f76544eb 100644 --- a/components/config-mgmt-service/backend/elastic/nodes.go +++ b/components/config-mgmt-service/backend/elastic/nodes.go @@ -298,7 +298,7 @@ func (es Backend) GetAttribute(nodeID string) (backend.NodeAttribute, error) { return nodeAttribute, nil } -func (es Backend) GetErrors() ([]*backend.ChefErrorCount, error) { +func (es Backend) GetErrors(filters map[string][]string) ([]*backend.ChefErrorCount, error) { // Return the top 10 most-frequently occurring combinations of Chef Infra // error type (class) and error message. // @@ -340,8 +340,8 @@ func (es Backend) GetErrors() ([]*backend.ChefErrorCount, error) { // } // } // ' - boolQuery := elastic.NewBoolQuery() - boolQuery = boolQuery.Must(elastic.NewTermQuery("status", "failure")) + queryWithFilters := newBoolQueryFromFilters(filters) + queryWithFilters.Must(elastic.NewTermQuery("status", "failure")) agg := elastic.NewCompositeAggregation() agg.Sources( @@ -355,12 +355,14 @@ func (es Backend) GetErrors() ([]*backend.ChefErrorCount, error) { chefErrs := []*backend.ChefErrorCount{} for !allResultsCollected { - if totalQueriesRan > 10 { + // Don't hammer elastic too bad if there is a bug or other unforeseen + // condition. + if totalQueriesRan > 50 { return nil, fmt.Errorf("attempted too many queries to fetch top Chef error counts") } result, err := es.client.Search(). - Query(boolQuery). + Query(queryWithFilters). Index(IndexNodeState). Aggregation("group_by_error_type_and_message", agg). Size(0). diff --git a/components/config-mgmt-service/backend/mock/mock.go b/components/config-mgmt-service/backend/mock/mock.go index e324fdf09bc..09a128c8197 100644 --- a/components/config-mgmt-service/backend/mock/mock.go +++ b/components/config-mgmt-service/backend/mock/mock.go @@ -190,6 +190,7 @@ func (es Backend) GetDeletedCountsTimeSeries(startTime, endTime time.Time, filters map[string][]string) ([]backend.CountPeroid, error) { return []backend.CountPeroid{}, nil } -func (m Backend) GetErrors() ([]*backend.ChefErrorCount, error) { + +func (m Backend) GetErrors(map[string][]string) ([]*backend.ChefErrorCount, error) { return nil, nil } diff --git a/components/config-mgmt-service/grpcserver/nodes.go b/components/config-mgmt-service/grpcserver/nodes.go index 1dea6ae65ff..7ee34baa8fc 100644 --- a/components/config-mgmt-service/grpcserver/nodes.go +++ b/components/config-mgmt-service/grpcserver/nodes.go @@ -406,7 +406,22 @@ func (s *CfgMgmtServer) GetErrors(ctx context.Context, req *extReq.Errors) (*ext "func": nameOfFunc(), }).Debug("rpc call") - chefErrors, err := s.client.GetErrors() + filters, err := stringutils.FormatFiltersWithKeyConverter(req.Filter, + params.ConvertParamToNodeStateBackendLowerFilter) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, err.Error()) + } + + filters, err = filterByProjects(ctx, filters) + if err != nil { + return nil, status.Errorf(codes.Internal, err.Error()) + } + + if _, filterRequested := filters["status"]; filterRequested { + return nil, status.Errorf(codes.InvalidArgument, "Cannot filter GetErrors request by 'status'") + } + + chefErrors, err := s.client.GetErrors(filters) if err != nil { return nil, err } diff --git a/components/config-mgmt-service/integration_test/nodes_test.go b/components/config-mgmt-service/integration_test/nodes_test.go index 249fcdadd96..be7507681cb 100644 --- a/components/config-mgmt-service/integration_test/nodes_test.go +++ b/components/config-mgmt-service/integration_test/nodes_test.go @@ -2947,25 +2947,144 @@ func TestNodeRunErrors(t *testing.T) { require.NoError(t, err) require.Len(t, res.Errors, 10) - errInfo := res.Errors[0] + // Sorting: error counts are first sorted on number of occurrences, then + // lexically on error type as a string. Shorter strings sort before longer + // ones. So you get: + // FuntimeError100, FuntimeError1000, FuntimeError200, .. FuntimeError800 + // and FuntimeError900 is omitted because it's the 11th item. + + errInfo := res.Errors[0] assert.Equal(t, int32(2), errInfo.Count) assert.Equal(t, "FuntimeError100", errInfo.Type) assert.Equal(t, "example-100 error occurred", errInfo.ErrorMessage) errInfo = res.Errors[1] - assert.Equal(t, int32(2), errInfo.Count) assert.Equal(t, "FuntimeError1000", errInfo.Type) assert.Equal(t, "example-1000 error occurred", errInfo.ErrorMessage) errInfo = res.Errors[9] - assert.Equal(t, int32(2), errInfo.Count) assert.Equal(t, "FuntimeError800", errInfo.Type) assert.Equal(t, "example-800 error occurred", errInfo.ErrorMessage) }) + // Errors are only collected from nodes when the most recent run has status + // failure. So you can't filter them on status. + t.Run("Get errors with invalid filters returns error", func(t *testing.T) { + var req apiReq.Errors + + req.Filter = []string{"status:success"} + _, err := cfgmgmt.GetErrors(context.Background(), &req) + require.Error(t, err) + + req.Filter = []string{"status:aliens"} + _, err = cfgmgmt.GetErrors(context.Background(), &req) + require.Error(t, err) + }) + + // node filters (other than 'status') should work + t.Run("Get errors with filters", func(t *testing.T) { + nodeOne := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: "a", + Status: "failure", + EntityUuid: newUUID(), + Platform: "ubuntu", + OrganizationName: "org1", + }, + ErrorMessage: "an example error occurred", + ErrorType: "NodeAError", + Exists: true, + } + + nodeTwo := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: "b", + Status: "failure", + EntityUuid: newUUID(), + Platform: "centos", + OrganizationName: "org1", + }, + ErrorMessage: "an example error occurred", + ErrorType: "NodeBError", + Exists: true, + } + + nodes := []iBackend.Node{nodeOne, nodeTwo} + + suite.IngestNodes(nodes) + defer suite.DeleteAllDocuments() + + var req apiReq.Errors + + req.Filter = []string{"name:a"} + res, err := cfgmgmt.GetErrors(context.Background(), &req) + require.NoError(t, err) + require.Len(t, res.Errors, 1) + assert.Equal(t, "NodeAError", res.Errors[0].Type) + + req.Filter = []string{"name:b"} + res, err = cfgmgmt.GetErrors(context.Background(), &req) + require.NoError(t, err) + require.Len(t, res.Errors, 1) + assert.Equal(t, "NodeBError", res.Errors[0].Type) + + req.Filter = []string{"organization:org1"} + res, err = cfgmgmt.GetErrors(context.Background(), &req) + require.NoError(t, err) + require.Len(t, res.Errors, 2) + assert.Equal(t, "NodeAError", res.Errors[0].Type) + assert.Equal(t, "NodeBError", res.Errors[1].Type) + + req.Filter = []string{"organization:org2"} + res, err = cfgmgmt.GetErrors(context.Background(), &req) + require.NoError(t, err) + require.Len(t, res.Errors, 0) + + req.Filter = []string{"platform:centos"} + res, err = cfgmgmt.GetErrors(context.Background(), &req) + require.NoError(t, err) + require.Len(t, res.Errors, 1) + assert.Equal(t, "NodeBError", res.Errors[0].Type) + + }) + + t.Run("Get errors with project filters", func(t *testing.T) { + nodeOne := iBackend.Node{ + NodeInfo: iBackend.NodeInfo{ + NodeName: "a", + Status: "failure", + EntityUuid: newUUID(), + }, + ErrorMessage: "an example error occurred", + ErrorType: "FuntimeError", + Exists: true, + Projects: []string{"projectOne"}, + } + + nodes := []iBackend.Node{nodeOne} + + suite.IngestNodes(nodes) + defer suite.DeleteAllDocuments() + + ctx := contextWithProjects([]string{"projectOne"}) + res, err := cfgmgmt.GetErrors(ctx, &apiReq.Errors{}) + require.NoError(t, err) + assert.Len(t, res.Errors, 1) + + ctx = contextWithProjects([]string{"projectOne", "projectTwo"}) + res, err = cfgmgmt.GetErrors(ctx, &apiReq.Errors{}) + require.NoError(t, err) + assert.Len(t, res.Errors, 1) + + ctx = contextWithProjects([]string{"projectNOPE", "projectTwo"}) + res, err = cfgmgmt.GetErrors(ctx, &apiReq.Errors{}) + require.NoError(t, err) + assert.Len(t, res.Errors, 0) // filtered out + }) + } func ingestNodeArrayToMessageArray(nodes []iBackend.Node, hasRunsData bool) []proto.Message { From 563e6bba6508311d71c26fc0bd5ba0e715cdfa49 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Tue, 24 Mar 2020 15:04:33 -0700 Subject: [PATCH 5/6] implement size option for get errors API Signed-off-by: Daniel DeLeo --- components/config-mgmt-service/backend/client.go | 2 +- .../config-mgmt-service/backend/elastic/nodes.go | 10 +++++++--- .../config-mgmt-service/backend/mock/mock.go | 2 +- .../config-mgmt-service/grpcserver/nodes.go | 2 +- .../integration_test/nodes_test.go | 15 +++++++++++++++ 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/components/config-mgmt-service/backend/client.go b/components/config-mgmt-service/backend/client.go index c602c63105b..b12da488f34 100644 --- a/components/config-mgmt-service/backend/client.go +++ b/components/config-mgmt-service/backend/client.go @@ -65,7 +65,7 @@ type Client interface { GetCheckinCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) GetDeletedCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) GetCreateCountsTimeSeries(time.Time, time.Time, map[string][]string) ([]CountPeroid, error) - GetErrors(map[string][]string) ([]*ChefErrorCount, error) + GetErrors(int32, map[string][]string) ([]*ChefErrorCount, error) } // Types that we consume from the ingest-service diff --git a/components/config-mgmt-service/backend/elastic/nodes.go b/components/config-mgmt-service/backend/elastic/nodes.go index 713f76544eb..88cd9f1ed7d 100644 --- a/components/config-mgmt-service/backend/elastic/nodes.go +++ b/components/config-mgmt-service/backend/elastic/nodes.go @@ -298,7 +298,7 @@ func (es Backend) GetAttribute(nodeID string) (backend.NodeAttribute, error) { return nodeAttribute, nil } -func (es Backend) GetErrors(filters map[string][]string) ([]*backend.ChefErrorCount, error) { +func (es Backend) GetErrors(size int32, filters map[string][]string) ([]*backend.ChefErrorCount, error) { // Return the top 10 most-frequently occurring combinations of Chef Infra // error type (class) and error message. // @@ -414,8 +414,12 @@ func (es Backend) GetErrors(filters map[string][]string) ([]*backend.ChefErrorCo } }) - if len(chefErrs) > 10 { - chefErrs = chefErrs[:10] + if size == 0 { + size = 10 + } + + if size > 0 && int32(len(chefErrs)) > size { + chefErrs = chefErrs[:size] } return chefErrs, nil diff --git a/components/config-mgmt-service/backend/mock/mock.go b/components/config-mgmt-service/backend/mock/mock.go index 09a128c8197..eb91d1959ad 100644 --- a/components/config-mgmt-service/backend/mock/mock.go +++ b/components/config-mgmt-service/backend/mock/mock.go @@ -191,6 +191,6 @@ func (es Backend) GetDeletedCountsTimeSeries(startTime, endTime time.Time, return []backend.CountPeroid{}, nil } -func (m Backend) GetErrors(map[string][]string) ([]*backend.ChefErrorCount, error) { +func (m Backend) GetErrors(int32, map[string][]string) ([]*backend.ChefErrorCount, error) { return nil, nil } diff --git a/components/config-mgmt-service/grpcserver/nodes.go b/components/config-mgmt-service/grpcserver/nodes.go index 7ee34baa8fc..0c33d1254f8 100644 --- a/components/config-mgmt-service/grpcserver/nodes.go +++ b/components/config-mgmt-service/grpcserver/nodes.go @@ -421,7 +421,7 @@ func (s *CfgMgmtServer) GetErrors(ctx context.Context, req *extReq.Errors) (*ext return nil, status.Errorf(codes.InvalidArgument, "Cannot filter GetErrors request by 'status'") } - chefErrors, err := s.client.GetErrors(filters) + chefErrors, err := s.client.GetErrors(req.Size, filters) if err != nil { return nil, err } diff --git a/components/config-mgmt-service/integration_test/nodes_test.go b/components/config-mgmt-service/integration_test/nodes_test.go index be7507681cb..55d642aa8dc 100644 --- a/components/config-mgmt-service/integration_test/nodes_test.go +++ b/components/config-mgmt-service/integration_test/nodes_test.go @@ -2905,6 +2905,21 @@ func TestNodeRunErrors(t *testing.T) { assert.Equal(t, int32(6), errInfo.Count) assert.Equal(t, "FuntimeError6", errInfo.Type) assert.Equal(t, "example-6 error occurred", errInfo.ErrorMessage) + + // With a Size of 1, we should get one: + + resExpectOne, err := cfgmgmt.GetErrors(context.Background(), &apiReq.Errors{Size: 1}) + require.NoError(t, err) + assert.Len(t, resExpectOne.Errors, 1) + assert.Equal(t, "FuntimeError15", resExpectOne.Errors[0].Type) + + // With a Size of -1, we should get all: + + resExpectAll, err := cfgmgmt.GetErrors(context.Background(), &apiReq.Errors{Size: -1}) + require.NoError(t, err) + require.Len(t, resExpectAll.Errors, 15) + assert.Equal(t, "FuntimeError15", resExpectAll.Errors[0].Type) + assert.Equal(t, "FuntimeError1", resExpectAll.Errors[14].Type) }) // the request to elasticsearch will have to scroll over different pages when From 677d82d92e53d33dd9a12065f06421521d51b767 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Tue, 24 Mar 2020 15:09:45 -0700 Subject: [PATCH 6/6] Update bldr config Signed-off-by: Daniel DeLeo --- .bldr.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bldr.toml b/.bldr.toml index 85435c9330b..585bbaf9a6c 100644 --- a/.bldr.toml +++ b/.bldr.toml @@ -810,6 +810,7 @@ paths = [ "api/config/ui/*", "api/config/workflow_nginx/*", "api/config/workflow_server/*", + "api/external/cfgmgmt/*", "api/external/common/*", "api/external/ingest/*", "api/interservice/authn/*", @@ -1781,6 +1782,7 @@ paths = [ "components/data-feed-service/*", "api/config/platform/*", "api/config/shared/*", + "api/external/cfgmgmt/*", "api/external/common/*", "api/external/data_feed/*", "api/external/secrets/*",