Skip to content

Commit f0b846d

Browse files
haiqi96gibber9809kirkrodriguesjunhaoliao
authored
feat(log-viewer-webui): Add support for loading IR/JSON streams from S3. (#673)
Co-authored-by: Devin Gibson <gibber9809@users.noreply.github.com> Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com> Co-authored-by: Junhao Liao <junhao@junhao.ca>
1 parent 5857bcf commit f0b846d

File tree

8 files changed

+2761
-977
lines changed

8 files changed

+2761
-977
lines changed

components/clp-package-utils/clp_package_utils/scripts/start_clp.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,11 +930,33 @@ def start_log_viewer_webui(
930930
"StreamTargetUncompressedSize": container_clp_config.stream_output.target_uncompressed_size,
931931
"LogViewerDir": str(container_log_viewer_webui_dir / "yscope-log-viewer"),
932932
}
933+
934+
container_cmd_extra_opts = []
935+
936+
stream_storage = clp_config.stream_output.storage
937+
if StorageType.S3 == stream_storage.type:
938+
s3_config = stream_storage.s3_config
939+
940+
settings_json_updates["StreamFilesS3Region"] = s3_config.region_code
941+
settings_json_updates["StreamFilesS3PathPrefix"] = (
942+
f"{s3_config.bucket}/{s3_config.key_prefix}"
943+
)
944+
945+
access_key_id, secret_access_key = s3_config.get_credentials()
946+
if access_key_id is not None and secret_access_key is not None:
947+
container_cmd_extra_opts.extend(
948+
[
949+
"-e",
950+
f"AWS_ACCESS_KEY_ID={access_key_id}",
951+
"-e",
952+
f"AWS_SECRET_ACCESS_KEY={secret_access_key}",
953+
]
954+
)
955+
933956
settings_json = read_and_update_settings_json(settings_json_path, settings_json_updates)
934957
with open(settings_json_path, "w") as settings_json_file:
935958
settings_json_file.write(json.dumps(settings_json))
936959

937-
# Start container
938960
# fmt: off
939961
container_cmd = [
940962
"docker", "run",
@@ -951,6 +973,8 @@ def start_log_viewer_webui(
951973
"-u", f"{os.getuid()}:{os.getgid()}",
952974
]
953975
# fmt: on
976+
container_cmd.extend(container_cmd_extra_opts)
977+
954978
necessary_mounts = [
955979
mounts.clp_home,
956980
mounts.stream_output_dir,

components/log-viewer-webui/client/src/ui/QueryStatus.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const QueryStatus = () => {
8787
setQueryState(QUERY_LOADING_STATES.LOADING);
8888

8989
const innerLogEventNum = logEventIdx - data.begin_msg_ix + 1;
90-
window.location = `/log-viewer/index.html?filePath=/streams/${data.path}` +
90+
window.location = `/log-viewer/index.html?filePath=${data.path}` +
9191
`#logEventNum=${innerLogEventNum}`;
9292
})
9393
.catch((e) => {

0 commit comments

Comments
 (0)