hook

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hook_V1_FullMethodName = "/api.alarm.hook.Hook/V1"
)
View Source
const OperationHookV1 = "/api.alarm.hook.Hook/V1"

Variables

View Source
var File_alarm_hook_hook_proto protoreflect.FileDescriptor
View Source
var Hook_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "api.alarm.hook.Hook",
	HandlerType: (*HookServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "V1",
			Handler:    _Hook_V1_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "alarm/hook/hook.proto",
}

Hook_ServiceDesc is the grpc.ServiceDesc for Hook service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterHookHTTPServer

func RegisterHookHTTPServer(s *http.Server, srv HookHTTPServer)

func RegisterHookServer

func RegisterHookServer(s grpc.ServiceRegistrar, srv HookServer)

Types

type AlertV1

type AlertV1 struct {

	// 告警状态, firing, resolved
	Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
	// 标签
	Labels map[string]string `` /* 153-byte string literal not displayed */
	// 注解
	Annotations map[string]string `` /* 163-byte string literal not displayed */
	// 开始时间
	StartsAt string `protobuf:"bytes,4,opt,name=startsAt,proto3" json:"startsAt,omitempty"`
	// 结束时间, 空表示未结束
	EndsAt string `protobuf:"bytes,5,opt,name=endsAt,proto3" json:"endsAt,omitempty"`
	// 告警生成链接
	GeneratorURL string `protobuf:"bytes,6,opt,name=generatorURL,proto3" json:"generatorURL,omitempty"`
	// 指纹
	Fingerprint string `protobuf:"bytes,7,opt,name=fingerprint,proto3" json:"fingerprint,omitempty"`
	// contains filtered or unexported fields
}

告警明细

func (*AlertV1) Descriptor deprecated

func (*AlertV1) Descriptor() ([]byte, []int)

Deprecated: Use AlertV1.ProtoReflect.Descriptor instead.

func (*AlertV1) GetAnnotations

func (x *AlertV1) GetAnnotations() map[string]string

func (*AlertV1) GetEndsAt

func (x *AlertV1) GetEndsAt() string

func (*AlertV1) GetFingerprint

func (x *AlertV1) GetFingerprint() string

func (*AlertV1) GetGeneratorURL

func (x *AlertV1) GetGeneratorURL() string

func (*AlertV1) GetLabels

func (x *AlertV1) GetLabels() map[string]string

func (*AlertV1) GetStartsAt

func (x *AlertV1) GetStartsAt() string

func (*AlertV1) GetStatus

func (x *AlertV1) GetStatus() string

func (*AlertV1) ProtoMessage

func (*AlertV1) ProtoMessage()

func (*AlertV1) ProtoReflect

func (x *AlertV1) ProtoReflect() protoreflect.Message

func (*AlertV1) Reset

func (x *AlertV1) Reset()

func (*AlertV1) String

func (x *AlertV1) String() string

func (*AlertV1) Validate

func (m *AlertV1) Validate() error

Validate checks the field values on AlertV1 with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*AlertV1) ValidateAll

func (m *AlertV1) ValidateAll() error

ValidateAll checks the field values on AlertV1 with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in AlertV1MultiError, or nil if none found.

type AlertV1MultiError

type AlertV1MultiError []error

AlertV1MultiError is an error wrapping multiple validation errors returned by AlertV1.ValidateAll() if the designated constraints aren't met.

func (AlertV1MultiError) AllErrors

func (m AlertV1MultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (AlertV1MultiError) Error

func (m AlertV1MultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type AlertV1ValidationError

type AlertV1ValidationError struct {
	// contains filtered or unexported fields
}

AlertV1ValidationError is the validation error returned by AlertV1.Validate if the designated constraints aren't met.

func (AlertV1ValidationError) Cause

func (e AlertV1ValidationError) Cause() error

Cause function returns cause value.

func (AlertV1ValidationError) Error

func (e AlertV1ValidationError) Error() string

Error satisfies the builtin error interface

func (AlertV1ValidationError) ErrorName

func (e AlertV1ValidationError) ErrorName() string

ErrorName returns error name.

func (AlertV1ValidationError) Field

func (e AlertV1ValidationError) Field() string

Field function returns field value.

func (AlertV1ValidationError) Key

func (e AlertV1ValidationError) Key() bool

Key function returns key value.

func (AlertV1ValidationError) Reason

func (e AlertV1ValidationError) Reason() string

Reason function returns reason value.

type HookClient

type HookClient interface {
	// 接收prometheus报警hook请求
	V1(ctx context.Context, in *HookV1Request, opts ...grpc.CallOption) (*HookV1Reply, error)
}

HookClient is the client API for Hook service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewHookClient

func NewHookClient(cc grpc.ClientConnInterface) HookClient

type HookHTTPClient

type HookHTTPClient interface {
	V1(ctx context.Context, req *HookV1Request, opts ...http.CallOption) (rsp *HookV1Reply, err error)
}

func NewHookHTTPClient

func NewHookHTTPClient(client *http.Client) HookHTTPClient

type HookHTTPClientImpl

type HookHTTPClientImpl struct {
	// contains filtered or unexported fields
}

func (*HookHTTPClientImpl) V1

type HookHTTPServer

type HookHTTPServer interface {
	V1(context.Context, *HookV1Request) (*HookV1Reply, error)
}

type HookServer

type HookServer interface {
	// 接收prometheus报警hook请求
	V1(context.Context, *HookV1Request) (*HookV1Reply, error)
	// contains filtered or unexported methods
}

HookServer is the server API for Hook service. All implementations must embed UnimplementedHookServer for forward compatibility

type HookV1Reply

type HookV1Reply struct {

	// 响应消息
	Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	// 响应码
	Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"`
	// contains filtered or unexported fields
}

接收prometheus报警hook请求返回

func (*HookV1Reply) Descriptor deprecated

func (*HookV1Reply) Descriptor() ([]byte, []int)

Deprecated: Use HookV1Reply.ProtoReflect.Descriptor instead.

func (*HookV1Reply) GetCode

func (x *HookV1Reply) GetCode() int32

func (*HookV1Reply) GetMsg

func (x *HookV1Reply) GetMsg() string

func (*HookV1Reply) ProtoMessage

func (*HookV1Reply) ProtoMessage()

func (*HookV1Reply) ProtoReflect

func (x *HookV1Reply) ProtoReflect() protoreflect.Message

func (*HookV1Reply) Reset

func (x *HookV1Reply) Reset()

func (*HookV1Reply) String

func (x *HookV1Reply) String() string

func (*HookV1Reply) Validate

func (m *HookV1Reply) Validate() error

Validate checks the field values on HookV1Reply with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*HookV1Reply) ValidateAll

func (m *HookV1Reply) ValidateAll() error

ValidateAll checks the field values on HookV1Reply with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in HookV1ReplyMultiError, or nil if none found.

type HookV1ReplyMultiError

type HookV1ReplyMultiError []error

HookV1ReplyMultiError is an error wrapping multiple validation errors returned by HookV1Reply.ValidateAll() if the designated constraints aren't met.

func (HookV1ReplyMultiError) AllErrors

func (m HookV1ReplyMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (HookV1ReplyMultiError) Error

func (m HookV1ReplyMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type HookV1ReplyValidationError

type HookV1ReplyValidationError struct {
	// contains filtered or unexported fields
}

HookV1ReplyValidationError is the validation error returned by HookV1Reply.Validate if the designated constraints aren't met.

func (HookV1ReplyValidationError) Cause

Cause function returns cause value.

func (HookV1ReplyValidationError) Error

Error satisfies the builtin error interface

func (HookV1ReplyValidationError) ErrorName

func (e HookV1ReplyValidationError) ErrorName() string

ErrorName returns error name.

func (HookV1ReplyValidationError) Field

Field function returns field value.

func (HookV1ReplyValidationError) Key

Key function returns key value.

func (HookV1ReplyValidationError) Reason

Reason function returns reason value.

type HookV1Request

type HookV1Request struct {

	// 接收者
	Receiver string `protobuf:"bytes,1,opt,name=receiver,proto3" json:"receiver,omitempty"`
	// 报警状态, firing, resolved
	Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	// 告警列表
	Alerts []*AlertV1 `protobuf:"bytes,3,rep,name=alerts,proto3" json:"alerts,omitempty"`
	// 告警组标签
	GroupLabels map[string]string `` /* 163-byte string literal not displayed */
	// 公共标签
	CommonLabels map[string]string `` /* 165-byte string literal not displayed */
	// 公共注解
	CommonAnnotations map[string]string `` /* 175-byte string literal not displayed */
	// 外部链接
	ExternalURL string `protobuf:"bytes,7,opt,name=externalURL,proto3" json:"externalURL,omitempty"`
	// 版本
	Version string `protobuf:"bytes,8,opt,name=version,proto3" json:"version,omitempty"`
	// 告警组key
	GroupKey string `protobuf:"bytes,9,opt,name=groupKey,proto3" json:"groupKey,omitempty"`
	// 截断告警数
	TruncatedAlerts int32 `protobuf:"varint,10,opt,name=truncatedAlerts,proto3" json:"truncatedAlerts,omitempty"`
	// contains filtered or unexported fields
}

prometheus webhook 报警数据

func (*HookV1Request) Descriptor deprecated

func (*HookV1Request) Descriptor() ([]byte, []int)

Deprecated: Use HookV1Request.ProtoReflect.Descriptor instead.

func (*HookV1Request) GetAlerts

func (x *HookV1Request) GetAlerts() []*AlertV1

func (*HookV1Request) GetCommonAnnotations

func (x *HookV1Request) GetCommonAnnotations() map[string]string

func (*HookV1Request) GetCommonLabels

func (x *HookV1Request) GetCommonLabels() map[string]string

func (*HookV1Request) GetExternalURL

func (x *HookV1Request) GetExternalURL() string

func (*HookV1Request) GetGroupKey

func (x *HookV1Request) GetGroupKey() string

func (*HookV1Request) GetGroupLabels

func (x *HookV1Request) GetGroupLabels() map[string]string

func (*HookV1Request) GetReceiver

func (x *HookV1Request) GetReceiver() string

func (*HookV1Request) GetStatus

func (x *HookV1Request) GetStatus() string

func (*HookV1Request) GetTruncatedAlerts

func (x *HookV1Request) GetTruncatedAlerts() int32

func (*HookV1Request) GetVersion

func (x *HookV1Request) GetVersion() string

func (*HookV1Request) ProtoMessage

func (*HookV1Request) ProtoMessage()

func (*HookV1Request) ProtoReflect

func (x *HookV1Request) ProtoReflect() protoreflect.Message

func (*HookV1Request) Reset

func (x *HookV1Request) Reset()

func (*HookV1Request) String

func (x *HookV1Request) String() string

func (*HookV1Request) Validate

func (m *HookV1Request) Validate() error

Validate checks the field values on HookV1Request with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*HookV1Request) ValidateAll

func (m *HookV1Request) ValidateAll() error

ValidateAll checks the field values on HookV1Request with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in HookV1RequestMultiError, or nil if none found.

type HookV1RequestMultiError

type HookV1RequestMultiError []error

HookV1RequestMultiError is an error wrapping multiple validation errors returned by HookV1Request.ValidateAll() if the designated constraints aren't met.

func (HookV1RequestMultiError) AllErrors

func (m HookV1RequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (HookV1RequestMultiError) Error

func (m HookV1RequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type HookV1RequestValidationError

type HookV1RequestValidationError struct {
	// contains filtered or unexported fields
}

HookV1RequestValidationError is the validation error returned by HookV1Request.Validate if the designated constraints aren't met.

func (HookV1RequestValidationError) Cause

Cause function returns cause value.

func (HookV1RequestValidationError) Error

Error satisfies the builtin error interface

func (HookV1RequestValidationError) ErrorName

func (e HookV1RequestValidationError) ErrorName() string

ErrorName returns error name.

func (HookV1RequestValidationError) Field

Field function returns field value.

func (HookV1RequestValidationError) Key

Key function returns key value.

func (HookV1RequestValidationError) Reason

Reason function returns reason value.

type UnimplementedHookServer

type UnimplementedHookServer struct {
}

UnimplementedHookServer must be embedded to have forward compatible implementations.

func (UnimplementedHookServer) V1

type UnsafeHookServer

type UnsafeHookServer interface {
	// contains filtered or unexported methods
}

UnsafeHookServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HookServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL