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
5e2743cc
Commit
5e2743cc
authored
4 years ago
by
Levente Pap
Browse files
Options
Downloads
Patches
Plain Diff
FIx avgSolidificationTime metrics
parent
e7237319
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/metrics/message.go
+3
-1
3 additions, 1 deletion
plugins/metrics/message.go
plugins/metrics/plugin.go
+4
-2
4 additions, 2 deletions
plugins/metrics/plugin.go
with
7 additions
and
3 deletions
plugins/metrics/message.go
+
3
−
1
View file @
5e2743cc
...
...
@@ -97,6 +97,8 @@ func MessageTotalCountDB() uint64 {
// AvgSolidificationTime returns the average time it takes for a message to become solid. [milliseconds]
func
AvgSolidificationTime
()
float64
{
solidTimeMutex
.
RLock
()
defer
solidTimeMutex
.
RUnlock
()
return
(
initialSumSolidificationTime
+
float64
(
sumSolidificationTime
.
Milliseconds
()))
/
float64
(
MessageSolidCountDB
())
}
...
...
@@ -150,5 +152,5 @@ func measureInitialDBStats() {
initialMessageSolidCountDB
.
Store
(
uint64
(
solid
))
initialMessageTotalCountDB
.
Store
(
uint64
(
total
))
initialAvgSolidificationTime
.
Store
(
avgSolidTime
)
initialSumSolidificationTime
=
avgSolidTime
*
float64
(
total
)
initialSumSolidificationTime
=
avgSolidTime
*
float64
(
solid
)
}
This diff is collapsed.
Click to expand it.
plugins/metrics/plugin.go
+
4
−
2
View file @
5e2743cc
...
...
@@ -111,13 +111,15 @@ func registerLocalMetrics() {
// messages can only become solid once, then they stay like that, hence no .Dec() part
messagelayer
.
Tangle
()
.
Events
.
MessageSolid
.
Attach
(
events
.
NewClosure
(
func
(
cachedMessage
*
message
.
CachedMessage
,
cachedMessageMetadata
*
tangle
.
CachedMessageMetadata
)
{
cachedMessage
.
Release
()
messageSolidCountDBInc
.
Inc
()
solidTimeMutex
.
Lock
()
defer
solidTimeMutex
.
Unlock
()
// Consume should release cachedMessageMetadata
cachedMessageMetadata
.
Consume
(
func
(
object
objectstorage
.
StorableObject
)
{
msgMetaData
:=
object
.
(
*
tangle
.
MessageMetadata
)
sumSolidificationTime
+=
msgMetaData
.
SolidificationTime
()
.
Sub
(
msgMetaData
.
ReceivedTime
())
if
msgMetaData
.
IsSolid
()
{
messageSolidCountDBInc
.
Inc
()
sumSolidificationTime
+=
msgMetaData
.
SolidificationTime
()
.
Sub
(
msgMetaData
.
ReceivedTime
())
}
})
}))
...
...
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