Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
custom-metrics-generator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
cloud
custom-metrics-generator
Commits
aa138fda
Commit
aa138fda
authored
3 years ago
by
František Řezníček
Browse files
Options
Downloads
Patches
Plain Diff
fix: add environment variables to cron (to execute lspci), better debugging with CMG_TRACE
parent
5b5bc77b
Branches
Branches containing commit
Tags
v1.2.5
Tags containing commit
No related merge requests found
Pipeline
#161372
passed
3 years ago
Stage: build-image
Stage: release-image
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+9
-4
9 additions, 4 deletions
CHANGELOG.md
entrypoint.sh
+2
-1
2 additions, 1 deletion
entrypoint.sh
src/lib.sh
+4
-0
4 additions, 0 deletions
src/lib.sh
src/metric-generator-exec.sh
+6
-4
6 additions, 4 deletions
src/metric-generator-exec.sh
with
21 additions
and
9 deletions
CHANGELOG.md
+
9
−
4
View file @
aa138fda
...
@@ -6,21 +6,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -6,21 +6,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [Unreleased]
## [1.2.5] - 2022-06-07
### Fixed
-
cron: assure lspci is executable
-
metric-generator-exec.sh: better logging/tracing with CMG_TRACE
## [1.2.4] - 2022-06-07
## [1.2.4] - 2022-06-07
###
Add
ed
###
Fix
ed
-
gpumon: GPU_DEVICES_UNRECOGNIZED detection reworked without grep, with gawk, avoiding crash
-
gpumon: GPU_DEVICES_UNRECOGNIZED detection reworked without grep, with gawk, avoiding crash
## [1.2.3] - 2022-06-07
## [1.2.3] - 2022-06-07
###
Add
ed
###
Fix
ed
-
gpumon: publish at least a metric help (metric-generator-exec requirement)
-
gpumon: publish at least a metric help (metric-generator-exec requirement)
-
metric-generator-exec.sh: added note on how should generator module behave
-
metric-generator-exec.sh: added note on how should generator module behave
## [1.2.2] - 2022-06-07
## [1.2.2] - 2022-06-07
###
Add
ed
###
Fix
ed
-
gpumon: avoid crashing on no GPU (readlink)
-
gpumon: avoid crashing on no GPU (readlink)
## [1.2.1] - 2022-06-07
## [1.2.1] - 2022-06-07
###
Add
ed
###
Fix
ed
-
gpumon: avoid crashing on no GPU
-
gpumon: avoid crashing on no GPU
-
gpumon: avoid reporting GPU metric help on no GPU
-
gpumon: avoid reporting GPU metric help on no GPU
...
...
This diff is collapsed.
Click to expand it.
entrypoint.sh
+
2
−
1
View file @
aa138fda
...
@@ -27,13 +27,14 @@ test -d "${CMG_OUT_METRICS_DIR}" || \
...
@@ -27,13 +27,14 @@ test -d "${CMG_OUT_METRICS_DIR}" || \
mkdir
-p
"
${
CMG_OUT_METRICS_DIR
}
"
mkdir
-p
"
${
CMG_OUT_METRICS_DIR
}
"
i_fixed_sleep
=
0
i_fixed_sleep
=
0
echo
-e
"SHELL=/bin/bash
\n
PATH=/usr/bin:/bin:/usr/sbin
\n\n
"
>
/var/spool/cron/root
for
i_module
in
${
CMG_EXEC_MODULES
}
;
do
for
i_module
in
${
CMG_EXEC_MODULES
}
;
do
touch
"
${
CMG_OUT_METRICS_DIR
}
/
${
i_module
}
.prom"
\
touch
"
${
CMG_OUT_METRICS_DIR
}
/
${
i_module
}
.prom"
\
"
${
CMG_OUT_METRICS_DIR
}
/custom-metrics-generator_
${
i_module
}
.prom"
>
/dev/null
"
${
CMG_OUT_METRICS_DIR
}
/custom-metrics-generator_
${
i_module
}
.prom"
>
/dev/null
echo
"* * * * *
${
CMG_BASE_DIR
}
/src/delay-jitter-exec.sh
${
i_fixed_sleep
}
${
CMG_MAX_JITTER_DELAY
}
\
echo
"* * * * *
${
CMG_BASE_DIR
}
/src/delay-jitter-exec.sh
${
i_fixed_sleep
}
${
CMG_MAX_JITTER_DELAY
}
\
${
CMG_BASE_DIR
}
/src/metric-generator-exec.sh
${
i_module
}
${
CMG_OUT_METRICS_DIR
}
/
${
i_module
}
.prom
${
CMG_OUT_METRICS_DIR
}
/custom-metrics-generator_
${
i_module
}
.prom"
${
CMG_BASE_DIR
}
/src/metric-generator-exec.sh
${
i_module
}
${
CMG_OUT_METRICS_DIR
}
/
${
i_module
}
.prom
${
CMG_OUT_METRICS_DIR
}
/custom-metrics-generator_
${
i_module
}
.prom"
i_fixed_sleep
=
$((
${
i_fixed_sleep
}
+
5
))
i_fixed_sleep
=
$((
${
i_fixed_sleep
}
+
5
))
done
>
/var/spool/cron/root
done
>
>
/var/spool/cron/root
echo
"custom-metrics-generator configuration:"
echo
"custom-metrics-generator configuration:"
set
|
grep
-E
'^CMG_'
|
awk
'{print "export " $0}'
>
"
${
CMG_BASE_DIR
}
/custom-metrics-generator.conf.env"
set
|
grep
-E
'^CMG_'
|
awk
'{print "export " $0}'
>
"
${
CMG_BASE_DIR
}
/custom-metrics-generator.conf.env"
...
...
This diff is collapsed.
Click to expand it.
src/lib.sh
+
4
−
0
View file @
aa138fda
[[
"
${
CMG_TRACE
}
"
=
~ ^1|[Tt]rue
$
]]
&&
\
set
-x
# get_metric_help ( <metric-name> <metric-type> <metric-desc>)
# get_metric_help ( <metric-name> <metric-type> <metric-desc>)
# generates testform metric help
# generates testform metric help
function
get_metric_help
()
{
function
get_metric_help
()
{
...
...
This diff is collapsed.
Click to expand it.
src/metric-generator-exec.sh
+
6
−
4
View file @
aa138fda
...
@@ -78,10 +78,10 @@ function at_exit() {
...
@@ -78,10 +78,10 @@ function at_exit() {
fi
fi
mv
-f
"
${
OUTPUT_METRIC_GENERATOR_RUNNER_METRIC_FILE
}
.tmp"
"
${
OUTPUT_METRIC_GENERATOR_RUNNER_METRIC_FILE
}
"
mv
-f
"
${
OUTPUT_METRIC_GENERATOR_RUNNER_METRIC_FILE
}
.tmp"
"
${
OUTPUT_METRIC_GENERATOR_RUNNER_METRIC_FILE
}
"
fi
fi
local
env_dump_file
=
"/tmp/cmg-
${
METRICS_GENERATOR_NAME
}
-trace.log"
set
>
${
env_dump_file
}
set
>
"/tmp/cmg-
${
METRICS_GENERATOR_NAME
}
-trace.log"
if
[
"
${
STAGE_NAME
}
"
!=
"success"
]
;
then
if
[
"
${
STAGE_NAME
}
"
!=
"success"
]
;
then
log_stderr
"ERROR: Job
${
METRICS_GENERATOR_NAME
}
failed at step
\"
${
STAGE_NAME
}
\"
(PPID:
$$
, duration:
${
SECONDS
}
sec[s], see env. dump at
${
env_dump_file
}
)."
log_stderr
"ERROR: Job
${
METRICS_GENERATOR_NAME
}
failed at step
\"
${
STAGE_NAME
}
\"
(PPID:
$$
, duration:
${
SECONDS
}
sec[s], see env. dump at
/tmp/cmg-*
${
METRICS_GENERATOR_NAME
}
-trace.log
)."
exit
1
exit
1
fi
fi
log_stdout
"INFO: Job
${
METRICS_GENERATOR_NAME
}
succeeded. (PPID:
$$
, duration:
${
SECONDS
}
sec[s])"
log_stdout
"INFO: Job
${
METRICS_GENERATOR_NAME
}
succeeded. (PPID:
$$
, duration:
${
SECONDS
}
sec[s])"
...
@@ -96,7 +96,9 @@ rm -f "${OUTPUT_METRIC_GENERATOR_RUNNER_METRIC_FILE}.tmp"
...
@@ -96,7 +96,9 @@ rm -f "${OUTPUT_METRIC_GENERATOR_RUNNER_METRIC_FILE}.tmp"
get_metric_text
"job_last_run_timestamp"
"
${
METRICS_GENERATOR_NAME
}
"
"
${
GENERATOR_START_TIME
}
"
>>
"
${
OUTPUT_METRIC_GENERATOR_RUNNER_METRIC_FILE
}
.tmp"
get_metric_text
"job_last_run_timestamp"
"
${
METRICS_GENERATOR_NAME
}
"
"
${
GENERATOR_START_TIME
}
"
>>
"
${
OUTPUT_METRIC_GENERATOR_RUNNER_METRIC_FILE
}
.tmp"
STAGE_NAME
=
"metric-generator successfuly executed"
STAGE_NAME
=
"metric-generator successfuly executed"
timeout
${
CMG_METRIC_GENERATOR_EXEC_TIMEOUT
}
${
METRICS_GENERATOR_FILE
}
${
OUTPUT_METRIC_GENERATOR_METRIC_FILE
}
>
"
${
OUTPUT_METRIC_GENERATOR_METRIC_FILE
}
.tmp"
timeout
${
CMG_METRIC_GENERATOR_EXEC_TIMEOUT
}
${
METRICS_GENERATOR_FILE
}
${
OUTPUT_METRIC_GENERATOR_METRIC_FILE
}
\
>
"
${
OUTPUT_METRIC_GENERATOR_METRIC_FILE
}
.tmp"
\
2>
"/tmp/cmg-module-
${
METRICS_GENERATOR_NAME
}
-trace.log"
STAGE_NAME
=
"metric-generator generated valid metrics"
STAGE_NAME
=
"metric-generator generated valid metrics"
test
-s
"
${
OUTPUT_METRIC_GENERATOR_METRIC_FILE
}
.tmp"
test
-s
"
${
OUTPUT_METRIC_GENERATOR_METRIC_FILE
}
.tmp"
...
...
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