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
Compare revisions
4ccadd2f25cc747ecd27acc74839d5ab51589940 to 95ffe16b7cfddbcac39bdc9309c648fdd4d71787
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
picasoft/projets/picasoft-metrics-bot
Select target project
No results found
95ffe16b7cfddbcac39bdc9309c648fdd4d71787
Select Git revision
Swap
Target
picasoft/projets/picasoft-metrics-bot
Select target project
picasoft/projets/picasoft-metrics-bot
1 result
4ccadd2f25cc747ecd27acc74839d5ab51589940
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (1)
Again better reporting
· 95ffe16b
Quentin Duchemin
authored
4 years ago
95ffe16b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
etherpad/etherpad.py
+2
-3
2 additions, 3 deletions
etherpad/etherpad.py
main.py
+6
-0
6 additions, 0 deletions
main.py
with
8 additions
and
3 deletions
etherpad/etherpad.py
View file @
95ffe16b
...
...
@@ -42,7 +42,6 @@ class EtherpadCollector(object):
for
instance
in
self
.
instances
:
data
=
self
.
_get_stats
(
instance
)
if
data
is
None
:
print
(
'
Unable to get stats from Etherpad instance :
'
+
instance
[
'
url
'
])
continue
# Create metrics
metrics
.
append
({
...
...
@@ -90,10 +89,10 @@ class EtherpadCollector(object):
stats_plugin
=
requests
.
get
(
instance
[
'
url
'
]
+
"
/stats.json
"
)
stats_native
=
requests
.
get
(
instance
[
'
url
'
]
+
"
/stats
"
)
if
stats_plugin
.
status_code
!=
200
:
print
(
"
Unable to get stats.json : HTTP {}
"
.
format
(
stats_plugin
.
status_code
))
print
(
"
Unable to get stats.json
from {}
: HTTP {}
"
.
format
(
instance
[
'
name
'
],
stats_plugin
.
status_code
))
return
None
if
stats_native
.
status_code
!=
200
:
print
(
"
Unable to get stats : HTTP {}
"
.
format
(
stats_plugin
.
status_code
))
print
(
"
Unable to get stats
from {}
: HTTP {}
"
.
format
(
instance
[
'
name
'
],
stats_plugin
.
status_code
))
return
None
try
:
plugin
=
json
.
loads
(
stats_plugin
.
text
)
...
...
This diff is collapsed.
Click to expand it.
main.py
View file @
95ffe16b
...
...
@@ -7,6 +7,7 @@
import
json
import
os
import
sys
import
time
from
urllib.parse
import
urlparse
from
influxdb
import
InfluxDBClient
from
etherpad
import
EtherpadCollector
...
...
@@ -60,6 +61,7 @@ def influxb_connect(config):
except
Exception
as
e
:
print
(
"
Cannot connect to {} : {}
"
.
format
(
o
.
hostname
,
e
))
print
(
"
If InfluxDB has just started, this is normal, please wait!
"
)
return
None
def
main
():
...
...
@@ -78,6 +80,10 @@ def main():
print
(
'
You need to add InfluxDB configuration on your config file.
'
)
sys
.
exit
(
1
)
influx_client
=
influxb_connect
(
config
[
'
influxdb
'
])
while
influx_client
is
None
:
print
(
"
InfluxDB not available, retrying in 5 seconds...
"
)
time
.
sleep
(
5
)
influx_client
=
influxb_connect
(
config
[
'
influxdb
'
])
# Get Etherpad metrics and push to InfluxDB
if
'
etherpad
'
in
config
[
'
modules
'
]:
...
...
This diff is collapsed.
Click to expand it.