Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref: 日志模块ES存储性能优化 #7091 #11398

Merged
merged 5 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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