Skip to content

Commit

Permalink
Merge pull request #11398 from royalhuang/issue_7091
Browse files Browse the repository at this point in the history
pref: 日志模块ES存储性能优化 #7091
  • Loading branch information
mingshewhe authored Jan 10, 2025
2 parents b71500e + 664cceb commit b4eb2bf
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ interface ServiceLogPrintResource {
executeCount: Int?,
@Parameter(description = "插件的存储模式", required = false)
@QueryParam("logStorageMode")
logStorageMode: LogStorageMode? = LogStorageMode.UPLOAD,
logStorageMode: LogStorageMode? = null,
@Parameter(description = "job id", required = false)
@QueryParam("userJobId")
jobId: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,27 @@ class LogStatusDao {
subTags: String?,
containerHashId: String?,
executeCount: Int,
logStorageMode: LogStorageMode,
logStorageMode: LogStorageMode?,
finish: Boolean,
jobId: String?,
stepId: String?
) {
with(TLogStatus.T_LOG_STATUS) {
dslContext.insertInto(this)
val update = dslContext.insertInto(this)
.set(BUILD_ID, buildId)
.set(TAG, tag)
.set(SUB_TAG, subTags)
.set(EXECUTE_COUNT, executeCount)
.set(JOB_ID, containerHashId)
.set(FINISHED, finish)
.set(MODE, logStorageMode.name)

.set(USER_JOB_ID, jobId)
.set(STEP_ID, stepId)
.onDuplicateKeyUpdate()
logStorageMode?.let { update.set(MODE, it.name) }
update.onDuplicateKeyUpdate()
.set(FINISHED, finish)
.set(MODE, logStorageMode.name)
.execute()
logStorageMode?.let { update.set(MODE, it.name) }
update.execute()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ data class LogStatusEvent(
val userJobId: String?,
val stepId: String?,
val executeCount: Int?,
val logStorageMode: LogStorageMode? = LogStorageMode.UPLOAD,
val logStorageMode: LogStorageMode?,
override var retryTime: Int = 2,
override var delayMills: Int = 0
) : ILogEvent(buildId, retryTime, delayMills)
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class ServiceLogPrintResourceImpl @Autowired constructor(
subTag = subTag,
jobId = containerHashId,
executeCount = executeCount,
logStorageMode = null,
userJobId = jobId,
stepId = stepId
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class LogStatusService @Autowired constructor(
subTags = subTag ?: "",
containerHashId = containerHashId ?: "",
executeCount = executeCount ?: 1,
logStorageMode = logStorageMode ?: LogStorageMode.UPLOAD,
logStorageMode = logStorageMode,
finish = finish,
jobId = jobId,
stepId = stepId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ object ESIndexUtils {
.startObject("containerHashId").field("type", "keyword").endObject()
.startObject("stepId").field("type", "keyword").endObject()
.startObject("executeCount").field("type", "keyword").endObject()
.startObject("logType").field("type", "text").endObject()
.startObject("logType").field("type", "keyword").endObject()
.startObject("message").field("type", "text")
.field("analyzer", "standard")
.field("index", false)
.endObject()
.endObject()
.endObject()
Expand Down

0 comments on commit b4eb2bf

Please sign in to comment.