Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
coco
Commits
15b3b9c5
Unverified
Commit
15b3b9c5
authored
Jan 26, 2018
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
a3e6a236
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
recorder.py
coco/recorder.py
+10
-3
No files found.
coco/recorder.py
View file @
15b3b9c5
...
@@ -242,15 +242,20 @@ class ESCommandRecorder(CommandRecorder, metaclass=Singleton):
...
@@ -242,15 +242,20 @@ class ESCommandRecorder(CommandRecorder, metaclass=Singleton):
class
S3ReplayRecorder
(
ServerReplayRecorder
):
class
S3ReplayRecorder
(
ServerReplayRecorder
):
def
__init__
(
self
,
app
):
def
__init__
(
self
,
app
):
super
()
.
__init__
(
app
)
super
()
.
__init__
(
app
)
self
.
bucket
=
app
.
config
[
"REPLAY_
RECORD_ENGIN
E"
]
.
get
(
"BUCKET"
,
"jumpserver"
)
self
.
bucket
=
app
.
config
[
"REPLAY_
STORAG
E"
]
.
get
(
"BUCKET"
,
"jumpserver"
)
self
.
s3
=
boto3
.
client
(
's3'
)
self
.
s3
=
boto3
.
client
(
's3'
)
def
push_to_server
(
self
,
session_id
):
def
push_to_server
(
self
,
session_id
):
try
:
self
.
s3
.
upload_file
(
self
.
s3
.
upload_file
(
os
.
path
.
join
(
self
.
app
.
config
[
'LOG_DIR'
],
session_id
+
'.replay.gz'
),
os
.
path
.
join
(
self
.
app
.
config
[
'LOG_DIR'
],
session_id
+
'.replay.gz'
),
self
.
bucket
,
self
.
bucket
,
time
.
strftime
(
'
%
Y-
%
m-
%
d'
,
time
.
localtime
(
time
.
strftime
(
'
%
Y-
%
m-
%
d'
,
time
.
localtime
(
self
.
starttime
))
+
'/'
+
session_id
+
'.replay.gz'
)
self
.
starttime
))
+
'/'
+
session_id
+
'.replay.gz'
)
except
:
return
self
.
app
.
service
.
push_session_replay
(
os
.
path
.
join
(
self
.
app
.
config
[
'LOG_DIR'
],
session_id
+
'.replay.gz'
),
session_id
)
def
get_command_recorder_class
(
config
):
def
get_command_recorder_class
(
config
):
...
@@ -263,8 +268,10 @@ def get_command_recorder_class(config):
...
@@ -263,8 +268,10 @@ def get_command_recorder_class(config):
def
get_replay_recorder_class
(
config
):
def
get_replay_recorder_class
(
config
):
replay_
engine
=
config
[
"REPLAY_RECORD_ENGIN
E"
]
replay_
storage
=
config
[
"REPLAY_STORAG
E"
]
if
replay_
engine
==
"s3"
:
if
replay_
storage
[
'TYPE'
]
==
"s3"
:
return
S3ReplayRecorder
return
S3ReplayRecorder
elif
replay_storage
[
'TYPE'
]
==
"locale"
:
return
ServerReplayRecorder
else
:
else
:
return
ServerReplayRecorder
return
ServerReplayRecorder
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