Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Picametrics
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
Picasoft
Technique
Picametrics
Commits
bd964564
Verified
Commit
bd964564
authored
4 years ago
by
Quentin Duchemin
Browse files
Options
Downloads
Patches
Plain Diff
Better exception handling if Etherpad is down
parent
7fb6d529
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
etherpad/etherpad.py
+6
-2
6 additions, 2 deletions
etherpad/etherpad.py
with
6 additions
and
2 deletions
etherpad/etherpad.py
+
6
−
2
View file @
bd964564
...
...
@@ -40,6 +40,7 @@ class EtherpadCollector(object):
# Get all instances stats
for
instance
in
self
.
instances
:
print
(
"
Etherpad : collecting for instance {}
"
.
format
(
instance
[
'
name
'
]))
data
=
self
.
_get_stats
(
instance
)
if
data
is
None
:
continue
...
...
@@ -86,8 +87,11 @@ class EtherpadCollector(object):
:returns: JSON data returned by Etherpad stats module
"""
# Send request
stats_plugin
=
requests
.
get
(
instance
[
'
url
'
]
+
"
/stats.json
"
)
stats_native
=
requests
.
get
(
instance
[
'
url
'
]
+
"
/stats
"
)
try
:
stats_plugin
=
requests
.
get
(
instance
[
'
url
'
]
+
"
/stats.json
"
)
stats_native
=
requests
.
get
(
instance
[
'
url
'
]
+
"
/stats
"
)
except
requests
.
exceptions
.
RequestException
as
e
:
print
(
'
Unable to contact Etherpad : {}
'
.
format
(
e
))
if
stats_plugin
.
status_code
!=
200
:
print
(
"
Unable to get stats.json from {} : HTTP {}
"
.
format
(
instance
[
'
name
'
],
stats_plugin
.
status_code
))
return
None
...
...
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