Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
theodolite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor 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
Sören Henning
theodolite
Commits
2e9eaa37
Commit
2e9eaa37
authored
4 years ago
by
Sören Henning
Browse files
Options
Downloads
Patches
Plain Diff
Load monitoring datat for number of instances and partitions
parent
d580a525
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
execution/lag_analysis.py
+46
-0
46 additions, 0 deletions
execution/lag_analysis.py
with
46 additions
and
0 deletions
execution/lag_analysis.py
+
46
−
0
View file @
2e9eaa37
...
...
@@ -81,3 +81,49 @@ plt.plot(X, Y_pred, color='red')
plt
.
savefig
(
f
"
{
filename
}
_plot.png
"
)
df
.
to_csv
(
f
"
{
filename
}
_values.csv
"
)
# Load partition count
response
=
requests
.
get
(
'
http://kube1.se.internal:32529/api/v1/query_range
'
,
params
=
{
'
query
'
:
"
count by(group,topic)(kafka_consumergroup_group_offset > 0)
"
,
'
start
'
:
start
.
isoformat
(),
'
end
'
:
end
.
isoformat
(),
'
step
'
:
'
5s
'
})
results
=
response
.
json
()[
'
data
'
][
'
result
'
]
d
=
[]
for
result
in
results
:
#print(result['metric']['topic'])
topic
=
result
[
'
metric
'
][
'
topic
'
]
for
value
in
result
[
'
values
'
]:
#print(value)
d
.
append
({
'
topic
'
:
topic
,
'
timestamp
'
:
int
(
value
[
0
]),
'
value
'
:
int
(
value
[
1
])
if
value
[
1
]
!=
'
NaN
'
else
0
})
df
=
pd
.
DataFrame
(
d
)
df
.
to_csv
(
f
"
{
filename
}
_partitions.csv
"
)
# Load instances count
response
=
requests
.
get
(
'
http://kube1.se.internal:32529/api/v1/query_range
'
,
params
=
{
'
query
'
:
"
count(count (kafka_consumer_consumer_fetch_manager_metrics_records_lag) by(pod))
"
,
'
start
'
:
start
.
isoformat
(),
'
end
'
:
end
.
isoformat
(),
'
step
'
:
'
5s
'
})
results
=
response
.
json
()[
'
data
'
][
'
result
'
]
d
=
[]
for
result
in
results
:
for
value
in
result
[
'
values
'
]:
#print(value)
d
.
append
({
'
timestamp
'
:
int
(
value
[
0
]),
'
value
'
:
int
(
value
[
1
])})
df
=
pd
.
DataFrame
(
d
)
df
.
to_csv
(
f
"
{
filename
}
_instances.csv
"
)
\ No newline at end of file
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