mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
fix(monitor): add service metric monitor (#22226)
This commit is contained in:
@@ -31,6 +31,11 @@ var All = []SMeasurement{
|
||||
system,
|
||||
vasmi,
|
||||
|
||||
worker,
|
||||
serviceHttpCode,
|
||||
serviceProcessStats,
|
||||
dbStats,
|
||||
|
||||
vmCpu,
|
||||
vmMem,
|
||||
vmDisk,
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package measurements
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
|
||||
var dbStats = SMeasurement{
|
||||
Context: []SMonitorContext{
|
||||
{
|
||||
"db_stats", "Database Stats",
|
||||
monitor.METRIC_RES_TYPE_DB_STATS, monitor.METRIC_DATABASE_SYSTEM,
|
||||
},
|
||||
},
|
||||
Metrics: []SMetric{
|
||||
{
|
||||
"idle", "Database Idle", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"in_use", "Database InUse", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"max_idle_closed", "Database max idle closed", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"max_idle_time_closed", "Database max idle time closed", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"max_lifetime_closed", "Database max lifetime closed", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"max_open_connections", "Database max open connections", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"open_connections", "Database open connections", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"wait_count", "Database wait count", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"wait_duration", "Database wait duration", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package measurements
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
|
||||
var worker = SMeasurement{
|
||||
Context: []SMonitorContext{
|
||||
{
|
||||
"worker", "Worker queue",
|
||||
monitor.METRIC_RES_TYPE_WORKER, monitor.METRIC_DATABASE_SYSTEM,
|
||||
},
|
||||
},
|
||||
Metrics: []SMetric{
|
||||
{
|
||||
"active_worker_cnt", "Active Worker Count", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"max_worker_count", "Max Worker Count", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"detach_worker_cnt", "Detach worker Count", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"queue_cnt", "Worker Queue Count", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package measurements
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
|
||||
var serviceHttpCode = SMeasurement{
|
||||
Context: []SMonitorContext{
|
||||
{
|
||||
"http_request", "HTTP Request hit",
|
||||
monitor.METRIC_RES_TYPE_HTTP_REQUEST, monitor.METRIC_DATABASE_SYSTEM,
|
||||
},
|
||||
},
|
||||
Metrics: []SMetric{
|
||||
{
|
||||
"duration.2xx", "http code 2xxx duration", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"duration.4xx", "http code 4xxx duration", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"duration.5xx", "http code 5xxx duration", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"hit.2xx", "http code 2xxx hit", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"hit.4xx", "http code 4xxx hit", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"hit.5xx", "http code 5xxx hit", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package measurements
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
|
||||
var serviceProcessStats = SMeasurement{
|
||||
Context: []SMonitorContext{
|
||||
{
|
||||
"process", "Service process stats",
|
||||
monitor.METRIC_RES_TYPE_PROCESS, monitor.METRIC_DATABASE_SYSTEM,
|
||||
},
|
||||
},
|
||||
Metrics: []SMetric{
|
||||
{
|
||||
"cpu_percent", "CPU percent", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"mem_percent", "Memory percent", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"mem_size", "Memory size", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
{
|
||||
"goroutine_num", "Goroutine num", monitor.METRIC_UNIT_NULL,
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user