Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Goshimmer_without_tipselection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COLLET Ismael
Goshimmer_without_tipselection
Commits
caaf3c10
Commit
caaf3c10
authored
4 years ago
by
Levente Pap
Browse files
Options
Downloads
Patches
Plain Diff
Refactor DBStats metrics collection, update default params
parent
6877d3bd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/metrics/parameters.go
+5
-2
5 additions, 2 deletions
plugins/metrics/parameters.go
plugins/metrics/plugin.go
+17
-4
17 additions, 4 deletions
plugins/metrics/plugin.go
with
22 additions
and
6 deletions
plugins/metrics/parameters.go
+
5
−
2
View file @
caaf3c10
...
...
@@ -6,12 +6,15 @@ import (
const
(
// CfgMetricsLocal defines the config flag to enable/disable local metrics.
CfgMetricsLocal
=
"metrics.local"
CfgMetricsLocal
=
"metrics.local.enable"
// CfgMetricsLocalDB defines the config flag to enable/disable local database metrics.
CfgMetricsLocalDB
=
"metrics.local.db"
// CfgMetricsGlobal defines the config flag to enable/disable global metrics.
CfgMetricsGlobal
=
"metrics.global"
CfgMetricsGlobal
=
"metrics.global
.enable
"
)
func
init
()
{
flag
.
Bool
(
CfgMetricsLocal
,
true
,
"include local metrics"
)
flag
.
Bool
(
CfgMetricsLocalDB
,
false
,
"include local database metrics"
)
flag
.
Bool
(
CfgMetricsGlobal
,
false
,
"include global metrics"
)
}
This diff is collapsed.
Click to expand it.
plugins/metrics/plugin.go
+
17
−
4
View file @
caaf3c10
...
...
@@ -47,7 +47,7 @@ func configure(_ *node.Plugin) {
}
func
run
(
_
*
node
.
Plugin
)
{
log
.
Infof
(
"Starting %s ..."
,
PluginName
)
if
config
.
Node
()
.
GetBool
(
CfgMetricsLocal
)
{
registerLocalMetrics
()
}
...
...
@@ -58,7 +58,8 @@ func run(_ *node.Plugin) {
}
// create a background worker that update the metrics every second
if
err
:=
daemon
.
BackgroundWorker
(
"Metrics Updater"
,
func
(
shutdownSignal
<-
chan
struct
{})
{
if
err
:=
daemon
.
BackgroundWorker
(
"Metrics Updater[1s]"
,
func
(
shutdownSignal
<-
chan
struct
{})
{
defer
log
.
Infof
(
"Stopping Metrics Updater[1s] ... done"
)
if
config
.
Node
()
.
GetBool
(
CfgMetricsLocal
)
{
timeutil
.
Ticker
(
func
()
{
measureCPUUsage
()
...
...
@@ -68,7 +69,6 @@ func run(_ *node.Plugin) {
measureValueTips
()
measureReceivedMPS
()
measureRequestQueueSize
()
measureDBStats
()
// gossip network traffic
g
:=
gossipCurrentTraffic
()
...
...
@@ -79,10 +79,23 @@ func run(_ *node.Plugin) {
if
config
.
Node
()
.
GetBool
(
CfgMetricsGlobal
)
{
timeutil
.
Ticker
(
calculateNetworkDiameter
,
1
*
time
.
Minute
,
shutdownSignal
)
}
log
.
Infof
(
"Stopping Metrics Updater[1s] ..."
)
},
shutdown
.
PriorityMetrics
);
err
!=
nil
{
log
.
Panicf
(
"Failed to start as daemon: %s"
,
err
)
}
if
config
.
Node
()
.
GetBool
(
CfgMetricsLocalDB
)
{
// create a background worker that updates the db metrics every 20 second
if
err
:=
daemon
.
BackgroundWorker
(
"Metrics Updater[DB]"
,
func
(
shutdownSignal
<-
chan
struct
{})
{
defer
log
.
Infof
(
"Stopping Metrics Updater[DB] ... done"
)
timeutil
.
Ticker
(
func
()
{
measureDBStats
()
},
20
*
time
.
Second
,
shutdownSignal
)
log
.
Infof
(
"Stopping Metrics Updater[DB] ..."
)
},
shutdown
.
PriorityMetrics
);
err
!=
nil
{
log
.
Panicf
(
"Failed to start as daemon: %s"
,
err
)
}
}
}
func
registerLocalMetrics
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment