Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dfaast
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Santhosh Kumar
dfaast
Commits
adf37892
Commit
adf37892
authored
May 03, 2024
by
Santhosh Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup code
parent
b249d3bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
src/example2/Dockerfile
src/example2/Dockerfile
+1
-1
src/example2/function.py
src/example2/function.py
+4
-4
No files found.
src/example2/Dockerfile
View file @
adf37892
...
...
@@ -13,7 +13,7 @@ RUN pip install -r requirements.txt
RUN
pip
install
prometheus_client
RUN
pip
install
psutil
EXPOSE
5
000
EXPOSE
8
000
# Define the command to run the function
CMD
["python", "/app/function.py"]
src/example2/function.py
View file @
adf37892
...
...
@@ -62,6 +62,7 @@ def start_cpu_occupier(percentage):
return
jsonify
({
'error'
:
'Invalid percentage, must be between 0 and 100'
}),
400
memory_process
=
None
memory_block
=
None
def
allocate_memory
(
memory_size
):
try
:
...
...
@@ -112,7 +113,8 @@ def hello():
function_requests_total
.
inc
()
for
i
in
range
(
1000000
):
for
j
in
range
(
10000
)
for
j
in
range
(
10000
):
pass
...
...
@@ -192,9 +194,7 @@ def metrics():
output
+=
"CPU Utilization: "
+
str
(
cpu_utilization
)
+
"
\n
"
output
+=
"Bytes Sent: "
+
str
(
bytes_sent
)
+
"
\n
"
output
+=
"Bytes Received: "
+
str
(
bytes_received
)
+
"
\n
"
return
output
,
200
,
{
"Content-Type"
:
CONTENT_TYPE_LATEST
}
return
output
,
200
,
{
"Content-Type"
:
CONTENT_TYPE_LATEST
}
if
__name__
==
"__main__"
:
# Start Prometheus HTTP server to expose metrics
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment