Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
opentrafficshaper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yuriy
opentrafficshaper
Commits
47329d02
Commit
47329d02
authored
11 years ago
by
Nigel Kukard
Browse files
Options
Downloads
Patches
Plain Diff
Better statistics cleanup time logging
parent
a85e2ec2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentrafficshaper/plugins/statistics/statistics.pm
+27
-6
27 additions, 6 deletions
opentrafficshaper/plugins/statistics/statistics.pm
with
27 additions
and
6 deletions
opentrafficshaper/plugins/statistics/statistics.pm
+
27
−
6
View file @
47329d02
...
@@ -522,13 +522,18 @@ sub _session_tick
...
@@ -522,13 +522,18 @@ sub _session_tick
my
$cleanUpTo
=
$now
-
(
$statsConfig
->
{
1
}
->
{'
precision
'}
*
3
);
my
$cleanUpTo
=
$now
-
(
$statsConfig
->
{
1
}
->
{'
precision
'}
*
3
);
# Streamed stats is removed 3 time periods past the first precision
# Streamed stats is removed 3 time periods past the first precision
my
$timerA
=
[
gettimeofday
];
if
(
$res
=
$sthStatsBasicCleanup
->
execute
(
0
,
$cleanUpTo
))
{
if
(
$res
=
$sthStatsBasicCleanup
->
execute
(
0
,
$cleanUpTo
))
{
my
$timerB
=
[
gettimeofday
];
my
$timerdiffA
=
tv_interval
(
$timerA
,
$timerB
);
# We get 0E0 for 0 when none were removed
# We get 0E0 for 0 when none were removed
if
(
$res
ne
"
0E0
")
{
if
(
$res
ne
"
0E0
")
{
$logger
->
log
(
LOG_INFO
,"
[STATISTICS] Cleanup streamed stats_basic %s, up to %s [%s]
",
$logger
->
log
(
LOG_INFO
,"
[STATISTICS] Cleanup streamed stats_basic
, %s items in
%s, up to %s [%s]
",
$res
,
$res
,
sprintf
('
%.3fs
',
$timerdiffA
),
$cleanUpTo
,
$cleanUpTo
,
scalar
(
localtime
(
$cleanUpTo
))
scalar
(
localtime
(
$cleanUpTo
))
,
);
);
}
}
}
else
{
}
else
{
...
@@ -536,12 +541,18 @@ sub _session_tick
...
@@ -536,12 +541,18 @@ sub _session_tick
$sthStatsBasicCleanup
->
errstr
()
$sthStatsBasicCleanup
->
errstr
()
);
);
}
}
# And the normal stats...
# And the normal stats...
$timerA
=
[
gettimeofday
];
if
(
$res
=
$sthStatsCleanup
->
execute
(
0
,
$cleanUpTo
))
{
if
(
$res
=
$sthStatsCleanup
->
execute
(
0
,
$cleanUpTo
))
{
my
$timerB
=
[
gettimeofday
];
my
$timerdiffA
=
tv_interval
(
$timerA
,
$timerB
);
# We get 0E0 for 0 when none were removed
# We get 0E0 for 0 when none were removed
if
(
$res
ne
"
0E0
")
{
if
(
$res
ne
"
0E0
")
{
$logger
->
log
(
LOG_INFO
,"
[STATISTICS] Cleanup streamed stats %s, up to %s [%s]
",
$logger
->
log
(
LOG_INFO
,"
[STATISTICS] Cleanup streamed stats
, %s items in
%s, up to %s [%s]
",
$res
,
$res
,
sprintf
('
%.3fs
',
$timerdiffA
),
$cleanUpTo
,
scalar
(
localtime
(
$cleanUpTo
))
$cleanUpTo
,
scalar
(
localtime
(
$cleanUpTo
))
);
);
}
}
...
@@ -557,11 +568,16 @@ sub _session_tick
...
@@ -557,11 +568,16 @@ sub _session_tick
$cleanUpTo
=
$now
-
(
$statsConfig
->
{
$key
}
->
{'
retention
'}
*
86400
);
$cleanUpTo
=
$now
-
(
$statsConfig
->
{
$key
}
->
{'
retention
'}
*
86400
);
# Retention period is in # days
# Retention period is in # days
my
$timerA
=
[
gettimeofday
];
if
(
$res
=
$sthStatsBasicCleanup
->
execute
(
$key
,
$cleanUpTo
))
{
if
(
$res
=
$sthStatsBasicCleanup
->
execute
(
$key
,
$cleanUpTo
))
{
# We get 0E0 for 0 when none were removed
# We get 0E0 for 0 when none were removed
if
(
$res
ne
"
0E0
")
{
if
(
$res
ne
"
0E0
")
{
$logger
->
log
(
LOG_INFO
,"
[STATISTICS] Cleanup key %s stats_basic, %s items up to %s [%s]
",
my
$timerB
=
[
gettimeofday
];
my
$timerdiffA
=
tv_interval
(
$timerA
,
$timerB
);
$logger
->
log
(
LOG_INFO
,"
[STATISTICS] Cleanup stats_basic key %s in %s, %s items up to %s [%s]
",
$key
,
$key
,
sprintf
('
%.3fs
',
$timerdiffA
),
$res
,
$res
,
$cleanUpTo
,
$cleanUpTo
,
scalar
(
localtime
(
$cleanUpTo
))
scalar
(
localtime
(
$cleanUpTo
))
...
@@ -574,11 +590,16 @@ sub _session_tick
...
@@ -574,11 +590,16 @@ sub _session_tick
);
);
}
}
# And normal stats...
# And normal stats...
$timerA
=
[
gettimeofday
];
if
(
$res
=
$sthStatsCleanup
->
execute
(
$key
,
$cleanUpTo
))
{
if
(
$res
=
$sthStatsCleanup
->
execute
(
$key
,
$cleanUpTo
))
{
# We get 0E0 for 0 when none were removed
# We get 0E0 for 0 when none were removed
if
(
$res
ne
"
0E0
")
{
if
(
$res
ne
"
0E0
")
{
$logger
->
log
(
LOG_INFO
,"
[STATISTICS] Cleanup key %s stats %s, up to %s [%s]
",
my
$timerB
=
[
gettimeofday
];
my
$timerdiffA
=
tv_interval
(
$timerA
,
$timerB
);
$logger
->
log
(
LOG_INFO
,"
[STATISTICS] Cleanup stats key %s in %s, %s items up to %s [%s]
",
$key
,
$key
,
sprintf
('
%.3fs
',
$timerdiffA
),
$res
,
$res
,
$cleanUpTo
,
$cleanUpTo
,
scalar
(
localtime
(
$cleanUpTo
))
scalar
(
localtime
(
$cleanUpTo
))
...
@@ -597,7 +618,7 @@ sub _session_tick
...
@@ -597,7 +618,7 @@ sub _session_tick
my
$timer4
=
[
gettimeofday
];
my
$timer4
=
[
gettimeofday
];
my
$timediff4
=
tv_interval
(
$timer3
,
$timer4
);
my
$timediff4
=
tv_interval
(
$timer3
,
$timer4
);
$logger
->
log
(
LOG_INFO
,"
[STATISTICS]
S
tats cleanup time: %s
",
$logger
->
log
(
LOG_INFO
,"
[STATISTICS]
Total s
tats cleanup time: %s
",
sprintf
('
%.3fs
',
$timediff4
)
sprintf
('
%.3fs
',
$timediff4
)
);
);
}
}
...
...
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