Skip to content

Commit

Permalink
During metricController initialisation, set the initial values of --w…
Browse files Browse the repository at this point in the history
…orkloadMetrics and --accesslog

Signed-off-by: LiZhenCheng9527 <[email protected]>
  • Loading branch information
LiZhenCheng9527 committed Dec 9, 2024
1 parent 8739c89 commit be2ce51
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
13 changes: 9 additions & 4 deletions ctl/monitoring/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,29 @@ func NewCmd() *cobra.Command {
Example: `# Enable/Disable Kmesh's accesslog:
kmeshctl monitoring <kmesh-daemon-pod> --accesslog enable/disable
# Enable/Disable Kmesh's metrics(to-service and to-pod) and accesslog:
# Enable/Disable services' metrics and accesslog generated from bpf:
kmeshctl monitoring <kmesh-daemon-pod> --all enable/disable
# Enable/Disable Kmesh's metrics of connections between pods:
# Enable/Disable workload granularity metrics:
kmeshctl monitoring <kmesh-daemon-pod> --workloadMetrics enable/disable
# If you want to change the monitoring functionality of all kmesh daemons in the cluster
# Enable/Disable Kmesh's accesslog in each node:
kmeshctl monitoring --accesslog enable/disable
# Enable/Disable workload granularity metrics in each node:
kmeshctl monitoring --workloadMetrics enable/disable
#Enable/Disable services' and workloads' metrics and accesslog generated from bpf in each node:
kmeshctl monitoring --all enable/disable`,
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
ControlMonitoring(cmd, args)
},
}
cmd.Flags().String("accesslog", "", "Control accesslog enable or disable")
cmd.Flags().String("all", "", "Control accesslog and metrics(to-service and to-pod) enable or disable together")
cmd.Flags().String("workloadMetrics", "", "Control metrics of connections between pods enable or disable")
cmd.Flags().String("all", "", "Control accesslog and services' and workloads' metrics enable or disable together")
cmd.Flags().String("workloadMetrics", "", "Control granularity metrics enable or disable")
return cmd
}

Expand Down
13 changes: 9 additions & 4 deletions docs/ctl/kmeshctl_monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,30 @@ kmeshctl monitoring [flags]
# Enable/Disable Kmesh's accesslog:
kmeshctl monitoring <kmesh-daemon-pod> --accesslog enable/disable
# Enable/Disable Kmesh's metrics(to-service and to-pod) and accesslog:
# Enable/Disable services' metrics and accesslog generated from bpf:
kmeshctl monitoring <kmesh-daemon-pod> --all enable/disable
# Enable/Disable Kmesh's metrics of connections between pods:
# Enable/Disable workload granularity metrics:
kmeshctl monitoring <kmesh-daemon-pod> --workloadMetrics enable/disable
# If you want to change the monitoring functionality of all kmesh daemons in the cluster
# Enable/Disable Kmesh's accesslog in each node:
kmeshctl monitoring --accesslog enable/disable
# Enable/Disable workload granularity metrics in each node:
kmeshctl monitoring --workloadMetrics enable/disable
#Enable/Disable services' and workloads' metrics and accesslog generated from bpf in each node:
kmeshctl monitoring --all enable/disable
```

### Options

```
--accesslog string Control accesslog enable or disable
--all string Control accesslog and metrics(to-service and to-pod) enable or disable together
--all string Control accesslog and services' and workloads' metrics enable or disable together
-h, --help help for monitoring
--workloadMetrics string Control metrics of connections between pods enable or disable
--workloadMetrics string Control granularity metrics enable or disable
```

### SEE ALSO
Expand Down
2 changes: 2 additions & 0 deletions pkg/controller/telemetry/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ func NewMetric(workloadCache cache.WorkloadCache, enableMonitoring bool) *Metric
serviceMetricCache: map[serviceMetricLabels]*serviceMetricInfo{},
}
m.EnableMonitoring.Store(enableMonitoring)
m.EnableAccesslog.Store(false)
m.EnableWorkloadMetric.Store(false)
return m
}

Expand Down

0 comments on commit be2ce51

Please sign in to comment.