diff --git a/.changelog/10717.txt b/.changelog/10717.txt new file mode 100644 index 0000000000..ee333bc930 --- /dev/null +++ b/.changelog/10717.txt @@ -0,0 +1,3 @@ +```release-note:improvement +checks: Add Interval and Timeout to API response. +``` diff --git a/agent/agent_endpoint_test.go b/agent/agent_endpoint_test.go index 9f2e4870f4..cc11dd9ec9 100644 --- a/agent/agent_endpoint_test.go +++ b/agent/agent_endpoint_test.go @@ -680,10 +680,12 @@ func TestAgent_Checks(t *testing.T) { testrpc.WaitForTestAgent(t, a.RPC, "dc1") chk1 := &structs.HealthCheck{ - Node: a.Config.NodeName, - CheckID: "mysql", - Name: "mysql", - Status: api.HealthPassing, + Node: a.Config.NodeName, + CheckID: "mysql", + Name: "mysql", + Interval: "30s", + Timeout: "5s", + Status: api.HealthPassing, } a.State.AddCheck(chk1, "") @@ -699,6 +701,15 @@ func TestAgent_Checks(t *testing.T) { if val["mysql"].Status != api.HealthPassing { t.Fatalf("bad check: %v", obj) } + if val["mysql"].Node != chk1.Node { + t.Fatalf("bad check: %v", obj) + } + if val["mysql"].Interval != chk1.Interval { + t.Fatalf("bad check: %v", obj) + } + if val["mysql"].Timeout != chk1.Timeout { + t.Fatalf("bad check: %v", obj) + } } func TestAgent_ChecksWithFilter(t *testing.T) { diff --git a/agent/agent_test.go b/agent/agent_test.go index c07b20097f..926c233232 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -2636,6 +2636,7 @@ func TestAgent_PurgeCheckOnDuplicate(t *testing.T) { notes = "my cool notes" args = ["/bin/check-redis.py"] interval = "30s" + timeout = "5s" } `}) defer a2.Shutdown() @@ -2652,6 +2653,8 @@ func TestAgent_PurgeCheckOnDuplicate(t *testing.T) { Name: "memory check", Status: api.HealthCritical, Notes: "my cool notes", + Interval: "30s", + Timeout: "5s", EnterpriseMeta: *structs.DefaultEnterpriseMetaInDefaultPartition(), } require.Equal(t, expected, result) diff --git a/agent/structs/check_definition.go b/agent/structs/check_definition.go index 9262ef01fe..cfac67d13c 100644 --- a/agent/structs/check_definition.go +++ b/agent/structs/check_definition.go @@ -156,6 +156,8 @@ func (c *CheckDefinition) HealthCheck(node string) *HealthCheck { Status: api.HealthCritical, Notes: c.Notes, ServiceID: c.ServiceID, + Interval: c.Interval.String(), + Timeout: c.Timeout.String(), EnterpriseMeta: c.EnterpriseMeta, } if c.Status != "" { diff --git a/agent/structs/structs.go b/agent/structs/structs.go index 0928758173..d598385f54 100644 --- a/agent/structs/structs.go +++ b/agent/structs/structs.go @@ -1478,6 +1478,9 @@ type HealthCheck struct { ServiceTags []string // optional service tags Type string // Check type: http/ttl/tcp/etc + Interval string // from definition + Timeout string // from definition + // ExposedPort is the port of the exposed Envoy listener representing the // HTTP or GRPC health check of the service. ExposedPort int diff --git a/agent/structs/structs_filtering_test.go b/agent/structs/structs_filtering_test.go index b7e38fd408..10a9ab1a72 100644 --- a/agent/structs/structs_filtering_test.go +++ b/agent/structs/structs_filtering_test.go @@ -555,6 +555,19 @@ var expectedFieldConfigHealthCheck bexpr.FieldConfigurations = bexpr.FieldConfig SupportedOperations: []bexpr.MatchOperator{bexpr.MatchEqual, bexpr.MatchNotEqual, bexpr.MatchIn, bexpr.MatchNotIn, bexpr.MatchMatches, bexpr.MatchNotMatches}, StructFieldName: "Type", }, + + "Interval": &bexpr.FieldConfiguration{ + CoerceFn: bexpr.CoerceString, + SupportedOperations: []bexpr.MatchOperator{bexpr.MatchEqual, bexpr.MatchNotEqual, bexpr.MatchIn, bexpr.MatchNotIn, bexpr.MatchMatches, bexpr.MatchNotMatches}, + StructFieldName: "Interval", + }, + + "Timeout": &bexpr.FieldConfiguration{ + CoerceFn: bexpr.CoerceString, + SupportedOperations: []bexpr.MatchOperator{bexpr.MatchEqual, bexpr.MatchNotEqual, bexpr.MatchIn, bexpr.MatchNotIn, bexpr.MatchMatches, bexpr.MatchNotMatches}, + StructFieldName: "Timeout", + }, + "ExposedPort": &bexpr.FieldConfiguration{ CoerceFn: bexpr.CoerceInt, SupportedOperations: []bexpr.MatchOperator{bexpr.MatchEqual, bexpr.MatchNotEqual}, diff --git a/proto/pbservice/healthcheck.gen.go b/proto/pbservice/healthcheck.gen.go index d9e4fa7af2..ee7f142e7c 100644 --- a/proto/pbservice/healthcheck.gen.go +++ b/proto/pbservice/healthcheck.gen.go @@ -84,6 +84,8 @@ func HealthCheckToStructs(s HealthCheck) structs.HealthCheck { t.Definition = HealthCheckDefinitionToStructs(s.Definition) t.EnterpriseMeta = EnterpriseMetaToStructs(s.EnterpriseMeta) t.RaftIndex = RaftIndexToStructs(s.RaftIndex) + t.Interval = s.Interval + t.Timeout = s.Timeout return t } func NewHealthCheckFromStructs(t structs.HealthCheck) HealthCheck { @@ -102,6 +104,8 @@ func NewHealthCheckFromStructs(t structs.HealthCheck) HealthCheck { s.Definition = NewHealthCheckDefinitionFromStructs(t.Definition) s.EnterpriseMeta = NewEnterpriseMetaFromStructs(t.EnterpriseMeta) s.RaftIndex = NewRaftIndexFromStructs(t.RaftIndex) + s.Interval = t.Interval + s.Timeout = t.Timeout return s } func HealthCheckDefinitionToStructs(s HealthCheckDefinition) structs.HealthCheckDefinition { diff --git a/proto/pbservice/healthcheck.pb.go b/proto/pbservice/healthcheck.pb.go index 8f419b8f62..1329e501f8 100644 --- a/proto/pbservice/healthcheck.pb.go +++ b/proto/pbservice/healthcheck.pb.go @@ -53,7 +53,9 @@ type HealthCheck struct { // mog: func-to=EnterpriseMetaToStructs func-from=NewEnterpriseMetaFromStructs EnterpriseMeta pbcommon.EnterpriseMeta `protobuf:"bytes,13,opt,name=EnterpriseMeta,proto3" json:"EnterpriseMeta"` // mog: func-to=int func-from=int32 - ExposedPort int32 `protobuf:"varint,14,opt,name=ExposedPort,proto3" json:"ExposedPort,omitempty"` + ExposedPort int32 `protobuf:"varint,14,opt,name=ExposedPort,proto3" json:"ExposedPort,omitempty"` + Interval string `protobuf:"bytes,15,opt,name=Interval,proto3" json:"Interval,omitempty"` + Timeout string `protobuf:"bytes,16,opt,name=Timeout,proto3" json:"Timeout,omitempty"` } func (m *HealthCheck) Reset() { *m = HealthCheck{} } @@ -287,73 +289,74 @@ func init() { func init() { proto.RegisterFile("proto/pbservice/healthcheck.proto", fileDescriptor_8a6f7448747c9fbe) } var fileDescriptor_8a6f7448747c9fbe = []byte{ - // 1051 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x52, 0xe3, 0x46, - 0x17, 0xb5, 0x30, 0x3f, 0x56, 0x1b, 0x18, 0xe8, 0x61, 0xf8, 0x7a, 0x98, 0x29, 0xe1, 0x8f, 0x64, - 0x41, 0x2a, 0x44, 0xae, 0x22, 0x95, 0x54, 0x92, 0xaa, 0x24, 0x85, 0x31, 0x03, 0x4e, 0x01, 0x71, - 0x64, 0x65, 0x16, 0xd9, 0x09, 0xb9, 0x6d, 0xab, 0x2c, 0xab, 0x55, 0xad, 0x16, 0x85, 0xf3, 0x14, - 0xb3, 0x9c, 0x17, 0xc8, 0x2a, 0x2f, 0xc2, 0x92, 0x65, 0x56, 0x24, 0x81, 0xb7, 0xc8, 0x2a, 0xd5, - 0xb7, 0x25, 0x23, 0x8f, 0x35, 0xb1, 0x33, 0x35, 0x59, 0xd1, 0xf7, 0xdc, 0x7b, 0xbb, 0xd5, 0x7d, - 0xcf, 0x39, 0x06, 0xfd, 0x3f, 0xe4, 0x4c, 0xb0, 0x6a, 0x78, 0x11, 0x51, 0x7e, 0xe9, 0xb9, 0xb4, - 0xda, 0xa3, 0x8e, 0x2f, 0x7a, 0x6e, 0x8f, 0xba, 0x7d, 0x13, 0x72, 0x58, 0x1f, 0x25, 0xb7, 0x8c, - 0x2e, 0x63, 0x5d, 0x9f, 0x56, 0x21, 0x71, 0x11, 0x77, 0xaa, 0xed, 0x98, 0x3b, 0xc2, 0x63, 0x81, - 0x2a, 0xdd, 0x7a, 0x96, 0xee, 0xe6, 0xb2, 0xc1, 0x80, 0x05, 0x55, 0xf5, 0x27, 0x49, 0x6e, 0x74, - 0x59, 0x97, 0xa9, 0x02, 0xb9, 0x52, 0xe8, 0xce, 0x2f, 0xf3, 0xa8, 0x7c, 0x02, 0x67, 0x1e, 0xca, - 0x33, 0x31, 0x46, 0xf3, 0xe7, 0xac, 0x4d, 0x89, 0x56, 0xd1, 0x76, 0x75, 0x0b, 0xd6, 0xf8, 0x18, - 0x2d, 0x41, 0xb2, 0x51, 0x27, 0x73, 0x12, 0xae, 0x7d, 0xf2, 0xd7, 0xed, 0xf6, 0x47, 0x5d, 0x4f, - 0xf4, 0xe2, 0x0b, 0xd3, 0x65, 0x83, 0x6a, 0xcf, 0x89, 0x7a, 0x9e, 0xcb, 0x78, 0x58, 0x75, 0x59, - 0x10, 0xc5, 0x7e, 0x55, 0x0c, 0x43, 0x1a, 0x99, 0x49, 0x93, 0x95, 0x76, 0xc3, 0xe6, 0xce, 0x80, - 0x92, 0x62, 0xb2, 0xb9, 0x33, 0xa0, 0x78, 0x13, 0x2d, 0xb6, 0x84, 0x23, 0xe2, 0x88, 0xcc, 0x03, - 0x9a, 0x44, 0x78, 0x03, 0x2d, 0x9c, 0x33, 0x41, 0x23, 0xb2, 0x00, 0xb0, 0x0a, 0x64, 0xf5, 0xf7, - 0xb1, 0x08, 0x63, 0x41, 0x16, 0x55, 0xb5, 0x8a, 0xf0, 0x73, 0xa4, 0xb7, 0xd4, 0x23, 0x35, 0xea, - 0x64, 0x09, 0x52, 0x0f, 0x00, 0xae, 0xa0, 0x72, 0x12, 0xc0, 0xf1, 0x25, 0xc8, 0x67, 0xa1, 0x4c, - 0x85, 0xed, 0x74, 0x23, 0xa2, 0x57, 0x8a, 0x99, 0x0a, 0x09, 0xc9, 0x6f, 0xb7, 0x87, 0x21, 0x25, - 0xcb, 0xea, 0xdb, 0xe5, 0x1a, 0xbf, 0x40, 0xa8, 0x4e, 0x3b, 0x5e, 0xe0, 0xc9, 0x19, 0x10, 0x54, - 0xd1, 0x76, 0xcb, 0x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0x13, 0x4a, 0x99, 0xb0, 0xf0, 0x67, 0x33, 0x59, 0xf8, 0x5a, - 0x9e, 0x85, 0x67, 0x1c, 0x6d, 0xfd, 0x1d, 0x1c, 0x2d, 0x91, 0x1c, 0xfe, 0x77, 0x92, 0xc3, 0xfb, - 0x68, 0xa3, 0x15, 0xbb, 0x2e, 0x8d, 0xa2, 0x1a, 0xed, 0x30, 0x4e, 0x9b, 0x4e, 0x14, 0x79, 0x41, - 0x97, 0x3c, 0x81, 0x9f, 0xc0, 0xdc, 0x1c, 0xfe, 0x1c, 0x6d, 0xbe, 0x70, 0x3c, 0x3f, 0xe6, 0x34, - 0x49, 0xa4, 0xae, 0x47, 0x36, 0xa1, 0xeb, 0x2d, 0x59, 0x39, 0xff, 0x26, 0x67, 0x57, 0x43, 0xe0, - 0xf5, 0xff, 0xd4, 0xfc, 0x47, 0xc0, 0x28, 0x0b, 0x43, 0x20, 0x99, 0x2c, 0x4c, 0x62, 0xba, 0x61, - 0x3f, 0x7e, 0x7f, 0x86, 0x3d, 0xf1, 0x13, 0xf4, 0x14, 0xee, 0x35, 0x0e, 0xfe, 0x07, 0x6e, 0x55, - 0x3b, 0xbb, 0xfe, 0xd3, 0x28, 0x5c, 0xdf, 0x19, 0xda, 0xcd, 0x9d, 0xa1, 0xfd, 0x71, 0x67, 0x68, - 0xaf, 0xee, 0x8d, 0xc2, 0xeb, 0x7b, 0xa3, 0x70, 0x73, 0x6f, 0x14, 0x7e, 0xbb, 0x37, 0x0a, 0x3f, - 0x7d, 0xfc, 0x4f, 0x66, 0xf5, 0xc6, 0x3f, 0xd3, 0x17, 0x8b, 0x00, 0x7c, 0xfa, 0x77, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x9d, 0xa1, 0x76, 0xfc, 0x66, 0x0b, 0x00, 0x00, + // 1062 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x41, 0x4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c4, 0xae, + 0x4b, 0xa3, 0xa8, 0x41, 0x7b, 0x8c, 0xd3, 0xb6, 0x13, 0x45, 0x5e, 0xd0, 0x27, 0x8f, 0xe1, 0x87, + 0x33, 0x37, 0x87, 0xbf, 0x40, 0x6b, 0x2f, 0x1c, 0xcf, 0x8f, 0x39, 0x4d, 0x12, 0xa9, 0xeb, 0x91, + 0x35, 0xe8, 0x7a, 0x4b, 0x56, 0xce, 0xbf, 0xcd, 0xd9, 0xc5, 0x08, 0x78, 0xfd, 0x81, 0x9a, 0xff, + 0x18, 0x18, 0x67, 0x61, 0x08, 0x24, 0x93, 0x85, 0x49, 0xdc, 0x6f, 0xd8, 0x8f, 0xde, 0x9f, 0x61, + 0x4f, 0xfd, 0x04, 0x3d, 0x81, 0x7b, 0x4d, 0x82, 0xff, 0x83, 0x5b, 0x35, 0x8e, 0x2f, 0xff, 0x32, + 0x0a, 0x97, 0x37, 0x86, 0x76, 0x75, 0x63, 0x68, 0x7f, 0xde, 0x18, 0xda, 0xab, 0x5b, 0xa3, 0xf0, + 0xfa, 0xd6, 0x28, 0x5c, 0xdd, 0x1a, 0x85, 0xdf, 0x6e, 0x8d, 0xc2, 0xcf, 0x9f, 0xfc, 0x9b, 0x59, + 0xbd, 0xf1, 0x2f, 0xf8, 0x69, 0x09, 0x80, 0xcf, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xce, 0x2e, + 0x2d, 0x41, 0x9c, 0x0b, 0x00, 0x00, } func (m *HealthCheck) Marshal() (dAtA []byte, err error) { @@ -376,6 +379,22 @@ func (m *HealthCheck) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Timeout) > 0 { + i -= len(m.Timeout) + copy(dAtA[i:], m.Timeout) + i = encodeVarintHealthcheck(dAtA, i, uint64(len(m.Timeout))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if len(m.Interval) > 0 { + i -= len(m.Interval) + copy(dAtA[i:], m.Interval) + i = encodeVarintHealthcheck(dAtA, i, uint64(len(m.Interval))) + i-- + dAtA[i] = 0x7a + } if m.ExposedPort != 0 { i = encodeVarintHealthcheck(dAtA, i, uint64(m.ExposedPort)) i-- @@ -1054,6 +1073,14 @@ func (m *HealthCheck) Size() (n int) { if m.ExposedPort != 0 { n += 1 + sovHealthcheck(uint64(m.ExposedPort)) } + l = len(m.Interval) + if l > 0 { + n += 1 + l + sovHealthcheck(uint64(l)) + } + l = len(m.Timeout) + if l > 0 { + n += 2 + l + sovHealthcheck(uint64(l)) + } return n } @@ -1745,6 +1772,70 @@ func (m *HealthCheck) Unmarshal(dAtA []byte) error { break } } + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Interval", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthcheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthcheck + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHealthcheck + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Interval = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHealthcheck + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthHealthcheck + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHealthcheck + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Timeout = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipHealthcheck(dAtA[iNdEx:]) diff --git a/proto/pbservice/healthcheck.proto b/proto/pbservice/healthcheck.proto index de7410e70f..217373cce2 100644 --- a/proto/pbservice/healthcheck.proto +++ b/proto/pbservice/healthcheck.proto @@ -44,6 +44,9 @@ message HealthCheck { // mog: func-to=int func-from=int32 int32 ExposedPort = 14; + + string Interval = 15; + string Timeout = 16; } message HeaderValue { diff --git a/website/content/api-docs/agent/check.mdx b/website/content/api-docs/agent/check.mdx index 0af557663f..3a2638b139 100644 --- a/website/content/api-docs/agent/check.mdx +++ b/website/content/api-docs/agent/check.mdx @@ -67,6 +67,8 @@ $ curl \ "ServiceID": "redis", "ServiceName": "redis", "ServiceTags": ["primary"], + "Interval": "10s", + "Timeout": "1s" "Type": "tcp", "ExposedPort": 0, "Definition": {},