Skip to content

Commit

Permalink
perf: 批量获取日志ESB接口支持文件大小、速率、进度字段 TencentBlueKing#2675
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonwan committed Dec 18, 2023
1 parent 8abcbc7 commit 6135048
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 32 deletions.
31 changes: 20 additions & 11 deletions docs/apidoc/bk-api-gateway/v3/zh/batch_get_job_instance_ip_log.md
Expand Up @@ -109,7 +109,10 @@
},
"dest_path": "/tmp/1.log",
"status": 4,
"log_content": "[2021-06-28 11:32:16] FileName: /tmp/1.log FileSize: 9.0 Bytes State: dest agent success download file Speed: 1 KB/s Progress: 100% StatusDesc: dest agent success download file Detail: success"
"log_content": "[2021-06-28 11:32:16] FileName: /tmp/1.log FileSize: 9.0 Bytes State: dest agent success download file Speed: 1 KB/s Progress: 100% StatusDesc: dest agent success download file Detail: success",
"size": "1.0 Bytes",
"speed": "0 KB/s",
"process": "100%"
}
]
},
Expand All @@ -127,7 +130,10 @@
},
"src_path": "/data/1.log",
"status": 4,
"log_content": "[2021-06-28 11:32:16] FileName: /data/1.log FileSize: 9.0 Bytes State: source agent success upload file Speed: 1 KB/s Progress: 100% StatusDesc: source agent success upload file Detail: success upload"
"log_content": "[2021-06-28 11:32:16] FileName: /data/1.log FileSize: 9.0 Bytes State: source agent success upload file Speed: 1 KB/s Progress: 100% StatusDesc: source agent success upload file Detail: success upload",
"size": "1.0 Bytes",
"speed": "0 KB/s",
"process": "100%"
}
]
}
Expand Down Expand Up @@ -173,15 +179,18 @@

##### file_log

| 字段 | 类型 | 描述 |
|-----------|-----------|-----------|
| mode | 分发模式 | 0:上传;1:下载|
| src_ip | object |文件源主机IP。定义见ip |
| src_path | string | 源文件路径 |
| dest_ip | object | 分发目标主机IP,mode=1时有值。定义见ip |
| dest_path | string | 目标路径,mode=1时有值 |
| status | int | 任务状态。1-等待开始;2-上传中;3-下载中;4-成功;5-失败 |
| log_content | string | 文件分发日志内容 |
| 字段 | 类型 | 描述 |
|--------------|-----------|-----------|
| mode | 分发模式 | 0:上传;1:下载|
| src_ip | object |文件源主机IP。定义见ip |
| src_path | string | 源文件路径 |
| dest_ip | object | 分发目标主机IP,mode=1时有值。定义见ip |
| dest_path | string | 目标路径,mode=1时有值 |
| status | int | 任务状态。1-等待开始;2-上传中;3-下载中;4-成功;5-失败 |
| log_content | string | 文件分发日志内容 |
| size | string | 文件大小 |
| speed | string | 文件传输速率 |
| process | string | 文件传输进度 |

##### ip

Expand Down
Expand Up @@ -102,7 +102,10 @@ Bulk query of job execution logs by host list
},
"dest_path": "/tmp/1.log",
"status": 4,
"log_content": "[2021-06-28 11:32:16] FileName: /tmp/1.log FileSize: 9.0 Bytes State: dest agent success download file Speed: 1 KB/s Progress: 100% StatusDesc: dest agent success download file Detail: success"
"log_content": "[2021-06-28 11:32:16] FileName: /tmp/1.log FileSize: 9.0 Bytes State: dest agent success download file Speed: 1 KB/s Progress: 100% StatusDesc: dest agent success download file Detail: success",
"size": "1.0 Bytes",
"speed": "0 KB/s",
"process": "100%"
}
]
},
Expand All @@ -120,7 +123,10 @@ Bulk query of job execution logs by host list
},
"src_path": "/data/1.log",
"status": 4,
"log_content": "[2021-06-28 11:32:16] FileName: /data/1.log FileSize: 9.0 Bytes State: source agent success upload file Speed: 1 KB/s Progress: 100% StatusDesc: source agent success upload file Detail: success upload"
"log_content": "[2021-06-28 11:32:16] FileName: /data/1.log FileSize: 9.0 Bytes State: source agent success upload file Speed: 1 KB/s Progress: 100% StatusDesc: source agent success upload file Detail: success upload",
"size": "1.0 Bytes",
"speed": "0 KB/s",
"process": "100%"
}
]
}
Expand Down Expand Up @@ -176,15 +182,18 @@ Bulk query of job execution logs by host list

#### file_log

| Fields | Type | Description |
|-----------|-----------|-----------|
| mode | int | Distribution mode. 0: Upload; 1: Download |
| src_ip | object |File source host IP. see ip for definition |
| src_path | string | Source file paths |
| dest_ip | object | Distribute the target host IP, with value for mode=1. See ip for definition. |
| dest_path | string | Target path, with value for mode=1 |
| status | int | Task status. 1-Waiting; 2-Uploading; 3-Downloading; 4- Success; 5- Failure |
| Fields | Type | Description |
|-------------|-----------|-----------|
| mode | int | Distribution mode. 0: Upload; 1: Download |
| src_ip | object |File source host IP. see ip for definition |
| src_path | string | Source file paths |
| dest_ip | object | Distribute the target host IP, with value for mode=1. See ip for definition. |
| dest_path | string | Target path, with value for mode=1 |
| status | int | Task status. 1-Waiting; 2-Uploading; 3-Downloading; 4- Success; 5- Failure |
| log_content | string | File distribution log contents |
| size | string | File size |
| speed | string | File transfer speed |
| process | string | File transfer process |

#### ip

Expand Down
Expand Up @@ -103,7 +103,10 @@
},
"dest_path": "/tmp/1.log",
"status": 4,
"log_content": "[2021-06-28 11:32:16] FileName: /tmp/1.log FileSize: 9.0 Bytes State: dest agent success download file Speed: 1 KB/s Progress: 100% StatusDesc: dest agent success download file Detail: success"
"log_content": "[2021-06-28 11:32:16] FileName: /tmp/1.log FileSize: 9.0 Bytes State: dest agent success download file Speed: 1 KB/s Progress: 100% StatusDesc: dest agent success download file Detail: success",
"size": "1.0 Bytes",
"speed": "0 KB/s",
"process": "100%"
}
]
},
Expand All @@ -121,7 +124,10 @@
},
"src_path": "/data/1.log",
"status": 4,
"log_content": "[2021-06-28 11:32:16] FileName: /data/1.log FileSize: 9.0 Bytes State: source agent success upload file Speed: 1 KB/s Progress: 100% StatusDesc: source agent success upload file Detail: success upload"
"log_content": "[2021-06-28 11:32:16] FileName: /data/1.log FileSize: 9.0 Bytes State: source agent success upload file Speed: 1 KB/s Progress: 100% StatusDesc: source agent success upload file Detail: success upload",
"size": "1.0 Bytes",
"speed": "0 KB/s",
"process": "100%"
}
]
}
Expand Down Expand Up @@ -176,15 +182,18 @@

#### file_log

| 字段 | 类型 | 描述 |
|-----------|-----------|-----------|
| mode | int | 分发模式。0:上传;1:下载|
| src_ip | object |文件源主机IP。定义见ip |
| src_path | string | 源文件路径 |
| dest_ip | object | 分发目标主机IP,mode=1时有值。定义见ip |
| dest_path | string | 目标路径,mode=1时有值 |
| status | int | 任务状态。1-等待开始;2-上传中;3-下载中;4-成功;5-失败 |
| log_content | string | 文件分发日志内容 |
| 字段 | 类型 | 描述 |
|--------------|-----------|-----------|
| mode | 分发模式 | 0:上传;1:下载|
| src_ip | object |文件源主机IP。定义见ip |
| src_path | string | 源文件路径 |
| dest_ip | object | 分发目标主机IP,mode=1时有值。定义见ip |
| dest_path | string | 目标路径,mode=1时有值 |
| status | int | 任务状态。1-等待开始;2-上传中;3-下载中;4-成功;5-失败 |
| log_content | string | 文件分发日志内容 |
| size | string | 文件大小 |
| speed | string | 文件传输速率 |
| process | string | 文件传输进度 |

#### ip

Expand Down
Expand Up @@ -55,6 +55,15 @@ public class EsbFileLogV3DTO {
@JsonProperty("log_content")
private String logContent;

@JsonProperty("size")
private String size;

@JsonProperty("speed")
private String speed;

@JsonProperty("process")
private String process;

}


Expand Up @@ -229,6 +229,9 @@ private EsbFileLogV3DTO toEsbFileLogV3DTO(ServiceFileTaskLogDTO fileTaskLog) {
}

fileLog.setLogContent(fileTaskLog.getContent());
fileLog.setSize(fileTaskLog.getSize());
fileLog.setSpeed(fileTaskLog.getSpeed());
fileLog.setProcess(fileTaskLog.getProcess());
fileLog.setStatus(fileTaskLog.getStatus());
return fileLog;
}
Expand Down

0 comments on commit 6135048

Please sign in to comment.