From 92dbdeef21278ea9f53ae9ebe25130e496e64597 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Sun, 18 Sep 2022 17:23:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?perf:=20=E6=8E=A5=E5=85=A5=E8=93=9D?= =?UTF-8?q?=E9=B2=B8=E7=9B=91=E6=8E=A7APM=E8=B0=83=E7=94=A8=E9=93=BE?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA=20#1161?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持JDBC调用MySQL追踪 --- src/backend/build.gradle | 4 ++++ src/backend/commons/common-otel/build.gradle | 1 + .../bk/job/common/tracing/OtelConfiguration.java | 13 +++++++++++++ src/backend/commons/common/build.gradle | 2 +- .../src/main/resources/quartz.properties | 2 +- .../job-crontab/service-job-crontab/build.gradle | 2 +- .../charts/bk-job/templates/_helpers.tpl | 14 ++++++++++++++ .../bk-job/templates/job-analysis/configmap.yaml | 4 ++-- .../bk-job/templates/job-backup/configmap.yaml | 12 ++++++------ .../bk-job/templates/job-crontab/configmap.yaml | 6 +++--- .../bk-job/templates/job-execute/configmap.yaml | 4 ++-- .../templates/job-file-gateway/configmap.yaml | 4 ++-- .../bk-job/templates/job-manage/configmap.yaml | 4 ++-- .../#etc#job#job-analysis#job-analysis.yml | 4 ++-- .../templates/#etc#job#job-backup#job-backup.yml | 12 ++++++------ .../templates/#etc#job#job-crontab#job-crontab.yml | 6 +++--- .../templates/#etc#job#job-execute#job-execute.yml | 4 ++-- .../#etc#job#job-file-gateway#job-file-gateway.yml | 4 ++-- .../templates/#etc#job#job-manage#job-manage.yml | 4 ++-- 19 files changed, 69 insertions(+), 37 deletions(-) diff --git a/src/backend/build.gradle b/src/backend/build.gradle index 31ee52ac29..6bdcf6e0f7 100644 --- a/src/backend/build.gradle +++ b/src/backend/build.gradle @@ -111,6 +111,8 @@ ext { set('jodaTimeVersion', "2.10.5") set('bcprovVersion', "1.64") set('reflectionsVersion', "0.9.12") + set('cronUtilsVersion', "9.1.6") + set('otelJdbcVersion', "1.9.2-alpha") if (System.getProperty("bkjobVersion")) { set('bkjobVersion', System.getProperty("bkjobVersion")) println "bkjobVersoin:" + bkjobVersion @@ -245,6 +247,8 @@ subprojects { dependency "org.bouncycastle:bcprov-jdk15on:$bcprovVersion" // https://github.com/ronmamo/reflections dependency "org.reflections:reflections:$reflectionsVersion" + dependency "com.cronutils:cron-utils:$cronUtilsVersion" + dependency "io.opentelemetry.instrumentation:opentelemetry-jdbc:$otelJdbcVersion" dependencySet(group: "org.jooq", version: "$jooqVersion") { entry "jooq" entry "jooq-codegen" diff --git a/src/backend/commons/common-otel/build.gradle b/src/backend/commons/common-otel/build.gradle index 08589eb630..6b4da9a8b9 100644 --- a/src/backend/commons/common-otel/build.gradle +++ b/src/backend/commons/common-otel/build.gradle @@ -26,6 +26,7 @@ dependencies { api "org.springframework.cloud:spring-cloud-sleuth-api" api "org.springframework.cloud:spring-cloud-sleuth-otel" api "org.springframework.cloud:spring-cloud-sleuth-otel-autoconfigure" + api "io.opentelemetry.instrumentation:opentelemetry-jdbc" api "io.opentelemetry:opentelemetry-exporter-otlp-trace" // https://mvnrepository.com/artifact/io.opentelemetry/opentelemetry-sdk-extension-resources api 'io.opentelemetry:opentelemetry-sdk-extension-resources' diff --git a/src/backend/commons/common-otel/src/main/java/com/tencent/bk/job/common/tracing/OtelConfiguration.java b/src/backend/commons/common-otel/src/main/java/com/tencent/bk/job/common/tracing/OtelConfiguration.java index 481b05efa1..40a457758c 100644 --- a/src/backend/commons/common-otel/src/main/java/com/tencent/bk/job/common/tracing/OtelConfiguration.java +++ b/src/backend/commons/common-otel/src/main/java/com/tencent/bk/job/common/tracing/OtelConfiguration.java @@ -24,8 +24,12 @@ package com.tencent.bk.job.common.tracing; +import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.api.common.AttributesBuilder; +import io.opentelemetry.context.propagation.ContextPropagators; +import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.SdkTracerProvider; import io.opentelemetry.sdk.trace.SdkTracerProviderBuilder; @@ -88,4 +92,13 @@ SdkTracerProvider otelTracerProvider(SpanLimits spanLimits, processors.forEach(sdkTracerProviderBuilder::addSpanProcessor); return sdkTracerProviderBuilder.build(); } + + @Bean + OpenTelemetry otel(SdkTracerProvider tracerProvider, ContextPropagators contextPropagators) { + OpenTelemetry openTelemetry = + OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).setPropagators(contextPropagators).build(); + GlobalOpenTelemetry.set(openTelemetry); + log.info("GlobalOpenTelemetry has been set"); + return openTelemetry; + } } diff --git a/src/backend/commons/common/build.gradle b/src/backend/commons/common/build.gradle index 1a91dd6d07..bd7805fdc8 100644 --- a/src/backend/commons/common/build.gradle +++ b/src/backend/commons/common/build.gradle @@ -39,7 +39,7 @@ dependencies { implementation 'org.hibernate.validator:hibernate-validator' implementation 'jakarta.validation:jakarta.validation-api' implementation 'io.micrometer:micrometer-registry-prometheus' - implementation 'com.cronutils:cron-utils:9.1.6' + implementation 'com.cronutils:cron-utils' compileOnly 'org.springframework:spring-web' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' diff --git a/src/backend/job-crontab/boot-job-crontab/src/main/resources/quartz.properties b/src/backend/job-crontab/boot-job-crontab/src/main/resources/quartz.properties index 9201a89172..69f8891c3b 100644 --- a/src/backend/job-crontab/boot-job-crontab/src/main/resources/quartz.properties +++ b/src/backend/job-crontab/boot-job-crontab/src/main/resources/quartz.properties @@ -63,7 +63,7 @@ org.quartz.jobStore.dataSource=myDS #============================================================== #Configure DataSource #============================================================== -org.quartz.dataSource.myDS.driver=com.mysql.cj.jdbc.Driver +org.quartz.dataSource.myDS.driver=io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver org.quartz.dataSource.myDS.URL=${job.crontab.db.url} org.quartz.dataSource.myDS.user=${job.crontab.db.user} org.quartz.dataSource.myDS.password=${job.crontab.db.password} diff --git a/src/backend/job-crontab/service-job-crontab/build.gradle b/src/backend/job-crontab/service-job-crontab/build.gradle index 0c4f081e68..c56cd6de1e 100644 --- a/src/backend/job-crontab/service-job-crontab/build.gradle +++ b/src/backend/job-crontab/service-job-crontab/build.gradle @@ -42,5 +42,5 @@ dependencies { implementation "ch.qos.logback:logback-core" implementation "ch.qos.logback:logback-classic" implementation "org.slf4j:slf4j-api" - implementation("com.cronutils:cron-utils:9.1.6") + implementation("com.cronutils:cron-utils") } diff --git a/support-files/kubernetes/charts/bk-job/templates/_helpers.tpl b/support-files/kubernetes/charts/bk-job/templates/_helpers.tpl index b45d622405..4722a8907d 100644 --- a/support-files/kubernetes/charts/bk-job/templates/_helpers.tpl +++ b/support-files/kubernetes/charts/bk-job/templates/_helpers.tpl @@ -206,6 +206,20 @@ Return the MariaDB secret name {{- end -}} {{- end -}} +{{/* +Return the JDBC MySQL Driver Class +*/}} +{{- define "job.jdbcMysqlDriverClass" -}} +{{- printf "io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver" -}} +{{- end -}} + +{{/* +Return the JDBC MySQL scheme +*/}} +{{- define "job.jdbcMysqlScheme" -}} +{{- printf "jdbc:otel:mysql" -}} +{{- end -}} + {{/* Fully qualified app name for Redis diff --git a/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml index dee818f43b..949a71e708 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-analysis: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml index cc95f8ddfe..9092247b75 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-backup: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_backup?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_backup?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} @@ -30,9 +30,9 @@ data: poolName: "job-backup" validationTimeout: 5000 job-execute-db: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} @@ -45,9 +45,9 @@ data: poolName: "job-execute-db" validationTimeout: 5000 job-execute-archive: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml index 99b5a2b516..eb0aade3f9 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-crontab: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} @@ -84,7 +84,7 @@ data: job: crontab: db: - url: jdbc:mysql://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml index 22e7d817be..7ffee5ef6e 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml @@ -132,9 +132,9 @@ data: maxConcurrency: 10 datasource: job-execute: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml index c2108ab5ca..15c1ecd9a3 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-file-gateway: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_file_gateway?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_file_gateway?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml index b0c26fa88a..8eab670394 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-manage: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_manage?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_manage?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/templates/#etc#job#job-analysis#job-analysis.yml b/support-files/templates/#etc#job#job-analysis#job-analysis.yml index 61de265bab..743b267a8d 100644 --- a/support-files/templates/#etc#job#job-analysis#job-analysis.yml +++ b/support-files/templates/#etc#job#job-analysis#job-analysis.yml @@ -3,9 +3,9 @@ spring: name: job-analysis datasource: job-analysis: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://__BK_JOB_ANALYSIS_MYSQL_HOST__:__BK_JOB_ANALYSIS_MYSQL_PORT__/job_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: jdbc:otel:mysql://__BK_JOB_ANALYSIS_MYSQL_HOST__:__BK_JOB_ANALYSIS_MYSQL_PORT__/job_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: __BK_JOB_ANALYSIS_MYSQL_USERNAME__ password: __BK_JOB_ANALYSIS_MYSQL_PASSWORD__ maximum-pool-size: 100 diff --git a/support-files/templates/#etc#job#job-backup#job-backup.yml b/support-files/templates/#etc#job#job-backup#job-backup.yml index d0b0b0442c..86adb62f2f 100644 --- a/support-files/templates/#etc#job#job-backup#job-backup.yml +++ b/support-files/templates/#etc#job#job-backup#job-backup.yml @@ -3,9 +3,9 @@ spring: name: job-backup datasource: job-backup: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://__BK_JOB_BACKUP_MYSQL_HOST__:__BK_JOB_BACKUP_MYSQL_PORT__/job_backup?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: jdbc:otel:mysql://__BK_JOB_BACKUP_MYSQL_HOST__:__BK_JOB_BACKUP_MYSQL_PORT__/job_backup?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: __BK_JOB_BACKUP_MYSQL_USERNAME__ password: __BK_JOB_BACKUP_MYSQL_PASSWORD__ maximum-pool-size: 20 @@ -14,9 +14,9 @@ spring: poolName: "job-backup" validationTimeout: 5000 job-execute-db: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://__BK_JOB_EXECUTE_MYSQL_HOST__:__BK_JOB_EXECUTE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai + jdbc-url: jdbc:otel:mysql://__BK_JOB_EXECUTE_MYSQL_HOST__:__BK_JOB_EXECUTE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai username: __BK_JOB_EXECUTE_MYSQL_USERNAME__ password: __BK_JOB_EXECUTE_MYSQL_PASSWORD__ maximum-pool-size: 10 @@ -26,9 +26,9 @@ spring: validationTimeout: 5000 # 执行数据归档DB配置,若需开启数据归档请去除注释并添加相应环境变量进行配置 #job-execute-archive: - #driver-class-name: com.mysql.cj.jdbc.Driver + #driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver #type: com.zaxxer.hikari.HikariDataSource - #jdbc-url: jdbc:mysql://__BK_JOB_EXECUTE_ARCHIVE_MYSQL_HOST__:__BK_JOB_EXECUTE_ARCHIVE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai + #jdbc-url: jdbc:otel:mysql://__BK_JOB_EXECUTE_ARCHIVE_MYSQL_HOST__:__BK_JOB_EXECUTE_ARCHIVE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai #username: __BK_JOB_EXECUTE_ARCHIVE_MYSQL_USERNAME__ #password: __BK_JOB_EXECUTE_ARCHIVE_MYSQL_PASSWORD__ #maximum-pool-size: 10 diff --git a/support-files/templates/#etc#job#job-crontab#job-crontab.yml b/support-files/templates/#etc#job#job-crontab#job-crontab.yml index 1925116d4a..a0f6086b35 100644 --- a/support-files/templates/#etc#job#job-crontab#job-crontab.yml +++ b/support-files/templates/#etc#job#job-crontab#job-crontab.yml @@ -3,9 +3,9 @@ spring: name: job-crontab datasource: job-crontab: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://__BK_JOB_CRONTAB_MYSQL_HOST__:__BK_JOB_CRONTAB_MYSQL_PORT__/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: jdbc:otel:mysql://__BK_JOB_CRONTAB_MYSQL_HOST__:__BK_JOB_CRONTAB_MYSQL_PORT__/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: __BK_JOB_CRONTAB_MYSQL_USERNAME__ password: __BK_JOB_CRONTAB_MYSQL_PASSWORD__ maximum-pool-size: 20 @@ -86,7 +86,7 @@ ribbon: job: crontab: db: - url: jdbc:mysql://__BK_JOB_CRONTAB_MYSQL_HOST__:__BK_JOB_CRONTAB_MYSQL_PORT__/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + url: jdbc:otel:mysql://__BK_JOB_CRONTAB_MYSQL_HOST__:__BK_JOB_CRONTAB_MYSQL_PORT__/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: __BK_JOB_CRONTAB_MYSQL_USERNAME__ password: __BK_JOB_CRONTAB_MYSQL_PASSWORD__ diff --git a/support-files/templates/#etc#job#job-execute#job-execute.yml b/support-files/templates/#etc#job#job-execute#job-execute.yml index 50bf9d8e65..a64de70b94 100644 --- a/support-files/templates/#etc#job#job-execute#job-execute.yml +++ b/support-files/templates/#etc#job#job-execute#job-execute.yml @@ -120,9 +120,9 @@ spring: maxConcurrency: 10 datasource: job-execute: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://__BK_JOB_EXECUTE_MYSQL_HOST__:__BK_JOB_EXECUTE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: jdbc:otel:mysql://__BK_JOB_EXECUTE_MYSQL_HOST__:__BK_JOB_EXECUTE_MYSQL_PORT__/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: __BK_JOB_EXECUTE_MYSQL_USERNAME__ password: __BK_JOB_EXECUTE_MYSQL_PASSWORD__ maximum-pool-size: 100 diff --git a/support-files/templates/#etc#job#job-file-gateway#job-file-gateway.yml b/support-files/templates/#etc#job#job-file-gateway#job-file-gateway.yml index 73c0ec98b1..24179650b0 100644 --- a/support-files/templates/#etc#job#job-file-gateway#job-file-gateway.yml +++ b/support-files/templates/#etc#job#job-file-gateway#job-file-gateway.yml @@ -3,9 +3,9 @@ spring: name: job-file-gateway datasource: job-file-gateway: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://__BK_JOB_FILE_GATEWAY_MYSQL_HOST__:__BK_JOB_FILE_GATEWAY_MYSQL_PORT__/job_file_gateway?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: jdbc:otel:mysql://__BK_JOB_FILE_GATEWAY_MYSQL_HOST__:__BK_JOB_FILE_GATEWAY_MYSQL_PORT__/job_file_gateway?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: __BK_JOB_FILE_GATEWAY_MYSQL_USERNAME__ password: __BK_JOB_FILE_GATEWAY_MYSQL_PASSWORD__ maximum-pool-size: 20 diff --git a/support-files/templates/#etc#job#job-manage#job-manage.yml b/support-files/templates/#etc#job#job-manage#job-manage.yml index 8c5627045f..6f8f9d76c1 100644 --- a/support-files/templates/#etc#job#job-manage#job-manage.yml +++ b/support-files/templates/#etc#job#job-manage#job-manage.yml @@ -3,9 +3,9 @@ spring: name: job-manage datasource: job-manage: - driver-class-name: com.mysql.cj.jdbc.Driver + driver-class-name: io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver type: com.zaxxer.hikari.HikariDataSource - jdbc-url: jdbc:mysql://__BK_JOB_MANAGE_MYSQL_HOST__:__BK_JOB_MANAGE_MYSQL_PORT__/job_manage?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: jdbc:otel:mysql://__BK_JOB_MANAGE_MYSQL_HOST__:__BK_JOB_MANAGE_MYSQL_PORT__/job_manage?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: __BK_JOB_MANAGE_MYSQL_USERNAME__ password: __BK_JOB_MANAGE_MYSQL_PASSWORD__ maximum-pool-size: 100 From f683f66c6b99aa701661fc4611b49f1c60177818 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Sun, 18 Sep 2022 18:14:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?perf:=20=E6=8E=A5=E5=85=A5=E8=93=9D?= =?UTF-8?q?=E9=B2=B8=E7=9B=91=E6=8E=A7APM=E8=B0=83=E7=94=A8=E9=93=BE?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA=20#1161?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 容器化配置调整 --- .../bk-job/templates/job-analysis/configmap.yaml | 4 ++-- .../bk-job/templates/job-backup/configmap.yaml | 12 ++++++------ .../bk-job/templates/job-crontab/configmap.yaml | 6 +++--- .../bk-job/templates/job-execute/configmap.yaml | 4 ++-- .../bk-job/templates/job-file-gateway/configmap.yaml | 4 ++-- .../bk-job/templates/job-manage/configmap.yaml | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml index 949a71e708..42ba016e7e 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-analysis/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-analysis: - driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} + driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml index 9092247b75..aa40f3dfe9 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-backup/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-backup: - driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} + driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_backup?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_backup?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} @@ -30,9 +30,9 @@ data: poolName: "job-backup" validationTimeout: 5000 job-execute-db: - driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} + driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} @@ -45,9 +45,9 @@ data: poolName: "job-execute-db" validationTimeout: 5000 job-execute-archive: - driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} + driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml index eb0aade3f9..6ca8d7a761 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-crontab/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-crontab: - driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} + driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} @@ -84,7 +84,7 @@ data: job: crontab: db: - url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_crontab?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml index 7ffee5ef6e..00712f6072 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-execute/configmap.yaml @@ -132,9 +132,9 @@ data: maxConcurrency: 10 datasource: job-execute: - driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} + driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_execute?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml index 15c1ecd9a3..860e1ffc5c 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-file-gateway/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-file-gateway: - driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} + driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_file_gateway?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_file_gateway?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }} diff --git a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml index 8eab670394..ca1a401ae9 100644 --- a/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml +++ b/support-files/kubernetes/charts/bk-job/templates/job-manage/configmap.yaml @@ -15,9 +15,9 @@ data: spring: datasource: job-manage: - driver-class-name: {{- include "job.jdbcMysqlDriverClass" . }} + driver-class-name: {{ include "job.jdbcMysqlDriverClass" . }} type: com.zaxxer.hikari.HikariDataSource - jdbc-url: {{- include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_manage?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull + jdbc-url: {{ include "job.jdbcMysqlScheme" . }}://{{- include "job.mariadb.host" . }}:{{- include "job.mariadb.port" . }}/job_manage?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull username: {{ include "job.mariadb.username" . }} {{ if .Values.externalMariaDB.existingPasswordSecret }} password: {{ .Values.externalMariaDB.existingPasswordKey | default "mariadb-password" | printf "${%s}" }}