Skip to content

Commit

Permalink
Revert "feat(monitor): optimize monitor and alert (#2132)" (#2146)
Browse files Browse the repository at this point in the history
This reverts commit 1aad7f4.
  • Loading branch information
willzgli authored Nov 3, 2022
1 parent c7f9641 commit fcf0558
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 328 deletions.
12 changes: 3 additions & 9 deletions api/notify/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,10 @@ type MessageList struct {

// MessageSpec is a description of a message.
type MessageSpec struct {
TenantID string
ReceiverName string
// +optional
TenantID string
ReceiverName string
ReceiverChannel ReceiverChannel
// +optional
Identity string
Identity string
// +optional
Username string
// +optional
Expand All @@ -436,10 +434,6 @@ type MessageStatus struct {
// The last time the condition transitioned from one status to another.
// +optional
LastTransitionTime metav1.Time

// A human readable message indicating details about the transition.
// +optional
FailedReason string
}

// MessagePhase indicates the status of message.
Expand Down
280 changes: 119 additions & 161 deletions api/notify/v1/generated.pb.go

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions api/notify/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions api/notify/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,10 @@ type MessageList struct {

// MessageSpec is a description of a message.
type MessageSpec struct {
TenantID string `json:"tenantID" protobuf:"bytes,1,opt,name=tenantID"`
ReceiverName string `json:"receiverName" protobuf:"bytes,2,opt,name=receiverName"`
// +optional
ReceiverChannel ReceiverChannel `json:"receiverChannel,omitempty" protobuf:"bytes,3,opt,name=receiverChannel,casttype=ReceiverChannel"`
// +optional
Identity string `json:"identity,omitempty" protobuf:"bytes,4,opt,name=identity"`
TenantID string `json:"tenantID" protobuf:"bytes,1,opt,name=tenantID"`
ReceiverName string `json:"receiverName" protobuf:"bytes,2,opt,name=receiverName"`
ReceiverChannel ReceiverChannel `json:"receiverChannel" protobuf:"bytes,3,opt,name=receiverChannel,casttype=ReceiverChannel"`
Identity string `json:"identity" protobuf:"bytes,4,opt,name=identity"`
// +optional
Username string `json:"username,omitempty" protobuf:"bytes,5,opt,name=username"`
// +optional
Expand All @@ -436,10 +434,6 @@ type MessageStatus struct {
// The last time the condition transitioned from one status to another.
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,2,opt,name=lastTransitionTime"`

// A human readable message indicating details about the transition.
// +optional
FailedReason string `json:"failedReason,omitempty" protobuf:"bytes,3,opts,name=failedReason"`
}

// MessagePhase indicates the status of message.
Expand Down
1 change: 0 additions & 1 deletion api/notify/v1/types_swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/notify/v1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 7 additions & 12 deletions api/openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ spec:
periodSeconds: 20
resources:
limits:
cpu: 500m
memory: 2Gi
cpu: 100m
memory: 256Mi
requests:
cpu: 50m
memory: 128Mi
Expand Down Expand Up @@ -141,10 +141,6 @@ data:
api_server = "https://tke-platform-api"
api_server_client_config = "/app/conf/tke-platform-config.yaml"

[features]
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
message_ttl: "360h"

tke-auth-webhook.yaml: |
apiVersion: v1
kind: Config
Expand Down
4 changes: 1 addition & 3 deletions cmd/tke-notify-api/app/options/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
package options

import (
"time"

"github.com/spf13/pflag"
"github.com/spf13/viper"
"time"
)

const (
Expand All @@ -48,7 +47,6 @@ func (o *FeatureOptions) AddFlags(fs *pflag.FlagSet) {
func (o *FeatureOptions) ApplyFlags() []error {
var errs []error

// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
o.MessageTTL = viper.GetDuration(configMessageTTL)

return errs
Expand Down
6 changes: 3 additions & 3 deletions pkg/monitor/controller/prometheus/yamls.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ groups:
expr: sum(k8s_container_fs_write_times) without (container_name,container_id)

- record: k8s_pod_status_ready
expr: sum(kube_pod_status_phase{phase=~"Running|Succeeded"}) by (namespace,pod_name) * on(namespace, pod_name) group_left(workload_kind,workload_name,node, node_role) __pod_info2
expr: sum(kube_pod_status_ready{condition="true"}) by (namespace,pod_name) * on(namespace, pod_name) group_left(workload_kind,workload_name,node, node_role) __pod_info2

- record: k8s_pod_restart_total
expr: sum(idelta(kube_pod_container_status_restarts_total [2m])) by (namespace,pod_name) * on(namespace, pod_name) group_left(workload_kind,workload_name,node, node_role) __pod_info2
Expand Down Expand Up @@ -1240,8 +1240,8 @@ func configForAlertManager(webhookAddr string, repeatInterval string) string {

route:
group_by: ['alertname','alarmPolicyName','version']
group_wait: 30s
group_interval: 5m
group_wait: 1s
group_interval: 1s
repeat_interval: %s
receiver: 'web.hook'
routes:
Expand Down
Loading

0 comments on commit fcf0558

Please sign in to comment.