Skip to content

Commit

Permalink
add TypeCollectorECSTask (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyili committed Mar 21, 2024
1 parent b80284a commit e45d77d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions process/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const (
TypeCollectorVerticalPodAutoscaler = 83
TypeCollectorHorizontalPodAutoscaler = 84
TypeCollectorNetworkPolicy = 85
TypeCollectorECSTask = 200
)

func (m MessageType) String() string {
Expand Down Expand Up @@ -185,6 +186,8 @@ func (m MessageType) String() string {
return "horizontal-pod-autoscaler"
case TypeCollectorNetworkPolicy:
return "network-policy"
case TypeCollectorECSTask:
return "ecs-task"
default:
// otherwise convert the type identifier
return strconv.Itoa(int(m))
Expand Down Expand Up @@ -281,6 +284,8 @@ func DecodeMessage(data []byte) (Message, error) {
m = &CollectorHorizontalPodAutoscaler{}
case TypeCollectorNetworkPolicy:
m = &CollectorNetworkPolicy{}
case TypeCollectorECSTask:
m = &CollectorECSTask{}
default:
return Message{}, fmt.Errorf("unhandled message type: %d", header.Type)
}
Expand Down Expand Up @@ -360,6 +365,8 @@ func DetectMessageType(b MessageBody) (MessageType, error) {
t = TypeCollectorHorizontalPodAutoscaler
case *CollectorNetworkPolicy:
t = TypeCollectorNetworkPolicy
case *CollectorECSTask:
t = TypeCollectorECSTask
default:
return 0, fmt.Errorf("unknown message body type: %s", reflect.TypeOf(b))
}
Expand Down

0 comments on commit e45d77d

Please sign in to comment.