From b9875a44d956015491f7a4e95dba52b9dcd97650 Mon Sep 17 00:00:00 2001 From: "sanhuan.sw" Date: Thu, 17 Aug 2023 16:40:23 +0800 Subject: [PATCH] feat: trace dynamic configuration --- .../dao/entity/TraceAgentConfPropDO.java | 304 +++++ .../entity/TraceAgentConfPropDOExample.java | 1042 +++++++++++++++++ ...DO.java => TraceAgentConfigurationDO.java} | 90 +- ... => TraceAgentConfigurationDOExample.java} | 331 ++++-- .../mapper/AgentConfigurationDOMapper.java | 79 -- .../mapper/TraceAgentConfPropDOMapper.java | 76 ++ .../TraceAgentConfigurationDOMapper.java | 78 ++ .../src/main/resources/generatorConfig.xml | 5 +- .../sqlmap/TraceAgentConfPropDOMapper.xml | 684 +++++++++++ ...ml => TraceAgentConfigurationDOMapper.xml} | 280 +++-- .../io/holoinsight/server/common/Const.java | 10 + ...CREATE_trace_agent_configuration_TABLE.sql | 38 + .../db/migration/V1__230301_INIT_DDL.sql | 14 - .../HoloinsightGatewayConfiguration.java | 15 +- .../core/trace/GatewayTraceConfiguration.java | 25 +- .../config/GetAgentConfigurationService.java | 118 -- ...tion.java => TraceAgentConfiguration.java} | 37 +- .../TraceAgentConfigurationService.java | 60 + .../AgentConfigurationController.java | 49 - .../TraceAgentConfigurationController.java | 98 ++ ... => TraceAgentConfigurationScheduler.java} | 21 +- .../HoloinsightHomeConfiguration.java | 6 + ...per.java => TraceAgentConfPropMapper.java} | 4 +- .../mapper/TraceAgentConfigurationMapper.java | 10 + .../home/dal/model/TraceAgentConfProp.java | 28 + ...tion.java => TraceAgentConfiguration.java} | 14 +- .../service/AgentConfigurationService.java | 16 - .../service/TraceAgentConfPropService.java | 16 + .../TraceAgentConfigurationService.java | 16 + .../impl/TraceAgentConfPropServiceImpl.java | 32 + ...> TraceAgentConfigurationServiceImpl.java} | 31 +- .../web/controller/TraceAgentFacadeImpl.java | 119 ++ 32 files changed, 3118 insertions(+), 628 deletions(-) create mode 100644 server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfPropDO.java create mode 100644 server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfPropDOExample.java rename server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/{AgentConfigurationDO.java => TraceAgentConfigurationDO.java} (69%) rename server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/{AgentConfigurationDOExample.java => TraceAgentConfigurationDOExample.java} (65%) delete mode 100644 server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/AgentConfigurationDOMapper.java create mode 100644 server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/TraceAgentConfPropDOMapper.java create mode 100644 server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/TraceAgentConfigurationDOMapper.java create mode 100644 server/common/common-dao-gen/src/main/resources/sqlmap/TraceAgentConfPropDOMapper.xml rename server/common/common-dao-gen/src/main/resources/sqlmap/{AgentConfigurationDOMapper.xml => TraceAgentConfigurationDOMapper.xml} (69%) create mode 100644 server/common/common/src/main/java/io/holoinsight/server/common/Const.java create mode 100644 server/extension/extension-common-flyway/src/main/resources/db/migration/V16__230814_CREATE_trace_agent_configuration_TABLE.sql delete mode 100644 server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/GetAgentConfigurationService.java rename server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/{AgentConfiguration.java => TraceAgentConfiguration.java} (51%) create mode 100644 server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/TraceAgentConfigurationService.java delete mode 100644 server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/controller/AgentConfigurationController.java create mode 100644 server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/controller/TraceAgentConfigurationController.java rename server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/scheduler/{AgentConfigurationScheduler.java => TraceAgentConfigurationScheduler.java} (64%) rename server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/{AgentConfigurationMapper.java => TraceAgentConfPropMapper.java} (56%) create mode 100644 server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/TraceAgentConfigurationMapper.java create mode 100644 server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/TraceAgentConfProp.java rename server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/{AgentConfiguration.java => TraceAgentConfiguration.java} (72%) delete mode 100644 server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/AgentConfigurationService.java create mode 100644 server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/TraceAgentConfPropService.java create mode 100644 server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/TraceAgentConfigurationService.java create mode 100644 server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/TraceAgentConfPropServiceImpl.java rename server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/{AgentConfigurationServiceImpl.java => TraceAgentConfigurationServiceImpl.java} (52%) diff --git a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfPropDO.java b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfPropDO.java new file mode 100644 index 000000000..dc0789ab6 --- /dev/null +++ b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfPropDO.java @@ -0,0 +1,304 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.common.dao.entity; + +import java.util.ArrayList; +import java.util.Arrays; + +public class TraceAgentConfPropDO { + private Long id; + + private String type; + + private String language; + + private String propKey; + + private String name; + + private String cName; + + private String checkExpression; + + private String description; + + private String cDescription; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type == null ? null : type.trim(); + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language == null ? null : language.trim(); + } + + public String getPropKey() { + return propKey; + } + + public void setPropKey(String propKey) { + this.propKey = propKey == null ? null : propKey.trim(); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + public String getcName() { + return cName; + } + + public void setcName(String cName) { + this.cName = cName == null ? null : cName.trim(); + } + + public String getCheckExpression() { + return checkExpression; + } + + public void setCheckExpression(String checkExpression) { + this.checkExpression = checkExpression == null ? null : checkExpression.trim(); + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description == null ? null : description.trim(); + } + + public String getcDescription() { + return cDescription; + } + + public void setcDescription(String cDescription) { + this.cDescription = cDescription == null ? null : cDescription.trim(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", type=").append(type); + sb.append(", language=").append(language); + sb.append(", propKey=").append(propKey); + sb.append(", name=").append(name); + sb.append(", cName=").append(cName); + sb.append(", checkExpression=").append(checkExpression); + sb.append(", description=").append(description); + sb.append(", cDescription=").append(cDescription); + sb.append("]"); + return sb.toString(); + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + TraceAgentConfPropDO other = (TraceAgentConfPropDO) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getType() == null ? other.getType() == null + : this.getType().equals(other.getType())) + && (this.getLanguage() == null ? other.getLanguage() == null + : this.getLanguage().equals(other.getLanguage())) + && (this.getPropKey() == null ? other.getPropKey() == null + : this.getPropKey().equals(other.getPropKey())) + && (this.getName() == null ? other.getName() == null + : this.getName().equals(other.getName())) + && (this.getcName() == null ? other.getcName() == null + : this.getcName().equals(other.getcName())) + && (this.getCheckExpression() == null ? other.getCheckExpression() == null + : this.getCheckExpression().equals(other.getCheckExpression())) + && (this.getDescription() == null ? other.getDescription() == null + : this.getDescription().equals(other.getDescription())) + && (this.getcDescription() == null ? other.getcDescription() == null + : this.getcDescription().equals(other.getcDescription())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); + result = prime * result + ((getLanguage() == null) ? 0 : getLanguage().hashCode()); + result = prime * result + ((getPropKey() == null) ? 0 : getPropKey().hashCode()); + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getcName() == null) ? 0 : getcName().hashCode()); + result = + prime * result + ((getCheckExpression() == null) ? 0 : getCheckExpression().hashCode()); + result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode()); + result = prime * result + ((getcDescription() == null) ? 0 : getcDescription().hashCode()); + return result; + } + + public static TraceAgentConfPropDO.Builder builder() { + return new TraceAgentConfPropDO.Builder(); + } + + public static class Builder { + private TraceAgentConfPropDO obj; + + public Builder() { + this.obj = new TraceAgentConfPropDO(); + } + + public Builder id(Long id) { + obj.setId(id); + return this; + } + + public Builder type(String type) { + obj.setType(type); + return this; + } + + public Builder language(String language) { + obj.setLanguage(language); + return this; + } + + public Builder propKey(String propKey) { + obj.setPropKey(propKey); + return this; + } + + public Builder name(String name) { + obj.setName(name); + return this; + } + + public Builder cName(String cName) { + obj.setcName(cName); + return this; + } + + public Builder checkExpression(String checkExpression) { + obj.setCheckExpression(checkExpression); + return this; + } + + public Builder description(String description) { + obj.setDescription(description); + return this; + } + + public Builder cDescription(String cDescription) { + obj.setcDescription(cDescription); + return this; + } + + public TraceAgentConfPropDO build() { + return this.obj; + } + } + + public enum Column { + id("id", "id", "BIGINT", false), type("type", "type", "VARCHAR", true), language("language", + "language", "VARCHAR", true), propKey("prop_key", "propKey", "VARCHAR", false), name("name", + "name", "VARCHAR", true), cName("c_name", "cName", "VARCHAR", false), checkExpression( + "check_expression", "checkExpression", "VARCHAR", false), description("description", + "description", "LONGVARCHAR", + false), cDescription("c_description", "cDescription", "LONGVARCHAR", false); + + private static final String BEGINNING_DELIMITER = "`"; + + private static final String ENDING_DELIMITER = "`"; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[] {}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column) + .append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} diff --git a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfPropDOExample.java b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfPropDOExample.java new file mode 100644 index 000000000..1e7e32a11 --- /dev/null +++ b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfPropDOExample.java @@ -0,0 +1,1042 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.common.dao.entity; + +import java.util.ArrayList; +import java.util.List; + +public class TraceAgentConfPropDOExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + protected Integer offset; + + protected Integer rows; + + public TraceAgentConfPropDOExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public TraceAgentConfPropDOExample orderBy(String orderByClause) { + this.setOrderByClause(orderByClause); + return this; + } + + public TraceAgentConfPropDOExample orderBy(String... orderByClauses) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < orderByClauses.length; i++) { + sb.append(orderByClauses[i]); + if (i < orderByClauses.length - 1) { + sb.append(" , "); + } + } + this.setOrderByClause(sb.toString()); + return this; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(this); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + rows = null; + offset = null; + } + + public void setOffset(Integer offset) { + this.offset = offset; + } + + public Integer getOffset() { + return this.offset; + } + + public void setRows(Integer rows) { + this.rows = rows; + } + + public Integer getRows() { + return this.rows; + } + + public TraceAgentConfPropDOExample limit(Integer rows) { + this.rows = rows; + return this; + } + + public TraceAgentConfPropDOExample limit(Integer offset, Integer rows) { + this.offset = offset; + this.rows = rows; + return this; + } + + public TraceAgentConfPropDOExample page(Integer page, Integer pageSize) { + this.offset = page * pageSize; + this.rows = pageSize; + return this; + } + + public static Criteria newAndCreateCriteria() { + TraceAgentConfPropDOExample example = new TraceAgentConfPropDOExample(); + return example.createCriteria(); + } + + public TraceAgentConfPropDOExample when(boolean condition, IExampleWhen then) { + if (condition) { + then.example(this); + } + return this; + } + + public TraceAgentConfPropDOExample when(boolean condition, IExampleWhen then, + IExampleWhen otherwise) { + if (condition) { + then.example(this); + } else { + otherwise.example(this); + } + return this; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andTypeIsNull() { + addCriterion("`type` is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("`type` is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(String value) { + addCriterion("`type` =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(String value) { + addCriterion("`type` <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(String value) { + addCriterion("`type` >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(String value) { + addCriterion("`type` >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andTypeLessThan(String value) { + addCriterion("`type` <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(String value) { + addCriterion("`type` <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andTypeLike(String value) { + addCriterion("`type` like", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotLike(String value) { + addCriterion("`type` not like", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("`type` in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("`type` not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(String value1, String value2) { + addCriterion("`type` between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(String value1, String value2) { + addCriterion("`type` not between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andLanguageIsNull() { + addCriterion("`language` is null"); + return (Criteria) this; + } + + public Criteria andLanguageIsNotNull() { + addCriterion("`language` is not null"); + return (Criteria) this; + } + + public Criteria andLanguageEqualTo(String value) { + addCriterion("`language` =", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`language` = ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andLanguageNotEqualTo(String value) { + addCriterion("`language` <>", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageNotEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`language` <> ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andLanguageGreaterThan(String value) { + addCriterion("`language` >", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageGreaterThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`language` > ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andLanguageGreaterThanOrEqualTo(String value) { + addCriterion("`language` >=", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageGreaterThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`language` >= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andLanguageLessThan(String value) { + addCriterion("`language` <", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageLessThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`language` < ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andLanguageLessThanOrEqualTo(String value) { + addCriterion("`language` <=", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageLessThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`language` <= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andLanguageLike(String value) { + addCriterion("`language` like", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageNotLike(String value) { + addCriterion("`language` not like", value, "language"); + return (Criteria) this; + } + + public Criteria andLanguageIn(List values) { + addCriterion("`language` in", values, "language"); + return (Criteria) this; + } + + public Criteria andLanguageNotIn(List values) { + addCriterion("`language` not in", values, "language"); + return (Criteria) this; + } + + public Criteria andLanguageBetween(String value1, String value2) { + addCriterion("`language` between", value1, value2, "language"); + return (Criteria) this; + } + + public Criteria andLanguageNotBetween(String value1, String value2) { + addCriterion("`language` not between", value1, value2, "language"); + return (Criteria) this; + } + + public Criteria andPropKeyIsNull() { + addCriterion("prop_key is null"); + return (Criteria) this; + } + + public Criteria andPropKeyIsNotNull() { + addCriterion("prop_key is not null"); + return (Criteria) this; + } + + public Criteria andPropKeyEqualTo(String value) { + addCriterion("prop_key =", value, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("prop_key = ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andPropKeyNotEqualTo(String value) { + addCriterion("prop_key <>", value, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyNotEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("prop_key <> ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andPropKeyGreaterThan(String value) { + addCriterion("prop_key >", value, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyGreaterThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("prop_key > ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andPropKeyGreaterThanOrEqualTo(String value) { + addCriterion("prop_key >=", value, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyGreaterThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("prop_key >= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andPropKeyLessThan(String value) { + addCriterion("prop_key <", value, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyLessThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("prop_key < ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andPropKeyLessThanOrEqualTo(String value) { + addCriterion("prop_key <=", value, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyLessThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("prop_key <= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andPropKeyLike(String value) { + addCriterion("prop_key like", value, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyNotLike(String value) { + addCriterion("prop_key not like", value, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyIn(List values) { + addCriterion("prop_key in", values, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyNotIn(List values) { + addCriterion("prop_key not in", values, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyBetween(String value1, String value2) { + addCriterion("prop_key between", value1, value2, "propKey"); + return (Criteria) this; + } + + public Criteria andPropKeyNotBetween(String value1, String value2) { + addCriterion("prop_key not between", value1, value2, "propKey"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("`name` is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("`name` is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("`name` =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("`name` = ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("`name` <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`name` <> ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("`name` >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("`name` > ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("`name` >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`name` >= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("`name` <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("`name` < ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("`name` <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("`name` <= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("`name` like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("`name` not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("`name` in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("`name` not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("`name` between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("`name` not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andCNameIsNull() { + addCriterion("c_name is null"); + return (Criteria) this; + } + + public Criteria andCNameIsNotNull() { + addCriterion("c_name is not null"); + return (Criteria) this; + } + + public Criteria andCNameEqualTo(String value) { + addCriterion("c_name =", value, "cName"); + return (Criteria) this; + } + + public Criteria andCNameEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("c_name = ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andCNameNotEqualTo(String value) { + addCriterion("c_name <>", value, "cName"); + return (Criteria) this; + } + + public Criteria andCNameNotEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("c_name <> ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andCNameGreaterThan(String value) { + addCriterion("c_name >", value, "cName"); + return (Criteria) this; + } + + public Criteria andCNameGreaterThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("c_name > ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andCNameGreaterThanOrEqualTo(String value) { + addCriterion("c_name >=", value, "cName"); + return (Criteria) this; + } + + public Criteria andCNameGreaterThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("c_name >= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andCNameLessThan(String value) { + addCriterion("c_name <", value, "cName"); + return (Criteria) this; + } + + public Criteria andCNameLessThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("c_name < ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andCNameLessThanOrEqualTo(String value) { + addCriterion("c_name <=", value, "cName"); + return (Criteria) this; + } + + public Criteria andCNameLessThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion( + new StringBuilder("c_name <= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andCNameLike(String value) { + addCriterion("c_name like", value, "cName"); + return (Criteria) this; + } + + public Criteria andCNameNotLike(String value) { + addCriterion("c_name not like", value, "cName"); + return (Criteria) this; + } + + public Criteria andCNameIn(List values) { + addCriterion("c_name in", values, "cName"); + return (Criteria) this; + } + + public Criteria andCNameNotIn(List values) { + addCriterion("c_name not in", values, "cName"); + return (Criteria) this; + } + + public Criteria andCNameBetween(String value1, String value2) { + addCriterion("c_name between", value1, value2, "cName"); + return (Criteria) this; + } + + public Criteria andCNameNotBetween(String value1, String value2) { + addCriterion("c_name not between", value1, value2, "cName"); + return (Criteria) this; + } + + public Criteria andCheckExpressionIsNull() { + addCriterion("check_expression is null"); + return (Criteria) this; + } + + public Criteria andCheckExpressionIsNotNull() { + addCriterion("check_expression is not null"); + return (Criteria) this; + } + + public Criteria andCheckExpressionEqualTo(String value) { + addCriterion("check_expression =", value, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("check_expression = ").append(column.getEscapedColumnName()) + .toString()); + return (Criteria) this; + } + + public Criteria andCheckExpressionNotEqualTo(String value) { + addCriterion("check_expression <>", value, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionNotEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("check_expression <> ").append(column.getEscapedColumnName()) + .toString()); + return (Criteria) this; + } + + public Criteria andCheckExpressionGreaterThan(String value) { + addCriterion("check_expression >", value, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionGreaterThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("check_expression > ").append(column.getEscapedColumnName()) + .toString()); + return (Criteria) this; + } + + public Criteria andCheckExpressionGreaterThanOrEqualTo(String value) { + addCriterion("check_expression >=", value, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionGreaterThanOrEqualToColumn( + TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("check_expression >= ").append(column.getEscapedColumnName()) + .toString()); + return (Criteria) this; + } + + public Criteria andCheckExpressionLessThan(String value) { + addCriterion("check_expression <", value, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionLessThanColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("check_expression < ").append(column.getEscapedColumnName()) + .toString()); + return (Criteria) this; + } + + public Criteria andCheckExpressionLessThanOrEqualTo(String value) { + addCriterion("check_expression <=", value, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionLessThanOrEqualToColumn(TraceAgentConfPropDO.Column column) { + addCriterion(new StringBuilder("check_expression <= ").append(column.getEscapedColumnName()) + .toString()); + return (Criteria) this; + } + + public Criteria andCheckExpressionLike(String value) { + addCriterion("check_expression like", value, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionNotLike(String value) { + addCriterion("check_expression not like", value, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionIn(List values) { + addCriterion("check_expression in", values, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionNotIn(List values) { + addCriterion("check_expression not in", values, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionBetween(String value1, String value2) { + addCriterion("check_expression between", value1, value2, "checkExpression"); + return (Criteria) this; + } + + public Criteria andCheckExpressionNotBetween(String value1, String value2) { + addCriterion("check_expression not between", value1, value2, "checkExpression"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + private TraceAgentConfPropDOExample example; + + protected Criteria(TraceAgentConfPropDOExample example) { + super(); + this.example = example; + } + + public TraceAgentConfPropDOExample example() { + return this.example; + } + + @Deprecated + public Criteria andIf(boolean ifAdd, ICriteriaAdd add) { + if (ifAdd) { + add.add(this); + } + return this; + } + + public Criteria when(boolean condition, ICriteriaWhen then) { + if (condition) { + then.criteria(this); + } + return this; + } + + public Criteria when(boolean condition, ICriteriaWhen then, ICriteriaWhen otherwise) { + if (condition) { + then.criteria(this); + } else { + otherwise.criteria(this); + } + return this; + } + + @Deprecated + public interface ICriteriaAdd { + Criteria add(Criteria add); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } + + public interface ICriteriaWhen { + void criteria(Criteria criteria); + } + + public interface IExampleWhen { + void example(io.holoinsight.server.common.dao.entity.TraceAgentConfPropDOExample example); + } +} diff --git a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/AgentConfigurationDO.java b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfigurationDO.java similarity index 69% rename from server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/AgentConfigurationDO.java rename to server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfigurationDO.java index 5d866671a..03e86cbaa 100644 --- a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/AgentConfigurationDO.java +++ b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfigurationDO.java @@ -7,14 +7,16 @@ import java.util.Arrays; import java.util.Date; -public class AgentConfigurationDO { +public class TraceAgentConfigurationDO { + private Long id; + private String tenant; private String service; - private String appId; + private String type; - private String envId; + private String language; private Date gmtCreate; @@ -22,6 +24,14 @@ public class AgentConfigurationDO { private String value; + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + public String getTenant() { return tenant; } @@ -38,20 +48,20 @@ public void setService(String service) { this.service = service == null ? null : service.trim(); } - public String getAppId() { - return appId; + public String getType() { + return type; } - public void setAppId(String appId) { - this.appId = appId == null ? null : appId.trim(); + public void setType(String type) { + this.type = type == null ? null : type.trim(); } - public String getEnvId() { - return envId; + public String getLanguage() { + return language; } - public void setEnvId(String envId) { - this.envId = envId == null ? null : envId.trim(); + public void setLanguage(String language) { + this.language = language == null ? null : language.trim(); } public Date getGmtCreate() { @@ -84,10 +94,11 @@ public String toString() { sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); sb.append(", tenant=").append(tenant); sb.append(", service=").append(service); - sb.append(", appId=").append(appId); - sb.append(", envId=").append(envId); + sb.append(", type=").append(type); + sb.append(", language=").append(language); sb.append(", gmtCreate=").append(gmtCreate); sb.append(", gmtModified=").append(gmtModified); sb.append(", value=").append(value); @@ -106,15 +117,16 @@ public boolean equals(Object that) { if (getClass() != that.getClass()) { return false; } - AgentConfigurationDO other = (AgentConfigurationDO) that; - return (this.getTenant() == null ? other.getTenant() == null - : this.getTenant().equals(other.getTenant())) + TraceAgentConfigurationDO other = (TraceAgentConfigurationDO) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getTenant() == null ? other.getTenant() == null + : this.getTenant().equals(other.getTenant())) && (this.getService() == null ? other.getService() == null : this.getService().equals(other.getService())) - && (this.getAppId() == null ? other.getAppId() == null - : this.getAppId().equals(other.getAppId())) - && (this.getEnvId() == null ? other.getEnvId() == null - : this.getEnvId().equals(other.getEnvId())) + && (this.getType() == null ? other.getType() == null + : this.getType().equals(other.getType())) + && (this.getLanguage() == null ? other.getLanguage() == null + : this.getLanguage().equals(other.getLanguage())) && (this.getGmtCreate() == null ? other.getGmtCreate() == null : this.getGmtCreate().equals(other.getGmtCreate())) && (this.getGmtModified() == null ? other.getGmtModified() == null @@ -127,25 +139,31 @@ public boolean equals(Object that) { public int hashCode() { final int prime = 31; int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getTenant() == null) ? 0 : getTenant().hashCode()); result = prime * result + ((getService() == null) ? 0 : getService().hashCode()); - result = prime * result + ((getAppId() == null) ? 0 : getAppId().hashCode()); - result = prime * result + ((getEnvId() == null) ? 0 : getEnvId().hashCode()); + result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); + result = prime * result + ((getLanguage() == null) ? 0 : getLanguage().hashCode()); result = prime * result + ((getGmtCreate() == null) ? 0 : getGmtCreate().hashCode()); result = prime * result + ((getGmtModified() == null) ? 0 : getGmtModified().hashCode()); result = prime * result + ((getValue() == null) ? 0 : getValue().hashCode()); return result; } - public static AgentConfigurationDO.Builder builder() { - return new AgentConfigurationDO.Builder(); + public static TraceAgentConfigurationDO.Builder builder() { + return new TraceAgentConfigurationDO.Builder(); } public static class Builder { - private AgentConfigurationDO obj; + private TraceAgentConfigurationDO obj; public Builder() { - this.obj = new AgentConfigurationDO(); + this.obj = new TraceAgentConfigurationDO(); + } + + public Builder id(Long id) { + obj.setId(id); + return this; } public Builder tenant(String tenant) { @@ -158,13 +176,13 @@ public Builder service(String service) { return this; } - public Builder appId(String appId) { - obj.setAppId(appId); + public Builder type(String type) { + obj.setType(type); return this; } - public Builder envId(String envId) { - obj.setEnvId(envId); + public Builder language(String language) { + obj.setLanguage(language); return this; } @@ -183,17 +201,17 @@ public Builder value(String value) { return this; } - public AgentConfigurationDO build() { + public TraceAgentConfigurationDO build() { return this.obj; } } public enum Column { - tenant("tenant", "tenant", "VARCHAR", false), service("service", "service", "VARCHAR", - false), appId("app_id", "appId", "VARCHAR", false), envId("env_id", "envId", "VARCHAR", - false), gmtCreate("gmt_create", "gmtCreate", "TIMESTAMP", false), gmtModified( - "gmt_modified", "gmtModified", "TIMESTAMP", - false), value("value", "value", "LONGVARCHAR", true); + id("id", "id", "BIGINT", false), tenant("tenant", "tenant", "VARCHAR", false), service( + "service", "service", "VARCHAR", false), type("type", "type", "VARCHAR", + true), language("language", "language", "VARCHAR", true), gmtCreate("gmt_create", + "gmtCreate", "TIMESTAMP", false), gmtModified("gmt_modified", "gmtModified", + "TIMESTAMP", false), value("value", "value", "LONGVARCHAR", true); private static final String BEGINNING_DELIMITER = "`"; diff --git a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/AgentConfigurationDOExample.java b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfigurationDOExample.java similarity index 65% rename from server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/AgentConfigurationDOExample.java rename to server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfigurationDOExample.java index 6af12b7fc..80c74acec 100644 --- a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/AgentConfigurationDOExample.java +++ b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/entity/TraceAgentConfigurationDOExample.java @@ -7,7 +7,7 @@ import java.util.Date; import java.util.List; -public class AgentConfigurationDOExample { +public class TraceAgentConfigurationDOExample { protected String orderByClause; protected boolean distinct; @@ -18,7 +18,7 @@ public class AgentConfigurationDOExample { protected Integer rows; - public AgentConfigurationDOExample() { + public TraceAgentConfigurationDOExample() { oredCriteria = new ArrayList(); } @@ -52,12 +52,12 @@ public Criteria or() { return criteria; } - public AgentConfigurationDOExample orderBy(String orderByClause) { + public TraceAgentConfigurationDOExample orderBy(String orderByClause) { this.setOrderByClause(orderByClause); return this; } - public AgentConfigurationDOExample orderBy(String... orderByClauses) { + public TraceAgentConfigurationDOExample orderBy(String... orderByClauses) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < orderByClauses.length; i++) { sb.append(orderByClauses[i]); @@ -106,36 +106,36 @@ public Integer getRows() { return this.rows; } - public AgentConfigurationDOExample limit(Integer rows) { + public TraceAgentConfigurationDOExample limit(Integer rows) { this.rows = rows; return this; } - public AgentConfigurationDOExample limit(Integer offset, Integer rows) { + public TraceAgentConfigurationDOExample limit(Integer offset, Integer rows) { this.offset = offset; this.rows = rows; return this; } - public AgentConfigurationDOExample page(Integer page, Integer pageSize) { + public TraceAgentConfigurationDOExample page(Integer page, Integer pageSize) { this.offset = page * pageSize; this.rows = pageSize; return this; } public static Criteria newAndCreateCriteria() { - AgentConfigurationDOExample example = new AgentConfigurationDOExample(); + TraceAgentConfigurationDOExample example = new TraceAgentConfigurationDOExample(); return example.createCriteria(); } - public AgentConfigurationDOExample when(boolean condition, IExampleWhen then) { + public TraceAgentConfigurationDOExample when(boolean condition, IExampleWhen then) { if (condition) { then.example(this); } return this; } - public AgentConfigurationDOExample when(boolean condition, IExampleWhen then, + public TraceAgentConfigurationDOExample when(boolean condition, IExampleWhen then, IExampleWhen otherwise) { if (condition) { then.example(this); @@ -186,6 +186,96 @@ protected void addCriterion(String condition, Object value1, Object value2, Stri criteria.add(new Criterion(condition, value1, value2)); } + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdEqualToColumn(TraceAgentConfigurationDO.Column column) { + addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualToColumn(TraceAgentConfigurationDO.Column column) { + addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanColumn(TraceAgentConfigurationDO.Column column) { + addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { + addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanColumn(TraceAgentConfigurationDO.Column column) { + addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { + addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString()); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + public Criteria andTenantIsNull() { addCriterion("tenant is null"); return (Criteria) this; @@ -201,7 +291,7 @@ public Criteria andTenantEqualTo(String value) { return (Criteria) this; } - public Criteria andTenantEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andTenantEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion(new StringBuilder("tenant = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } @@ -211,7 +301,7 @@ public Criteria andTenantNotEqualTo(String value) { return (Criteria) this; } - public Criteria andTenantNotEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andTenantNotEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("tenant <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -222,7 +312,7 @@ public Criteria andTenantGreaterThan(String value) { return (Criteria) this; } - public Criteria andTenantGreaterThanColumn(AgentConfigurationDO.Column column) { + public Criteria andTenantGreaterThanColumn(TraceAgentConfigurationDO.Column column) { addCriterion(new StringBuilder("tenant > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } @@ -232,7 +322,7 @@ public Criteria andTenantGreaterThanOrEqualTo(String value) { return (Criteria) this; } - public Criteria andTenantGreaterThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andTenantGreaterThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("tenant >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -243,7 +333,7 @@ public Criteria andTenantLessThan(String value) { return (Criteria) this; } - public Criteria andTenantLessThanColumn(AgentConfigurationDO.Column column) { + public Criteria andTenantLessThanColumn(TraceAgentConfigurationDO.Column column) { addCriterion(new StringBuilder("tenant < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } @@ -253,7 +343,7 @@ public Criteria andTenantLessThanOrEqualTo(String value) { return (Criteria) this; } - public Criteria andTenantLessThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andTenantLessThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("tenant <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -304,7 +394,7 @@ public Criteria andServiceEqualTo(String value) { return (Criteria) this; } - public Criteria andServiceEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andServiceEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("service = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -315,7 +405,7 @@ public Criteria andServiceNotEqualTo(String value) { return (Criteria) this; } - public Criteria andServiceNotEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andServiceNotEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("service <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -326,7 +416,7 @@ public Criteria andServiceGreaterThan(String value) { return (Criteria) this; } - public Criteria andServiceGreaterThanColumn(AgentConfigurationDO.Column column) { + public Criteria andServiceGreaterThanColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("service > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -337,7 +427,7 @@ public Criteria andServiceGreaterThanOrEqualTo(String value) { return (Criteria) this; } - public Criteria andServiceGreaterThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andServiceGreaterThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("service >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -348,7 +438,7 @@ public Criteria andServiceLessThan(String value) { return (Criteria) this; } - public Criteria andServiceLessThanColumn(AgentConfigurationDO.Column column) { + public Criteria andServiceLessThanColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("service < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -359,7 +449,7 @@ public Criteria andServiceLessThanOrEqualTo(String value) { return (Criteria) this; } - public Criteria andServiceLessThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andServiceLessThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("service <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -395,209 +485,212 @@ public Criteria andServiceNotBetween(String value1, String value2) { return (Criteria) this; } - public Criteria andAppIdIsNull() { - addCriterion("app_id is null"); + public Criteria andTypeIsNull() { + addCriterion("`type` is null"); return (Criteria) this; } - public Criteria andAppIdIsNotNull() { - addCriterion("app_id is not null"); + public Criteria andTypeIsNotNull() { + addCriterion("`type` is not null"); return (Criteria) this; } - public Criteria andAppIdEqualTo(String value) { - addCriterion("app_id =", value, "appId"); + public Criteria andTypeEqualTo(String value) { + addCriterion("`type` =", value, "type"); return (Criteria) this; } - public Criteria andAppIdEqualToColumn(AgentConfigurationDO.Column column) { - addCriterion(new StringBuilder("app_id = ").append(column.getEscapedColumnName()).toString()); + public Criteria andTypeEqualToColumn(TraceAgentConfigurationDO.Column column) { + addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andAppIdNotEqualTo(String value) { - addCriterion("app_id <>", value, "appId"); + public Criteria andTypeNotEqualTo(String value) { + addCriterion("`type` <>", value, "type"); return (Criteria) this; } - public Criteria andAppIdNotEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andTypeNotEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( - new StringBuilder("app_id <> ").append(column.getEscapedColumnName()).toString()); + new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andAppIdGreaterThan(String value) { - addCriterion("app_id >", value, "appId"); + public Criteria andTypeGreaterThan(String value) { + addCriterion("`type` >", value, "type"); return (Criteria) this; } - public Criteria andAppIdGreaterThanColumn(AgentConfigurationDO.Column column) { - addCriterion(new StringBuilder("app_id > ").append(column.getEscapedColumnName()).toString()); + public Criteria andTypeGreaterThanColumn(TraceAgentConfigurationDO.Column column) { + addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andAppIdGreaterThanOrEqualTo(String value) { - addCriterion("app_id >=", value, "appId"); + public Criteria andTypeGreaterThanOrEqualTo(String value) { + addCriterion("`type` >=", value, "type"); return (Criteria) this; } - public Criteria andAppIdGreaterThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andTypeGreaterThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( - new StringBuilder("app_id >= ").append(column.getEscapedColumnName()).toString()); + new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andAppIdLessThan(String value) { - addCriterion("app_id <", value, "appId"); + public Criteria andTypeLessThan(String value) { + addCriterion("`type` <", value, "type"); return (Criteria) this; } - public Criteria andAppIdLessThanColumn(AgentConfigurationDO.Column column) { - addCriterion(new StringBuilder("app_id < ").append(column.getEscapedColumnName()).toString()); + public Criteria andTypeLessThanColumn(TraceAgentConfigurationDO.Column column) { + addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andAppIdLessThanOrEqualTo(String value) { - addCriterion("app_id <=", value, "appId"); + public Criteria andTypeLessThanOrEqualTo(String value) { + addCriterion("`type` <=", value, "type"); return (Criteria) this; } - public Criteria andAppIdLessThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andTypeLessThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( - new StringBuilder("app_id <= ").append(column.getEscapedColumnName()).toString()); + new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andAppIdLike(String value) { - addCriterion("app_id like", value, "appId"); + public Criteria andTypeLike(String value) { + addCriterion("`type` like", value, "type"); return (Criteria) this; } - public Criteria andAppIdNotLike(String value) { - addCriterion("app_id not like", value, "appId"); + public Criteria andTypeNotLike(String value) { + addCriterion("`type` not like", value, "type"); return (Criteria) this; } - public Criteria andAppIdIn(List values) { - addCriterion("app_id in", values, "appId"); + public Criteria andTypeIn(List values) { + addCriterion("`type` in", values, "type"); return (Criteria) this; } - public Criteria andAppIdNotIn(List values) { - addCriterion("app_id not in", values, "appId"); + public Criteria andTypeNotIn(List values) { + addCriterion("`type` not in", values, "type"); return (Criteria) this; } - public Criteria andAppIdBetween(String value1, String value2) { - addCriterion("app_id between", value1, value2, "appId"); + public Criteria andTypeBetween(String value1, String value2) { + addCriterion("`type` between", value1, value2, "type"); return (Criteria) this; } - public Criteria andAppIdNotBetween(String value1, String value2) { - addCriterion("app_id not between", value1, value2, "appId"); + public Criteria andTypeNotBetween(String value1, String value2) { + addCriterion("`type` not between", value1, value2, "type"); return (Criteria) this; } - public Criteria andEnvIdIsNull() { - addCriterion("env_id is null"); + public Criteria andLanguageIsNull() { + addCriterion("`language` is null"); return (Criteria) this; } - public Criteria andEnvIdIsNotNull() { - addCriterion("env_id is not null"); + public Criteria andLanguageIsNotNull() { + addCriterion("`language` is not null"); return (Criteria) this; } - public Criteria andEnvIdEqualTo(String value) { - addCriterion("env_id =", value, "envId"); + public Criteria andLanguageEqualTo(String value) { + addCriterion("`language` =", value, "language"); return (Criteria) this; } - public Criteria andEnvIdEqualToColumn(AgentConfigurationDO.Column column) { - addCriterion(new StringBuilder("env_id = ").append(column.getEscapedColumnName()).toString()); + public Criteria andLanguageEqualToColumn(TraceAgentConfigurationDO.Column column) { + addCriterion( + new StringBuilder("`language` = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andEnvIdNotEqualTo(String value) { - addCriterion("env_id <>", value, "envId"); + public Criteria andLanguageNotEqualTo(String value) { + addCriterion("`language` <>", value, "language"); return (Criteria) this; } - public Criteria andEnvIdNotEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andLanguageNotEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( - new StringBuilder("env_id <> ").append(column.getEscapedColumnName()).toString()); + new StringBuilder("`language` <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andEnvIdGreaterThan(String value) { - addCriterion("env_id >", value, "envId"); + public Criteria andLanguageGreaterThan(String value) { + addCriterion("`language` >", value, "language"); return (Criteria) this; } - public Criteria andEnvIdGreaterThanColumn(AgentConfigurationDO.Column column) { - addCriterion(new StringBuilder("env_id > ").append(column.getEscapedColumnName()).toString()); + public Criteria andLanguageGreaterThanColumn(TraceAgentConfigurationDO.Column column) { + addCriterion( + new StringBuilder("`language` > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andEnvIdGreaterThanOrEqualTo(String value) { - addCriterion("env_id >=", value, "envId"); + public Criteria andLanguageGreaterThanOrEqualTo(String value) { + addCriterion("`language` >=", value, "language"); return (Criteria) this; } - public Criteria andEnvIdGreaterThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andLanguageGreaterThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( - new StringBuilder("env_id >= ").append(column.getEscapedColumnName()).toString()); + new StringBuilder("`language` >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andEnvIdLessThan(String value) { - addCriterion("env_id <", value, "envId"); + public Criteria andLanguageLessThan(String value) { + addCriterion("`language` <", value, "language"); return (Criteria) this; } - public Criteria andEnvIdLessThanColumn(AgentConfigurationDO.Column column) { - addCriterion(new StringBuilder("env_id < ").append(column.getEscapedColumnName()).toString()); + public Criteria andLanguageLessThanColumn(TraceAgentConfigurationDO.Column column) { + addCriterion( + new StringBuilder("`language` < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andEnvIdLessThanOrEqualTo(String value) { - addCriterion("env_id <=", value, "envId"); + public Criteria andLanguageLessThanOrEqualTo(String value) { + addCriterion("`language` <=", value, "language"); return (Criteria) this; } - public Criteria andEnvIdLessThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andLanguageLessThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( - new StringBuilder("env_id <= ").append(column.getEscapedColumnName()).toString()); + new StringBuilder("`language` <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; } - public Criteria andEnvIdLike(String value) { - addCriterion("env_id like", value, "envId"); + public Criteria andLanguageLike(String value) { + addCriterion("`language` like", value, "language"); return (Criteria) this; } - public Criteria andEnvIdNotLike(String value) { - addCriterion("env_id not like", value, "envId"); + public Criteria andLanguageNotLike(String value) { + addCriterion("`language` not like", value, "language"); return (Criteria) this; } - public Criteria andEnvIdIn(List values) { - addCriterion("env_id in", values, "envId"); + public Criteria andLanguageIn(List values) { + addCriterion("`language` in", values, "language"); return (Criteria) this; } - public Criteria andEnvIdNotIn(List values) { - addCriterion("env_id not in", values, "envId"); + public Criteria andLanguageNotIn(List values) { + addCriterion("`language` not in", values, "language"); return (Criteria) this; } - public Criteria andEnvIdBetween(String value1, String value2) { - addCriterion("env_id between", value1, value2, "envId"); + public Criteria andLanguageBetween(String value1, String value2) { + addCriterion("`language` between", value1, value2, "language"); return (Criteria) this; } - public Criteria andEnvIdNotBetween(String value1, String value2) { - addCriterion("env_id not between", value1, value2, "envId"); + public Criteria andLanguageNotBetween(String value1, String value2) { + addCriterion("`language` not between", value1, value2, "language"); return (Criteria) this; } @@ -616,7 +709,7 @@ public Criteria andGmtCreateEqualTo(Date value) { return (Criteria) this; } - public Criteria andGmtCreateEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtCreateEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_create = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -627,7 +720,7 @@ public Criteria andGmtCreateNotEqualTo(Date value) { return (Criteria) this; } - public Criteria andGmtCreateNotEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtCreateNotEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_create <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -638,7 +731,7 @@ public Criteria andGmtCreateGreaterThan(Date value) { return (Criteria) this; } - public Criteria andGmtCreateGreaterThanColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtCreateGreaterThanColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_create > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -649,7 +742,8 @@ public Criteria andGmtCreateGreaterThanOrEqualTo(Date value) { return (Criteria) this; } - public Criteria andGmtCreateGreaterThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtCreateGreaterThanOrEqualToColumn( + TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_create >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -660,7 +754,7 @@ public Criteria andGmtCreateLessThan(Date value) { return (Criteria) this; } - public Criteria andGmtCreateLessThanColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtCreateLessThanColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_create < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -671,7 +765,7 @@ public Criteria andGmtCreateLessThanOrEqualTo(Date value) { return (Criteria) this; } - public Criteria andGmtCreateLessThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtCreateLessThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_create <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -712,7 +806,7 @@ public Criteria andGmtModifiedEqualTo(Date value) { return (Criteria) this; } - public Criteria andGmtModifiedEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtModifiedEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_modified = ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -723,7 +817,7 @@ public Criteria andGmtModifiedNotEqualTo(Date value) { return (Criteria) this; } - public Criteria andGmtModifiedNotEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtModifiedNotEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_modified <> ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -734,7 +828,7 @@ public Criteria andGmtModifiedGreaterThan(Date value) { return (Criteria) this; } - public Criteria andGmtModifiedGreaterThanColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtModifiedGreaterThanColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_modified > ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -745,7 +839,8 @@ public Criteria andGmtModifiedGreaterThanOrEqualTo(Date value) { return (Criteria) this; } - public Criteria andGmtModifiedGreaterThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtModifiedGreaterThanOrEqualToColumn( + TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_modified >= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -756,7 +851,7 @@ public Criteria andGmtModifiedLessThan(Date value) { return (Criteria) this; } - public Criteria andGmtModifiedLessThanColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtModifiedLessThanColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_modified < ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -767,7 +862,7 @@ public Criteria andGmtModifiedLessThanOrEqualTo(Date value) { return (Criteria) this; } - public Criteria andGmtModifiedLessThanOrEqualToColumn(AgentConfigurationDO.Column column) { + public Criteria andGmtModifiedLessThanOrEqualToColumn(TraceAgentConfigurationDO.Column column) { addCriterion( new StringBuilder("gmt_modified <= ").append(column.getEscapedColumnName()).toString()); return (Criteria) this; @@ -795,14 +890,14 @@ public Criteria andGmtModifiedNotBetween(Date value1, Date value2) { } public static class Criteria extends GeneratedCriteria { - private AgentConfigurationDOExample example; + private TraceAgentConfigurationDOExample example; - protected Criteria(AgentConfigurationDOExample example) { + protected Criteria(TraceAgentConfigurationDOExample example) { super(); this.example = example; } - public AgentConfigurationDOExample example() { + public TraceAgentConfigurationDOExample example() { return this.example; } @@ -927,6 +1022,6 @@ public interface ICriteriaWhen { } public interface IExampleWhen { - void example(io.holoinsight.server.common.dao.entity.AgentConfigurationDOExample example); + void example(io.holoinsight.server.common.dao.entity.TraceAgentConfigurationDOExample example); } } diff --git a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/AgentConfigurationDOMapper.java b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/AgentConfigurationDOMapper.java deleted file mode 100644 index f91414b42..000000000 --- a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/AgentConfigurationDOMapper.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. - */ -package io.holoinsight.server.common.dao.mapper; - -import io.holoinsight.server.common.dao.entity.AgentConfigurationDO; -import io.holoinsight.server.common.dao.entity.AgentConfigurationDOExample; -import java.util.List; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -@Mapper -@Repository -public interface AgentConfigurationDOMapper { - long countByExample(AgentConfigurationDOExample example); - - int deleteByExample(AgentConfigurationDOExample example); - - int deleteByPrimaryKey(@Param("tenant") String tenant, @Param("service") String service, - @Param("appId") String appId, @Param("envId") String envId); - - int insert(AgentConfigurationDO record); - - int insertSelective(@Param("record") AgentConfigurationDO record, - @Param("selective") AgentConfigurationDO.Column... selective); - - AgentConfigurationDO selectOneByExample(AgentConfigurationDOExample example); - - AgentConfigurationDO selectOneByExampleSelective( - @Param("example") AgentConfigurationDOExample example, - @Param("selective") AgentConfigurationDO.Column... selective); - - AgentConfigurationDO selectOneByExampleWithBLOBs(AgentConfigurationDOExample example); - - List selectByExampleSelective( - @Param("example") AgentConfigurationDOExample example, - @Param("selective") AgentConfigurationDO.Column... selective); - - List selectByExampleWithBLOBs(AgentConfigurationDOExample example); - - List selectByExample(AgentConfigurationDOExample example); - - AgentConfigurationDO selectByPrimaryKeySelective(@Param("tenant") String tenant, - @Param("service") String service, @Param("appId") String appId, @Param("envId") String envId, - @Param("selective") AgentConfigurationDO.Column... selective); - - AgentConfigurationDO selectByPrimaryKey(@Param("tenant") String tenant, - @Param("service") String service, @Param("appId") String appId, @Param("envId") String envId); - - int updateByExampleSelective(@Param("record") AgentConfigurationDO record, - @Param("example") AgentConfigurationDOExample example, - @Param("selective") AgentConfigurationDO.Column... selective); - - int updateByExampleWithBLOBs(@Param("record") AgentConfigurationDO record, - @Param("example") AgentConfigurationDOExample example); - - int updateByExample(@Param("record") AgentConfigurationDO record, - @Param("example") AgentConfigurationDOExample example); - - int updateByPrimaryKeySelective(@Param("record") AgentConfigurationDO record, - @Param("selective") AgentConfigurationDO.Column... selective); - - int updateByPrimaryKeyWithBLOBs(AgentConfigurationDO record); - - int updateByPrimaryKey(AgentConfigurationDO record); - - int batchInsert(@Param("list") List list); - - int batchInsertSelective(@Param("list") List list, - @Param("selective") AgentConfigurationDO.Column... selective); - - int upsert(AgentConfigurationDO record); - - int upsertSelective(@Param("record") AgentConfigurationDO record, - @Param("selective") AgentConfigurationDO.Column... selective); - - int upsertWithBLOBs(AgentConfigurationDO record); -} diff --git a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/TraceAgentConfPropDOMapper.java b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/TraceAgentConfPropDOMapper.java new file mode 100644 index 000000000..af0e71ed3 --- /dev/null +++ b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/TraceAgentConfPropDOMapper.java @@ -0,0 +1,76 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.common.dao.mapper; + +import io.holoinsight.server.common.dao.entity.TraceAgentConfPropDO; +import io.holoinsight.server.common.dao.entity.TraceAgentConfPropDOExample; +import java.util.List; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface TraceAgentConfPropDOMapper { + long countByExample(TraceAgentConfPropDOExample example); + + int deleteByExample(TraceAgentConfPropDOExample example); + + int deleteByPrimaryKey(Long id); + + int insert(TraceAgentConfPropDO record); + + int insertSelective(@Param("record") TraceAgentConfPropDO record, + @Param("selective") TraceAgentConfPropDO.Column... selective); + + TraceAgentConfPropDO selectOneByExample(TraceAgentConfPropDOExample example); + + TraceAgentConfPropDO selectOneByExampleSelective( + @Param("example") TraceAgentConfPropDOExample example, + @Param("selective") TraceAgentConfPropDO.Column... selective); + + TraceAgentConfPropDO selectOneByExampleWithBLOBs(TraceAgentConfPropDOExample example); + + List selectByExampleSelective( + @Param("example") TraceAgentConfPropDOExample example, + @Param("selective") TraceAgentConfPropDO.Column... selective); + + List selectByExampleWithBLOBs(TraceAgentConfPropDOExample example); + + List selectByExample(TraceAgentConfPropDOExample example); + + TraceAgentConfPropDO selectByPrimaryKeySelective(@Param("id") Long id, + @Param("selective") TraceAgentConfPropDO.Column... selective); + + TraceAgentConfPropDO selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") TraceAgentConfPropDO record, + @Param("example") TraceAgentConfPropDOExample example, + @Param("selective") TraceAgentConfPropDO.Column... selective); + + int updateByExampleWithBLOBs(@Param("record") TraceAgentConfPropDO record, + @Param("example") TraceAgentConfPropDOExample example); + + int updateByExample(@Param("record") TraceAgentConfPropDO record, + @Param("example") TraceAgentConfPropDOExample example); + + int updateByPrimaryKeySelective(@Param("record") TraceAgentConfPropDO record, + @Param("selective") TraceAgentConfPropDO.Column... selective); + + int updateByPrimaryKeyWithBLOBs(TraceAgentConfPropDO record); + + int updateByPrimaryKey(TraceAgentConfPropDO record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, + @Param("selective") TraceAgentConfPropDO.Column... selective); + + int upsert(TraceAgentConfPropDO record); + + int upsertSelective(@Param("record") TraceAgentConfPropDO record, + @Param("selective") TraceAgentConfPropDO.Column... selective); + + int upsertWithBLOBs(TraceAgentConfPropDO record); +} diff --git a/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/TraceAgentConfigurationDOMapper.java b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/TraceAgentConfigurationDOMapper.java new file mode 100644 index 000000000..b0e95a97b --- /dev/null +++ b/server/common/common-dao-gen/src/main/java/io/holoinsight/server/common/dao/mapper/TraceAgentConfigurationDOMapper.java @@ -0,0 +1,78 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.common.dao.mapper; + +import io.holoinsight.server.common.dao.entity.TraceAgentConfigurationDO; +import io.holoinsight.server.common.dao.entity.TraceAgentConfigurationDOExample; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface TraceAgentConfigurationDOMapper { + long countByExample(TraceAgentConfigurationDOExample example); + + int deleteByExample(TraceAgentConfigurationDOExample example); + + int deleteByPrimaryKey(Long id); + + int insert(TraceAgentConfigurationDO record); + + int insertSelective(@Param("record") TraceAgentConfigurationDO record, + @Param("selective") TraceAgentConfigurationDO.Column... selective); + + TraceAgentConfigurationDO selectOneByExample(TraceAgentConfigurationDOExample example); + + TraceAgentConfigurationDO selectOneByExampleSelective( + @Param("example") TraceAgentConfigurationDOExample example, + @Param("selective") TraceAgentConfigurationDO.Column... selective); + + TraceAgentConfigurationDO selectOneByExampleWithBLOBs(TraceAgentConfigurationDOExample example); + + List selectByExampleSelective( + @Param("example") TraceAgentConfigurationDOExample example, + @Param("selective") TraceAgentConfigurationDO.Column... selective); + + List selectByExampleWithBLOBs( + TraceAgentConfigurationDOExample example); + + List selectByExample(TraceAgentConfigurationDOExample example); + + TraceAgentConfigurationDO selectByPrimaryKeySelective(@Param("id") Long id, + @Param("selective") TraceAgentConfigurationDO.Column... selective); + + TraceAgentConfigurationDO selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") TraceAgentConfigurationDO record, + @Param("example") TraceAgentConfigurationDOExample example, + @Param("selective") TraceAgentConfigurationDO.Column... selective); + + int updateByExampleWithBLOBs(@Param("record") TraceAgentConfigurationDO record, + @Param("example") TraceAgentConfigurationDOExample example); + + int updateByExample(@Param("record") TraceAgentConfigurationDO record, + @Param("example") TraceAgentConfigurationDOExample example); + + int updateByPrimaryKeySelective(@Param("record") TraceAgentConfigurationDO record, + @Param("selective") TraceAgentConfigurationDO.Column... selective); + + int updateByPrimaryKeyWithBLOBs(TraceAgentConfigurationDO record); + + int updateByPrimaryKey(TraceAgentConfigurationDO record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, + @Param("selective") TraceAgentConfigurationDO.Column... selective); + + int upsert(TraceAgentConfigurationDO record); + + int upsertSelective(@Param("record") TraceAgentConfigurationDO record, + @Param("selective") TraceAgentConfigurationDO.Column... selective); + + int upsertWithBLOBs(TraceAgentConfigurationDO record); +} diff --git a/server/common/common-dao-gen/src/main/resources/generatorConfig.xml b/server/common/common-dao-gen/src/main/resources/generatorConfig.xml index 9ea5b2d8f..3bec76d11 100644 --- a/server/common/common-dao-gen/src/main/resources/generatorConfig.xml +++ b/server/common/common-dao-gen/src/main/resources/generatorConfig.xml @@ -96,7 +96,10 @@
- +
+
+ +
diff --git a/server/common/common-dao-gen/src/main/resources/sqlmap/TraceAgentConfPropDOMapper.xml b/server/common/common-dao-gen/src/main/resources/sqlmap/TraceAgentConfPropDOMapper.xml new file mode 100644 index 000000000..3e365a4b5 --- /dev/null +++ b/server/common/common-dao-gen/src/main/resources/sqlmap/TraceAgentConfPropDOMapper.xml @@ -0,0 +1,684 @@ + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, `type`, `language`, prop_key, `name`, c_name, check_expression + + + description, c_description + + + + + + + + delete from trace_agent_configuration_properties + where id = #{id,jdbcType=BIGINT} + + + delete from trace_agent_configuration_properties + + + + + + insert into trace_agent_configuration_properties (id, `type`, `language`, + prop_key, `name`, c_name, + check_expression, description, c_description + ) + values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR}, + #{propKey,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{cName,jdbcType=VARCHAR}, + #{checkExpression,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR}, #{cDescription,jdbcType=LONGVARCHAR} + ) + + + insert into trace_agent_configuration_properties + + + + ${column.escapedColumnName} + + + + + + id, + + + `type`, + + + `language`, + + + prop_key, + + + `name`, + + + c_name, + + + check_expression, + + + description, + + + c_description, + + + + + + values + + + + #{record.${column.javaProperty},jdbcType=${column.jdbcType}} + + + + + + #{record.id,jdbcType=BIGINT}, + + + #{record.type,jdbcType=VARCHAR}, + + + #{record.language,jdbcType=VARCHAR}, + + + #{record.propKey,jdbcType=VARCHAR}, + + + #{record.name,jdbcType=VARCHAR}, + + + #{record.cName,jdbcType=VARCHAR}, + + + #{record.checkExpression,jdbcType=VARCHAR}, + + + #{record.description,jdbcType=LONGVARCHAR}, + + + #{record.cDescription,jdbcType=LONGVARCHAR}, + + + + + + + + update trace_agent_configuration_properties + SET + + + + ${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}} + + + + + + id = #{record.id,jdbcType=BIGINT}, + + + `type` = #{record.type,jdbcType=VARCHAR}, + + + `language` = #{record.language,jdbcType=VARCHAR}, + + + prop_key = #{record.propKey,jdbcType=VARCHAR}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + c_name = #{record.cName,jdbcType=VARCHAR}, + + + check_expression = #{record.checkExpression,jdbcType=VARCHAR}, + + + description = #{record.description,jdbcType=LONGVARCHAR}, + + + c_description = #{record.cDescription,jdbcType=LONGVARCHAR}, + + + + + + + + + + update trace_agent_configuration_properties + set id = #{record.id,jdbcType=BIGINT}, + `type` = #{record.type,jdbcType=VARCHAR}, + `language` = #{record.language,jdbcType=VARCHAR}, + prop_key = #{record.propKey,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + c_name = #{record.cName,jdbcType=VARCHAR}, + check_expression = #{record.checkExpression,jdbcType=VARCHAR}, + description = #{record.description,jdbcType=LONGVARCHAR}, + c_description = #{record.cDescription,jdbcType=LONGVARCHAR} + + + + + + update trace_agent_configuration_properties + set id = #{record.id,jdbcType=BIGINT}, + `type` = #{record.type,jdbcType=VARCHAR}, + `language` = #{record.language,jdbcType=VARCHAR}, + prop_key = #{record.propKey,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + c_name = #{record.cName,jdbcType=VARCHAR}, + check_expression = #{record.checkExpression,jdbcType=VARCHAR} + + + + + + update trace_agent_configuration_properties + SET + + + + ${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}} + + + + + + `type` = #{record.type,jdbcType=VARCHAR}, + + + `language` = #{record.language,jdbcType=VARCHAR}, + + + prop_key = #{record.propKey,jdbcType=VARCHAR}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + c_name = #{record.cName,jdbcType=VARCHAR}, + + + check_expression = #{record.checkExpression,jdbcType=VARCHAR}, + + + description = #{record.description,jdbcType=LONGVARCHAR}, + + + c_description = #{record.cDescription,jdbcType=LONGVARCHAR}, + + + + + where id = #{record.id,jdbcType=BIGINT} + + + update trace_agent_configuration_properties + set `type` = #{type,jdbcType=VARCHAR}, + `language` = #{language,jdbcType=VARCHAR}, + prop_key = #{propKey,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + c_name = #{cName,jdbcType=VARCHAR}, + check_expression = #{checkExpression,jdbcType=VARCHAR}, + description = #{description,jdbcType=LONGVARCHAR}, + c_description = #{cDescription,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=BIGINT} + + + update trace_agent_configuration_properties + set `type` = #{type,jdbcType=VARCHAR}, + `language` = #{language,jdbcType=VARCHAR}, + prop_key = #{propKey,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + c_name = #{cName,jdbcType=VARCHAR}, + check_expression = #{checkExpression,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + + + + + insert into trace_agent_configuration_properties + (id, `type`, `language`, prop_key, `name`, c_name, check_expression, description, + c_description) + values + + (#{item.id,jdbcType=BIGINT}, #{item.type,jdbcType=VARCHAR}, #{item.language,jdbcType=VARCHAR}, + #{item.propKey,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.cName,jdbcType=VARCHAR}, + #{item.checkExpression,jdbcType=VARCHAR}, #{item.description,jdbcType=LONGVARCHAR}, + #{item.cDescription,jdbcType=LONGVARCHAR}) + + + + insert into trace_agent_configuration_properties ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.id,jdbcType=BIGINT} + + + #{item.type,jdbcType=VARCHAR} + + + #{item.language,jdbcType=VARCHAR} + + + #{item.propKey,jdbcType=VARCHAR} + + + #{item.name,jdbcType=VARCHAR} + + + #{item.cName,jdbcType=VARCHAR} + + + #{item.checkExpression,jdbcType=VARCHAR} + + + #{item.description,jdbcType=LONGVARCHAR} + + + #{item.cDescription,jdbcType=LONGVARCHAR} + + + ) + + + + insert into trace_agent_configuration_properties + + + + ${column.escapedColumnName} + + + + + + id, + + + `type`, + + + `language`, + + + prop_key, + + + `name`, + + + c_name, + + + check_expression, + + + description, + + + c_description, + + + + + + values + + + + #{record.${column.javaProperty},jdbcType=${column.jdbcType}} + + + + + + #{record.id,jdbcType=BIGINT}, + + + #{record.type,jdbcType=VARCHAR}, + + + #{record.language,jdbcType=VARCHAR}, + + + #{record.propKey,jdbcType=VARCHAR}, + + + #{record.name,jdbcType=VARCHAR}, + + + #{record.cName,jdbcType=VARCHAR}, + + + #{record.checkExpression,jdbcType=VARCHAR}, + + + #{record.description,jdbcType=LONGVARCHAR}, + + + #{record.cDescription,jdbcType=LONGVARCHAR}, + + + + + on duplicate key update + + + + ${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}} + + + + + + id = #{record.id,jdbcType=BIGINT}, + + + `type` = #{record.type,jdbcType=VARCHAR}, + + + `language` = #{record.language,jdbcType=VARCHAR}, + + + prop_key = #{record.propKey,jdbcType=VARCHAR}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + c_name = #{record.cName,jdbcType=VARCHAR}, + + + check_expression = #{record.checkExpression,jdbcType=VARCHAR}, + + + description = #{record.description,jdbcType=LONGVARCHAR}, + + + c_description = #{record.cDescription,jdbcType=LONGVARCHAR}, + + + + + + + insert into trace_agent_configuration_properties + (id, `type`, `language`, prop_key, `name`, c_name, check_expression) + values + (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR}, #{propKey,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, #{cName,jdbcType=VARCHAR}, #{checkExpression,jdbcType=VARCHAR} + ) + on duplicate key update + id = #{id,jdbcType=BIGINT}, + `type` = #{type,jdbcType=VARCHAR}, + `language` = #{language,jdbcType=VARCHAR}, + prop_key = #{propKey,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + c_name = #{cName,jdbcType=VARCHAR}, + check_expression = #{checkExpression,jdbcType=VARCHAR} + + + insert into trace_agent_configuration_properties + (id, `type`, `language`, prop_key, `name`, c_name, check_expression, description, + c_description) + values + (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR}, #{propKey,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, #{cName,jdbcType=VARCHAR}, #{checkExpression,jdbcType=VARCHAR}, + #{description,jdbcType=LONGVARCHAR}, #{cDescription,jdbcType=LONGVARCHAR}) + on duplicate key update + id = #{id,jdbcType=BIGINT}, + `type` = #{type,jdbcType=VARCHAR}, + `language` = #{language,jdbcType=VARCHAR}, + prop_key = #{propKey,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + c_name = #{cName,jdbcType=VARCHAR}, + check_expression = #{checkExpression,jdbcType=VARCHAR}, + description = #{description,jdbcType=LONGVARCHAR}, + c_description = #{cDescription,jdbcType=LONGVARCHAR} + + \ No newline at end of file diff --git a/server/common/common-dao-gen/src/main/resources/sqlmap/AgentConfigurationDOMapper.xml b/server/common/common-dao-gen/src/main/resources/sqlmap/TraceAgentConfigurationDOMapper.xml similarity index 69% rename from server/common/common-dao-gen/src/main/resources/sqlmap/AgentConfigurationDOMapper.xml rename to server/common/common-dao-gen/src/main/resources/sqlmap/TraceAgentConfigurationDOMapper.xml index c0db26b39..65881e712 100644 --- a/server/common/common-dao-gen/src/main/resources/sqlmap/AgentConfigurationDOMapper.xml +++ b/server/common/common-dao-gen/src/main/resources/sqlmap/TraceAgentConfigurationDOMapper.xml @@ -1,15 +1,16 @@ - - - - - - + + + + + + + - + @@ -71,12 +72,12 @@ - tenant, service, app_id, env_id, gmt_create, gmt_modified + id, tenant, service, `type`, `language`, gmt_create, gmt_modified `value` - select distinct @@ -84,7 +85,7 @@ , - from agent_configuration + from trace_agent_configuration @@ -100,13 +101,13 @@ - select distinct - from agent_configuration + from trace_agent_configuration @@ -139,7 +140,7 @@ - from agent_configuration + from trace_agent_configuration @@ -155,16 +156,13 @@ - select , - from agent_configuration - where tenant = #{tenant,jdbcType=VARCHAR} - and service = #{service,jdbcType=VARCHAR} - and app_id = #{appId,jdbcType=VARCHAR} - and env_id = #{envId,jdbcType=VARCHAR} + from trace_agent_configuration + where id = #{id,jdbcType=BIGINT} - - delete from agent_configuration - where tenant = #{tenant,jdbcType=VARCHAR} - and service = #{service,jdbcType=VARCHAR} - and app_id = #{appId,jdbcType=VARCHAR} - and env_id = #{envId,jdbcType=VARCHAR} + + delete from trace_agent_configuration + where id = #{id,jdbcType=BIGINT} - - delete from agent_configuration + + delete from trace_agent_configuration - - insert into agent_configuration (tenant, service, app_id, - env_id, gmt_create, gmt_modified, - `value`) - values (#{tenant,jdbcType=VARCHAR}, #{service,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR}, - #{envId,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}, - #{value,jdbcType=LONGVARCHAR}) + + insert into trace_agent_configuration (id, tenant, service, + `type`, `language`, gmt_create, + gmt_modified, `value`) + values (#{id,jdbcType=BIGINT}, #{tenant,jdbcType=VARCHAR}, #{service,jdbcType=VARCHAR}, + #{type,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, #{value,jdbcType=LONGVARCHAR}) - insert into agent_configuration + insert into trace_agent_configuration @@ -217,17 +209,20 @@ + + id, + tenant, service, - - app_id, + + `type`, - - env_id, + + `language`, gmt_create, @@ -251,17 +246,20 @@ + + #{record.id,jdbcType=BIGINT}, + #{record.tenant,jdbcType=VARCHAR}, #{record.service,jdbcType=VARCHAR}, - - #{record.appId,jdbcType=VARCHAR}, + + #{record.type,jdbcType=VARCHAR}, - - #{record.envId,jdbcType=VARCHAR}, + + #{record.language,jdbcType=VARCHAR}, #{record.gmtCreate,jdbcType=TIMESTAMP}, @@ -276,14 +274,14 @@ - + select count(*) from trace_agent_configuration - update agent_configuration + update trace_agent_configuration SET @@ -293,17 +291,20 @@ + + id = #{record.id,jdbcType=BIGINT}, + tenant = #{record.tenant,jdbcType=VARCHAR}, service = #{record.service,jdbcType=VARCHAR}, - - app_id = #{record.appId,jdbcType=VARCHAR}, + + `type` = #{record.type,jdbcType=VARCHAR}, - - env_id = #{record.envId,jdbcType=VARCHAR}, + + `language` = #{record.language,jdbcType=VARCHAR}, gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP}, @@ -322,11 +323,12 @@ - update agent_configuration - set tenant = #{record.tenant,jdbcType=VARCHAR}, + update trace_agent_configuration + set id = #{record.id,jdbcType=BIGINT}, + tenant = #{record.tenant,jdbcType=VARCHAR}, service = #{record.service,jdbcType=VARCHAR}, - app_id = #{record.appId,jdbcType=VARCHAR}, - env_id = #{record.envId,jdbcType=VARCHAR}, + `type` = #{record.type,jdbcType=VARCHAR}, + `language` = #{record.language,jdbcType=VARCHAR}, gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP}, gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP}, `value` = #{record.value,jdbcType=LONGVARCHAR} @@ -335,11 +337,12 @@ - update agent_configuration - set tenant = #{record.tenant,jdbcType=VARCHAR}, + update trace_agent_configuration + set id = #{record.id,jdbcType=BIGINT}, + tenant = #{record.tenant,jdbcType=VARCHAR}, service = #{record.service,jdbcType=VARCHAR}, - app_id = #{record.appId,jdbcType=VARCHAR}, - env_id = #{record.envId,jdbcType=VARCHAR}, + `type` = #{record.type,jdbcType=VARCHAR}, + `language` = #{record.language,jdbcType=VARCHAR}, gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP}, gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP} @@ -347,7 +350,7 @@ - update agent_configuration + update trace_agent_configuration SET @@ -357,6 +360,18 @@ + + tenant = #{record.tenant,jdbcType=VARCHAR}, + + + service = #{record.service,jdbcType=VARCHAR}, + + + `type` = #{record.type,jdbcType=VARCHAR}, + + + `language` = #{record.language,jdbcType=VARCHAR}, + gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP}, @@ -369,34 +384,33 @@ - where tenant = #{record.tenant,jdbcType=VARCHAR} - and service = #{record.service,jdbcType=VARCHAR} - and app_id = #{record.appId,jdbcType=VARCHAR} - and env_id = #{record.envId,jdbcType=VARCHAR} + where id = #{record.id,jdbcType=BIGINT} - - update agent_configuration - set gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + update trace_agent_configuration + set tenant = #{tenant,jdbcType=VARCHAR}, + service = #{service,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + `language` = #{language,jdbcType=VARCHAR}, + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, `value` = #{value,jdbcType=LONGVARCHAR} - where tenant = #{tenant,jdbcType=VARCHAR} - and service = #{service,jdbcType=VARCHAR} - and app_id = #{appId,jdbcType=VARCHAR} - and env_id = #{envId,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} - - update agent_configuration - set gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + update trace_agent_configuration + set tenant = #{tenant,jdbcType=VARCHAR}, + service = #{service,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + `language` = #{language,jdbcType=VARCHAR}, + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} - where tenant = #{tenant,jdbcType=VARCHAR} - and service = #{service,jdbcType=VARCHAR} - and app_id = #{appId,jdbcType=VARCHAR} - and env_id = #{envId,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} - select - from agent_configuration + from trace_agent_configuration @@ -405,12 +419,12 @@ limit 1 - select , - from agent_configuration + from trace_agent_configuration @@ -433,7 +447,7 @@ - from agent_configuration + from trace_agent_configuration @@ -443,17 +457,17 @@ limit 1 - insert into agent_configuration - (tenant, service, app_id, env_id, gmt_create, gmt_modified, `value`) + insert into trace_agent_configuration + (id, tenant, service, `type`, `language`, gmt_create, gmt_modified, `value`) values - (#{item.tenant,jdbcType=VARCHAR}, #{item.service,jdbcType=VARCHAR}, #{item.appId,jdbcType=VARCHAR}, - #{item.envId,jdbcType=VARCHAR}, #{item.gmtCreate,jdbcType=TIMESTAMP}, #{item.gmtModified,jdbcType=TIMESTAMP}, - #{item.value,jdbcType=LONGVARCHAR}) + (#{item.id,jdbcType=BIGINT}, #{item.tenant,jdbcType=VARCHAR}, #{item.service,jdbcType=VARCHAR}, + #{item.type,jdbcType=VARCHAR}, #{item.language,jdbcType=VARCHAR}, #{item.gmtCreate,jdbcType=TIMESTAMP}, + #{item.gmtModified,jdbcType=TIMESTAMP}, #{item.value,jdbcType=LONGVARCHAR}) - insert into agent_configuration ( + insert into trace_agent_configuration ( ${column.escapedColumnName} @@ -462,17 +476,20 @@ ( + + #{item.id,jdbcType=BIGINT} + #{item.tenant,jdbcType=VARCHAR} #{item.service,jdbcType=VARCHAR} - - #{item.appId,jdbcType=VARCHAR} + + #{item.type,jdbcType=VARCHAR} - - #{item.envId,jdbcType=VARCHAR} + + #{item.language,jdbcType=VARCHAR} #{item.gmtCreate,jdbcType=TIMESTAMP} @@ -488,7 +505,7 @@ - insert into agent_configuration + insert into trace_agent_configuration @@ -497,17 +514,20 @@ + + id, + tenant, service, - - app_id, + + `type`, - - env_id, + + `language`, gmt_create, @@ -531,17 +551,20 @@ + + #{record.id,jdbcType=BIGINT}, + #{record.tenant,jdbcType=VARCHAR}, #{record.service,jdbcType=VARCHAR}, - - #{record.appId,jdbcType=VARCHAR}, + + #{record.type,jdbcType=VARCHAR}, - - #{record.envId,jdbcType=VARCHAR}, + + #{record.language,jdbcType=VARCHAR}, #{record.gmtCreate,jdbcType=TIMESTAMP}, @@ -564,17 +587,20 @@ + + id = #{record.id,jdbcType=BIGINT}, + tenant = #{record.tenant,jdbcType=VARCHAR}, service = #{record.service,jdbcType=VARCHAR}, - - app_id = #{record.appId,jdbcType=VARCHAR}, + + `type` = #{record.type,jdbcType=VARCHAR}, - - env_id = #{record.envId,jdbcType=VARCHAR}, + + `language` = #{record.language,jdbcType=VARCHAR}, gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP}, @@ -589,33 +615,35 @@ - - insert into agent_configuration - (tenant, service, app_id, env_id, gmt_create, gmt_modified) + + insert into trace_agent_configuration + (id, tenant, service, `type`, `language`, gmt_create, gmt_modified) values - (#{tenant,jdbcType=VARCHAR}, #{service,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR}, - #{envId,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP} - ) + (#{id,jdbcType=BIGINT}, #{tenant,jdbcType=VARCHAR}, #{service,jdbcType=VARCHAR}, + #{type,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}) on duplicate key update + id = #{id,jdbcType=BIGINT}, tenant = #{tenant,jdbcType=VARCHAR}, service = #{service,jdbcType=VARCHAR}, - app_id = #{appId,jdbcType=VARCHAR}, - env_id = #{envId,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + `language` = #{language,jdbcType=VARCHAR}, gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} - - insert into agent_configuration - (tenant, service, app_id, env_id, gmt_create, gmt_modified, `value`) + + insert into trace_agent_configuration + (id, tenant, service, `type`, `language`, gmt_create, gmt_modified, `value`) values - (#{tenant,jdbcType=VARCHAR}, #{service,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR}, - #{envId,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}, - #{value,jdbcType=LONGVARCHAR}) + (#{id,jdbcType=BIGINT}, #{tenant,jdbcType=VARCHAR}, #{service,jdbcType=VARCHAR}, + #{type,jdbcType=VARCHAR}, #{language,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, #{value,jdbcType=LONGVARCHAR}) on duplicate key update + id = #{id,jdbcType=BIGINT}, tenant = #{tenant,jdbcType=VARCHAR}, service = #{service,jdbcType=VARCHAR}, - app_id = #{appId,jdbcType=VARCHAR}, - env_id = #{envId,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + `language` = #{language,jdbcType=VARCHAR}, gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, `value` = #{value,jdbcType=LONGVARCHAR} diff --git a/server/common/common/src/main/java/io/holoinsight/server/common/Const.java b/server/common/common/src/main/java/io/holoinsight/server/common/Const.java new file mode 100644 index 000000000..d207e61c7 --- /dev/null +++ b/server/common/common/src/main/java/io/holoinsight/server/common/Const.java @@ -0,0 +1,10 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ + +package io.holoinsight.server.common; + +public class Const { + + public final static String TRACE_AGENT_CONFIG_KEY_JOINER = "@#$"; +} diff --git a/server/extension/extension-common-flyway/src/main/resources/db/migration/V16__230814_CREATE_trace_agent_configuration_TABLE.sql b/server/extension/extension-common-flyway/src/main/resources/db/migration/V16__230814_CREATE_trace_agent_configuration_TABLE.sql new file mode 100644 index 000000000..c52b3ef53 --- /dev/null +++ b/server/extension/extension-common-flyway/src/main/resources/db/migration/V16__230814_CREATE_trace_agent_configuration_TABLE.sql @@ -0,0 +1,38 @@ +-- ---------------------------- +-- Table structure for trace_agent_configuration +-- Store the user's configuration on the page +-- ---------------------------- +CREATE TABLE IF NOT EXISTS `trace_agent_configuration` ( + `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键id', + `tenant` varchar(255) NOT NULL COMMENT 'Tenant', + `service` varchar(255) NOT NULL COMMENT 'Name of the service that trace agent collects', + `type` varchar(100) NOT NULL COMMENT 'Type of trace agent, skywalking、opentelemetry...', + `language` varchar(100) NOT NULL COMMENT 'Language of trace agent, java、php、nodejs、python', + `value` longtext NOT NULL COMMENT 'To send the configuration to the trace agent', + `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Data creation time', + `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Data modification time', + PRIMARY KEY (`id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + + +-- ---------------------------- +-- Table structure for trace_agent_configuration_properties +-- Trace configuration metadata table +-- ---------------------------- +CREATE TABLE IF NOT EXISTS `trace_agent_configuration_properties` ( + `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键id', + `type` varchar(100) NOT NULL COMMENT 'Type of trace agent, skywalking、opentelemetry...', + `language` varchar(100) NOT NULL COMMENT 'Language of trace agent, java、php、nodejs、python', + `prop_key` varchar(255) NOT NULL COMMENT 'Property key of the agent configuration', + `name` varchar(255) NOT NULL COMMENT 'Name of the agent configuration', + `c_name` varchar(255) NOT NULL COMMENT 'The Chinese name of the configuration', + `description` longtext COMMENT 'The description of the configuration', + `c_description` longtext COMMENT 'Chinese configuration description', + `check_expression` varchar(255) COMMENT 'Used to validate the configuration value entered by the user, which can be a regular expression', + PRIMARY KEY (`id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +INSERT INTO `trace_agent_configuration_properties` (`type`, `language`, `prop_key`, `name`, `c_name`, `description`, `c_description`, `check_expression`) VALUES ('skywalking', 'java', 'agent.sample_n_per_3_secs', 'The number of traces sampled every three seconds', '每三秒采样trace条数', 'Negative or zero means off, by default.SAMPLE_N_PER_3_SECS means sampling N trace in 3 seconds tops.', '默认情况下,负数或零表示全部采样。SAMPLE_N_PER_3_SECS 表示在 3 秒内采样 N 个 trace。', '^\\d+$'); +INSERT INTO `trace_agent_configuration_properties` (`type`, `language`, `prop_key`, `name`, `c_name`, `description`, `c_description`, `check_expression`) VALUES ('skywalking', 'java', 'agent.ignore_suffix', 'Interface call filtering', '接口调用过滤', 'Default: .jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg, If the operation name of the first span is included in this set, this segment should be ignored.', 'Default: .jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.html,.svg, 如果第一个span的操作名称的后缀包含在该集合中,则应忽略该span。', ''); +INSERT INTO `trace_agent_configuration_properties` (`type`, `language`, `prop_key`, `name`, `c_name`, `description`, `c_description`, `check_expression`) VALUES ('skywalking', 'java', 'plugin.jdbc.trace_sql_parameters', 'Collect sql parameters', '采集sql参数', 'Default: false, If set to true, the parameters of the sql (typically java.sql.PreparedStatement) would be collected.', 'Default: false, 如果设置为 true,则将收集 sql 的参数。', ''); +INSERT INTO `trace_agent_configuration_properties` (`type`, `language`, `prop_key`, `name`, `c_name`, `description`, `c_description`, `check_expression`) VALUES ('skywalking', 'java', 'holoinsight.slow.sql.threshold', 'Slow sql threshold', '慢sql阈值', 'Unit: ms,Default: 300, Exceeding this threshold is considered slow sql,please enter a number greater than zero.', 'Unit: ms,Default: 300, 超过该阈值被认定为慢sql, 请输入大于零的数字。', '^[1-9]\d*$'); \ No newline at end of file diff --git a/server/extension/extension-common-flyway/src/main/resources/db/migration/V1__230301_INIT_DDL.sql b/server/extension/extension-common-flyway/src/main/resources/db/migration/V1__230301_INIT_DDL.sql index 9912ab2ac..2a132f83b 100644 --- a/server/extension/extension-common-flyway/src/main/resources/db/migration/V1__230301_INIT_DDL.sql +++ b/server/extension/extension-common-flyway/src/main/resources/db/migration/V1__230301_INIT_DDL.sql @@ -24,20 +24,6 @@ CREATE TABLE IF NOT EXISTS `alarm_block` ( PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Alarm masking'; --- ---------------------------- --- Table structure for agent_configuration --- ---------------------------- -CREATE TABLE IF NOT EXISTS `agent_configuration` ( - `tenant` varchar(255) NOT NULL COMMENT 'Tenant', - `service` varchar(100) NOT NULL COMMENT 'Name of the service that trace agent collects', - `app_id` varchar(100) NOT NULL COMMENT 'Cloudrun app Id', - `env_id` varchar(100) NOT NULL COMMENT 'Cloudrun env Id', - `value` longtext NOT NULL COMMENT 'To send the configuration to the trace agent', - `gmt_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Data creation time', - `gmt_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Data modification time', - PRIMARY KEY (`tenant`,`service`,`app_id`,`env_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - -- ---------------------------- -- Table structure for alarm_ding_ding_robot -- ---------------------------- diff --git a/server/gateway/gateway-boot/src/main/java/io/holoinsight/server/gateway/bootstrap/HoloinsightGatewayConfiguration.java b/server/gateway/gateway-boot/src/main/java/io/holoinsight/server/gateway/bootstrap/HoloinsightGatewayConfiguration.java index a5196bcf0..ee3fd4924 100644 --- a/server/gateway/gateway-boot/src/main/java/io/holoinsight/server/gateway/bootstrap/HoloinsightGatewayConfiguration.java +++ b/server/gateway/gateway-boot/src/main/java/io/holoinsight/server/gateway/bootstrap/HoloinsightGatewayConfiguration.java @@ -6,7 +6,6 @@ import io.holoinsight.server.common.auth.ApiKeyAutoConfiguration; import io.holoinsight.server.common.config.ConfigConfiguration; import io.holoinsight.server.common.dao.CommonDaoConfiguration; -import io.holoinsight.server.common.dao.mapper.AgentConfigurationDOMapper; import io.holoinsight.server.common.groovy.GroovyConfiguration; import io.holoinsight.server.common.security.InternalWebApiSecurityConfiguration; import io.holoinsight.server.common.springboot.ConditionalOnRole; @@ -16,8 +15,7 @@ import io.holoinsight.server.extension.NoopMetricStorage; import io.holoinsight.server.extension.ceresdbx.HoloinsightCeresdbxConfiguration; import io.holoinsight.server.gateway.core.grpc.GatewayProperties; - -import org.mybatis.spring.annotation.MapperScan; +import io.holoinsight.server.gateway.core.trace.controller.TraceAgentConfigurationController; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -44,4 +42,15 @@ public class HoloinsightGatewayConfiguration { public MetricStorage metricStorage() { return new NoopMetricStorage(); } + + /** + *

+ * agentConfigurationController. + *

+ */ + @Bean + public TraceAgentConfigurationController agentConfigurationController() { + return new TraceAgentConfigurationController(); + } + } diff --git a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/GatewayTraceConfiguration.java b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/GatewayTraceConfiguration.java index 2c66c7d91..7fbb6f720 100644 --- a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/GatewayTraceConfiguration.java +++ b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/GatewayTraceConfiguration.java @@ -5,13 +5,12 @@ import io.holoinsight.server.common.springboot.ConditionalOnFeature; import io.holoinsight.server.common.springboot.HoloinsightProperties; -import io.holoinsight.server.gateway.core.trace.config.GetAgentConfigurationService; -import io.holoinsight.server.gateway.core.trace.controller.AgentConfigurationController; +import io.holoinsight.server.gateway.core.trace.config.TraceAgentConfigurationService; import io.holoinsight.server.gateway.core.trace.exporter.LocalTraceExporter; import io.holoinsight.server.gateway.core.trace.exporter.RelayTraceExporter; import io.holoinsight.server.gateway.core.trace.exporter.TraceExporter; import io.holoinsight.server.gateway.core.trace.receiver.opentelemetry.TraceServiceImpl; -import io.holoinsight.server.gateway.core.trace.scheduler.AgentConfigurationScheduler; +import io.holoinsight.server.gateway.core.trace.scheduler.TraceAgentConfigurationScheduler; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -66,27 +65,17 @@ public TraceServiceImpl gateway_traceServiceImpl() { *

*/ @Bean - public AgentConfigurationScheduler agentConfigurationScheduler() { - return new AgentConfigurationScheduler(); + public TraceAgentConfigurationScheduler agentConfigurationScheduler() { + return new TraceAgentConfigurationScheduler(); } /** *

- * agentConfigurationController. + * traceAgentConfigurationService. *

*/ @Bean - public AgentConfigurationController agentConfigurationController() { - return new AgentConfigurationController(); - } - - /** - *

- * getAgentConfigurationService. - *

- */ - @Bean - public GetAgentConfigurationService getAgentConfigurationService() { - return new GetAgentConfigurationService(); + public TraceAgentConfigurationService traceAgentConfigurationService() { + return new TraceAgentConfigurationService(); } } diff --git a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/GetAgentConfigurationService.java b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/GetAgentConfigurationService.java deleted file mode 100644 index 4352bc807..000000000 --- a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/GetAgentConfigurationService.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. - */ -package io.holoinsight.server.gateway.core.trace.config; - -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import io.holoinsight.server.common.JsonUtils; -import io.holoinsight.server.common.dao.entity.AgentConfigurationDO; -import io.holoinsight.server.common.dao.entity.AgentConfigurationDOExample; -import io.holoinsight.server.common.dao.mapper.AgentConfigurationDOMapper; - -import org.springframework.beans.factory.annotation.Autowired; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.hash.Hashing; - -/** - *

- * GetAgentConfigurationService class. - *

- * - * @author sw1136562366 - */ -public class GetAgentConfigurationService { - @Autowired - private AgentConfigurationDOMapper agentConfigurationDOMapper; - - /** - *

- * getAgentConfiguration. - *

- */ - public AgentConfiguration getAgentConfiguration(String tenant, String service, String appId, - String envId) throws JsonProcessingException { - AgentConfiguration serviceConfiguration = getOneFromDB(tenant, service, appId, envId); - - if (serviceConfiguration == null) { - serviceConfiguration = getOneFromDB(tenant, "*", appId, envId); - } - - if (serviceConfiguration == null) { - serviceConfiguration = getOneFromDB(tenant, "*", appId, "*"); - } - - if (serviceConfiguration == null) { - serviceConfiguration = getOneFromDB(tenant, "*", "*", "*"); - } - - return serviceConfiguration; - } - - /** - *

- * getALLFromDB. - *

- */ - public List getALLFromDB() throws JsonProcessingException { - List agentConfigurationDOList = - agentConfigurationDOMapper.selectByExampleWithBLOBs(null); - List result = new ArrayList<>(agentConfigurationDOList.size()); - for (AgentConfigurationDO agentConfigurationDO : agentConfigurationDOList) { - Map configuration = - new ObjectMapper().readValue(agentConfigurationDO.getValue(), HashMap.class); - - StringBuilder configStr = new StringBuilder(); - configuration.forEach((key, value) -> { - configStr.append(key).append(":").append(value); - }); - - AgentConfiguration agentConfiguration = new AgentConfiguration( - agentConfigurationDO.getTenant(), agentConfigurationDO.getService(), - agentConfigurationDO.getAppId(), agentConfigurationDO.getEnvId(), configuration, - Hashing.sha512().hashString(configStr.toString(), StandardCharsets.UTF_8).toString()); - - result.add(agentConfiguration); - } - - return result; - } - - private AgentConfiguration getOneFromDB(String tenant, String service, String appId, String envId) - throws JsonProcessingException { - AgentConfigurationDOExample example = - AgentConfigurationDOExample.newAndCreateCriteria().andTenantEqualTo(tenant) // - .andServiceEqualTo(service) // - .andAppIdEqualTo(appId) // - .andEnvIdEqualTo(envId) // - .example(); // - - AgentConfigurationDO agentConfigurationDO = - agentConfigurationDOMapper.selectOneByExampleWithBLOBs(example); - if (agentConfigurationDO != null) { - Map configuration = - JsonUtils.fromJson(agentConfigurationDO.getValue(), HashMap.class); - - StringBuilder configStr = new StringBuilder(); - configuration.forEach((key, value) -> { - configStr.append(key).append(":").append(value); - }); - - AgentConfiguration agentConfiguration = new AgentConfiguration( - agentConfigurationDO.getTenant(), agentConfigurationDO.getService(), - agentConfigurationDO.getAppId(), agentConfigurationDO.getEnvId(), configuration, - Hashing.sha512().hashString(configStr.toString(), StandardCharsets.UTF_8).toString()); - - return agentConfiguration; - } - - return null; - } - -} diff --git a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/AgentConfiguration.java b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/TraceAgentConfiguration.java similarity index 51% rename from server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/AgentConfiguration.java rename to server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/TraceAgentConfiguration.java index 73e4c74de..5d7ed517b 100644 --- a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/AgentConfiguration.java +++ b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/TraceAgentConfiguration.java @@ -3,10 +3,14 @@ */ package io.holoinsight.server.gateway.core.trace.config; +import io.holoinsight.server.common.Const; import lombok.Getter; import lombok.Setter; import lombok.ToString; +import org.apache.commons.lang3.StringUtils; +import java.util.ArrayList; +import java.util.List; import java.util.Map; /** @@ -18,28 +22,23 @@ @Setter @Getter @ToString -public class AgentConfiguration { +public class TraceAgentConfiguration { private String tenant; private String service; - private String appId; - private String envId; + private String type; + private String language; private Map configuration; /** * The uuid is calculated by the dynamic configuration of the service. */ private volatile String uuid; - /** - *

- * Constructor for AgentConfiguration. - *

- */ - public AgentConfiguration(final String tenant, final String service, final String appId, - final String envId, final Map configuration, final String uuid) { + public TraceAgentConfiguration(String tenant, String service, String type, String language, + Map configuration, String uuid) { this.tenant = tenant; this.service = service; - this.appId = appId; - this.envId = envId; + this.type = type; + this.language = language; this.configuration = configuration; this.uuid = uuid; } @@ -50,6 +49,18 @@ public AgentConfiguration(final String tenant, final String service, final Strin *

*/ public String getCacheKey() { - return this.tenant + "_" + this.service + "_" + this.appId + "_" + this.envId; + List cacheKeys = new ArrayList() { + { + add(tenant); + add(service); + } + }; + if (!StringUtils.isEmpty(type)) { + cacheKeys.add(type); + } + if (!StringUtils.isEmpty(language)) { + cacheKeys.add(language); + } + return StringUtils.join(cacheKeys, Const.TRACE_AGENT_CONFIG_KEY_JOINER); } } diff --git a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/TraceAgentConfigurationService.java b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/TraceAgentConfigurationService.java new file mode 100644 index 000000000..dcf57d62c --- /dev/null +++ b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/config/TraceAgentConfigurationService.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.gateway.core.trace.config; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.hash.Hashing; +import io.holoinsight.server.common.dao.entity.TraceAgentConfigurationDO; +import io.holoinsight.server.common.dao.mapper.TraceAgentConfigurationDOMapper; +import org.springframework.beans.factory.annotation.Autowired; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * GetTraceAgentConfigurationService class. + *

+ * + * @author sw1136562366 + */ +public class TraceAgentConfigurationService { + @Autowired + private TraceAgentConfigurationDOMapper traceAgentConfigurationDOMapper; + + /** + *

+ * getALLFromDB. + *

+ */ + public List getALLFromDB() throws JsonProcessingException { + List traceAgentConfigurationDOList = + traceAgentConfigurationDOMapper.selectByExampleWithBLOBs(null); + List result = new ArrayList<>(traceAgentConfigurationDOList.size()); + for (TraceAgentConfigurationDO traceAgentConfigurationDO : traceAgentConfigurationDOList) { + Map configuration = + new ObjectMapper().readValue(traceAgentConfigurationDO.getValue(), HashMap.class); + + StringBuilder configStr = new StringBuilder(); + configuration.forEach((key, value) -> { + configStr.append(key).append(":").append(value); + }); + + TraceAgentConfiguration TraceAgentConfiguration = + new TraceAgentConfiguration(traceAgentConfigurationDO.getTenant(), + traceAgentConfigurationDO.getService(), traceAgentConfigurationDO.getType(), + traceAgentConfigurationDO.getLanguage(), configuration, + Hashing.sha512().hashString(configStr.toString(), StandardCharsets.UTF_8).toString()); + + result.add(TraceAgentConfiguration); + } + + return result; + } + +} diff --git a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/controller/AgentConfigurationController.java b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/controller/AgentConfigurationController.java deleted file mode 100644 index 473de94c3..000000000 --- a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/controller/AgentConfigurationController.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. - */ -package io.holoinsight.server.gateway.core.trace.controller; - -import io.holoinsight.server.gateway.core.trace.config.AgentConfiguration; -import io.holoinsight.server.gateway.core.trace.scheduler.AgentConfigurationScheduler; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -/** - *

- * AgentConfigurationController class. - *

- * - * @author sw1136562366 - */ -@ResponseBody -@RequestMapping({"/api/agent/configuration", "/internal/api/gateway/agent/configuration"}) -public class AgentConfigurationController { - - private static final Logger LOGGER = LoggerFactory.getLogger(AgentConfigurationController.class); - - @Autowired - private AgentConfigurationScheduler agentConfigurationScheduler; - - /** - *

- * getAgentConfiguration. - *

- */ - @GetMapping("/query") - public AgentConfiguration getAgentConfiguration(@RequestParam String cacheKey) { - try { - return agentConfigurationScheduler.getValue(cacheKey); - } catch (Exception e) { - LOGGER.error("Query agent configuration error: ", e.getMessage()); - } - - return null; - } - -} diff --git a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/controller/TraceAgentConfigurationController.java b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/controller/TraceAgentConfigurationController.java new file mode 100644 index 000000000..f55eb4a27 --- /dev/null +++ b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/controller/TraceAgentConfigurationController.java @@ -0,0 +1,98 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.gateway.core.trace.controller; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.holoinsight.server.common.Const; +import io.holoinsight.server.gateway.core.trace.config.TraceAgentConfiguration; +import io.holoinsight.server.gateway.core.trace.scheduler.TraceAgentConfigurationScheduler; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + *

+ * AgentConfigurationController class. + *

+ * + * @author sw1136562366 + */ + +@RequestMapping({"/api/agent/configuration", "/internal/api/gateway/agent/configuration"}) +public class TraceAgentConfigurationController { + + private static final Logger LOGGER = + LoggerFactory.getLogger(TraceAgentConfigurationController.class); + + @Autowired + private TraceAgentConfigurationScheduler agentConfigurationScheduler; + + /** + *

+ * getAgentConfiguration. + *

+ */ + @PostMapping("/query") + @ResponseBody + public TraceAgentConfiguration getAgentConfiguration(@RequestBody Map request) { + String tenant = request.get("tenant"); + String service = request.get("service"); + HashMap extendMap = null; + try { + if (request.get("extendInfo") != null) { + extendMap = new ObjectMapper().readValue(request.get("extendInfo"), HashMap.class); + } + TraceAgentConfiguration configuration = + agentConfigurationScheduler.getValue(cacheKey(tenant, service, extendMap)); + // If the service configuration is empty, get the tenant configuration + if (configuration == null) { + configuration = agentConfigurationScheduler.getValue(cacheKey(tenant, "*", extendMap)); + } + // If the tenant configuration is empty, get the global configuration + if (configuration == null) { + configuration = agentConfigurationScheduler.getValue(cacheKey("*", "*", extendMap)); + } + return configuration; + } catch (Exception e) { + LOGGER.error(String.format("Query trace agent configuration error, request: %s,", extendMap), + e.getMessage()); + } + return null; + } + + public String cacheKey(String tenant, String service, Map extendInfo) { + List cacheKeys = new ArrayList() { + { + add(cacheTenant(tenant, extendInfo)); + add(service); + } + }; + if (extendInfo != null) { + String agentType = extendInfo.get("type"); + if (!StringUtils.isEmpty(agentType)) { + cacheKeys.add(agentType); + } + String language = extendInfo.get("language"); + if (!StringUtils.isEmpty(language)) { + cacheKeys.add(language); + } + } + return StringUtils.join(cacheKeys, Const.TRACE_AGENT_CONFIG_KEY_JOINER); + } + + public String cacheTenant(String tenant, Map extendInfo) { + return tenant; + } + +} diff --git a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/scheduler/AgentConfigurationScheduler.java b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/scheduler/TraceAgentConfigurationScheduler.java similarity index 64% rename from server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/scheduler/AgentConfigurationScheduler.java rename to server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/scheduler/TraceAgentConfigurationScheduler.java index fd0634422..8a3eaf3b7 100644 --- a/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/scheduler/AgentConfigurationScheduler.java +++ b/server/gateway/gateway-core/src/main/java/io/holoinsight/server/gateway/core/trace/scheduler/TraceAgentConfigurationScheduler.java @@ -3,10 +3,10 @@ */ package io.holoinsight.server.gateway.core.trace.scheduler; -import io.holoinsight.server.gateway.core.trace.config.AgentConfiguration; -import io.holoinsight.server.gateway.core.trace.config.GetAgentConfigurationService; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; +import io.holoinsight.server.gateway.core.trace.config.TraceAgentConfiguration; +import io.holoinsight.server.gateway.core.trace.config.TraceAgentConfigurationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -23,13 +23,14 @@ * * @author sw1136562366 */ -public class AgentConfigurationScheduler { +public class TraceAgentConfigurationScheduler { - private static final Logger LOGGER = LoggerFactory.getLogger(AgentConfigurationScheduler.class); + private static final Logger LOGGER = + LoggerFactory.getLogger(TraceAgentConfigurationScheduler.class); @Autowired - private GetAgentConfigurationService getAgentConfigurations; + private TraceAgentConfigurationService traceAgentConfigurationService; - public Cache cache; + public Cache cache; /** *

@@ -49,9 +50,9 @@ public void init() { @Scheduled(cron = "*/30 * * * * *") private void updateCache() { try { - List allFromDB = getAgentConfigurations.getALLFromDB(); + List allFromDB = traceAgentConfigurationService.getALLFromDB(); cache.cleanUp(); - for (AgentConfiguration agentConfiguration : allFromDB) { + for (TraceAgentConfiguration agentConfiguration : allFromDB) { cache.put(agentConfiguration.getCacheKey(), agentConfiguration); } } catch (Exception e) { @@ -64,7 +65,7 @@ private void updateCache() { * getValue. *

*/ - public AgentConfiguration getValue(String cacheKey) { + public TraceAgentConfiguration getValue(String cacheKey) { return cache.getIfPresent(cacheKey); } @@ -73,7 +74,7 @@ public AgentConfiguration getValue(String cacheKey) { * Getter for the field cache. *

*/ - public Cache getCache() { + public Cache getCache() { return cache; } } diff --git a/server/home/home-boot/src/main/java/io/holoinsight/server/home/bootstrap/HoloinsightHomeConfiguration.java b/server/home/home-boot/src/main/java/io/holoinsight/server/home/bootstrap/HoloinsightHomeConfiguration.java index aa7e332d0..5da02b522 100644 --- a/server/home/home-boot/src/main/java/io/holoinsight/server/home/bootstrap/HoloinsightHomeConfiguration.java +++ b/server/home/home-boot/src/main/java/io/holoinsight/server/home/bootstrap/HoloinsightHomeConfiguration.java @@ -23,6 +23,7 @@ import io.holoinsight.server.home.biz.service.impl.UserinfoVerificationServiceImpl; import io.holoinsight.server.home.common.service.RequestContextAdapter; import io.holoinsight.server.home.common.service.RequestContextAdapterImpl; +import io.holoinsight.server.home.web.controller.TraceAgentFacadeImpl; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -84,4 +85,9 @@ public UserinfoVerificationService userinfoVerificationService() { public RequestContextAdapter requestContextAdapter() { return new RequestContextAdapterImpl(); } + + @Bean + public TraceAgentFacadeImpl traceAgentFacadeImpl() { + return new TraceAgentFacadeImpl(); + } } diff --git a/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/AgentConfigurationMapper.java b/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/TraceAgentConfPropMapper.java similarity index 56% rename from server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/AgentConfigurationMapper.java rename to server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/TraceAgentConfPropMapper.java index bf5d12a29..57027668d 100644 --- a/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/AgentConfigurationMapper.java +++ b/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/TraceAgentConfPropMapper.java @@ -3,8 +3,8 @@ */ package io.holoinsight.server.home.dal.mapper; -import io.holoinsight.server.home.dal.model.AgentConfiguration; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import io.holoinsight.server.home.dal.model.TraceAgentConfProp; -public interface AgentConfigurationMapper extends BaseMapper { +public interface TraceAgentConfPropMapper extends BaseMapper { } diff --git a/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/TraceAgentConfigurationMapper.java b/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/TraceAgentConfigurationMapper.java new file mode 100644 index 000000000..e3f22a69a --- /dev/null +++ b/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/mapper/TraceAgentConfigurationMapper.java @@ -0,0 +1,10 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.home.dal.mapper; + +import io.holoinsight.server.home.dal.model.TraceAgentConfiguration; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +public interface TraceAgentConfigurationMapper extends BaseMapper { +} diff --git a/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/TraceAgentConfProp.java b/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/TraceAgentConfProp.java new file mode 100644 index 000000000..8f0a6bf18 --- /dev/null +++ b/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/TraceAgentConfProp.java @@ -0,0 +1,28 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.home.dal.model; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import javax.persistence.Column; + +@Data +@TableName("trace_agent_configuration_properties") +public class TraceAgentConfProp { + private String type; + private String language; + @Column(name = "prop_key") + private String propKey; + private String name; + @Column(name = "c_name") + private String cName; + private String description; + @Column(name = "c_description") + private String cDescription; + @Column(name = "check_expression") + private String checkExpression; + + +} diff --git a/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/AgentConfiguration.java b/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/TraceAgentConfiguration.java similarity index 72% rename from server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/AgentConfiguration.java rename to server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/TraceAgentConfiguration.java index e33c08dae..1d34038e3 100644 --- a/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/AgentConfiguration.java +++ b/server/home/home-dal/src/main/java/io/holoinsight/server/home/dal/model/TraceAgentConfiguration.java @@ -10,18 +10,12 @@ import java.util.Date; @Data -@TableName("agent_configuration") -public class AgentConfiguration { +@TableName("trace_agent_configuration") +public class TraceAgentConfiguration { private String tenant; - private String service; - - @Column(name = "app_id") - private String appId; - - @Column(name = "env_id") - private String envId; - + private String type; + private String language; private String value; @Column(name = "gmt_create") diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/AgentConfigurationService.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/AgentConfigurationService.java deleted file mode 100644 index bbddc08c5..000000000 --- a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/AgentConfigurationService.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. - */ -package io.holoinsight.server.home.biz.service; - - -import io.holoinsight.server.home.dal.model.AgentConfiguration; -import com.baomidou.mybatisplus.extension.service.IService; - -public interface AgentConfigurationService extends IService { - - AgentConfiguration get(AgentConfiguration agentConfiguration); - - boolean createOrUpdate(AgentConfiguration agentConfiguration); - -} diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/TraceAgentConfPropService.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/TraceAgentConfPropService.java new file mode 100644 index 000000000..ad0733cc3 --- /dev/null +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/TraceAgentConfPropService.java @@ -0,0 +1,16 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.home.biz.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import io.holoinsight.server.home.dal.model.TraceAgentConfProp; + +import java.util.List; + +public interface TraceAgentConfPropService extends IService { + + List get(String type, String language); + +} diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/TraceAgentConfigurationService.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/TraceAgentConfigurationService.java new file mode 100644 index 000000000..43ef89dfc --- /dev/null +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/TraceAgentConfigurationService.java @@ -0,0 +1,16 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.home.biz.service; + + +import io.holoinsight.server.home.dal.model.TraceAgentConfiguration; +import com.baomidou.mybatisplus.extension.service.IService; + +public interface TraceAgentConfigurationService extends IService { + + TraceAgentConfiguration get(TraceAgentConfiguration agentConfiguration); + + boolean createOrUpdate(TraceAgentConfiguration agentConfiguration); + +} diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/TraceAgentConfPropServiceImpl.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/TraceAgentConfPropServiceImpl.java new file mode 100644 index 000000000..d98c30155 --- /dev/null +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/TraceAgentConfPropServiceImpl.java @@ -0,0 +1,32 @@ +/* + * Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0. + */ +package io.holoinsight.server.home.biz.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import io.holoinsight.server.home.biz.service.TraceAgentConfPropService; +import io.holoinsight.server.home.dal.mapper.TraceAgentConfPropMapper; +import io.holoinsight.server.home.dal.model.TraceAgentConfProp; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * + * @author sw1136562366 + * @version 1.0: TraceAgentConfPropServiceImpl.java, v 0.1 2023年08月17日 3:17 下午 sw1136562366 Exp $ + */ +@Service +public class TraceAgentConfPropServiceImpl extends + ServiceImpl implements TraceAgentConfPropService { + + @Override + public List get(String type, String language) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("type", type); + queryWrapper.eq("language", language); + + return list(queryWrapper); + } +} diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AgentConfigurationServiceImpl.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/TraceAgentConfigurationServiceImpl.java similarity index 52% rename from server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AgentConfigurationServiceImpl.java rename to server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/TraceAgentConfigurationServiceImpl.java index 74666c9be..536a3cd20 100644 --- a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AgentConfigurationServiceImpl.java +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/TraceAgentConfigurationServiceImpl.java @@ -3,9 +3,9 @@ */ package io.holoinsight.server.home.biz.service.impl; -import io.holoinsight.server.home.biz.service.AgentConfigurationService; -import io.holoinsight.server.home.dal.mapper.AgentConfigurationMapper; -import io.holoinsight.server.home.dal.model.AgentConfiguration; +import io.holoinsight.server.home.biz.service.TraceAgentConfigurationService; +import io.holoinsight.server.home.dal.mapper.TraceAgentConfigurationMapper; +import io.holoinsight.server.home.dal.model.TraceAgentConfiguration; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -19,36 +19,37 @@ * @version 1.0: AgentConfigurationServiceImpl.java, v 0.1 2022年06月21日 3:17 下午 jinsong.yjs Exp $ */ @Service -public class AgentConfigurationServiceImpl extends - ServiceImpl implements AgentConfigurationService { +public class TraceAgentConfigurationServiceImpl + extends ServiceImpl + implements TraceAgentConfigurationService { @Override - public AgentConfiguration get(AgentConfiguration agentConfiguration) { - QueryWrapper queryWrapper = new QueryWrapper<>(); + public TraceAgentConfiguration get(TraceAgentConfiguration agentConfiguration) { + QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("tenant", agentConfiguration.getTenant()); queryWrapper.eq("service", agentConfiguration.getService()); - queryWrapper.eq("app_id", agentConfiguration.getAppId()); - queryWrapper.eq("env_id", agentConfiguration.getEnvId()); + queryWrapper.eq("type", agentConfiguration.getType()); + queryWrapper.eq("language", agentConfiguration.getLanguage()); return getOne(queryWrapper); } @Override - public boolean createOrUpdate(AgentConfiguration agentConfiguration) { - AgentConfiguration query = get(agentConfiguration); + public boolean createOrUpdate(TraceAgentConfiguration agentConfiguration) { + TraceAgentConfiguration query = get(agentConfiguration); agentConfiguration.setGmtModified(new Date()); boolean result; if (query == null) { agentConfiguration.setGmtCreate(new Date()); result = save(agentConfiguration); } else { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); updateWrapper.eq("tenant", agentConfiguration.getTenant()); updateWrapper.eq("service", agentConfiguration.getService()); - updateWrapper.eq("app_id", agentConfiguration.getAppId()); - updateWrapper.eq("env_id", agentConfiguration.getEnvId()); + updateWrapper.eq("type", agentConfiguration.getType()); + updateWrapper.eq("language", agentConfiguration.getLanguage()); updateWrapper.set("value", agentConfiguration.getValue()); - updateWrapper.set("gmt_modified", agentConfiguration.getGmtModified()); + updateWrapper.set("gmt_modified", new Date()); result = update(updateWrapper); } diff --git a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/TraceAgentFacadeImpl.java b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/TraceAgentFacadeImpl.java index 77adccd14..c80f1e2fd 100644 --- a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/TraceAgentFacadeImpl.java +++ b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/TraceAgentFacadeImpl.java @@ -10,16 +10,26 @@ import io.holoinsight.server.home.biz.common.MetaDictUtil; import io.holoinsight.server.home.biz.service.ApiKeyService; import io.holoinsight.server.home.biz.service.TenantInitService; +import io.holoinsight.server.home.biz.service.TraceAgentConfPropService; +import io.holoinsight.server.home.biz.service.TraceAgentConfigurationService; +import io.holoinsight.server.home.common.util.MonitorException; +import io.holoinsight.server.home.common.util.scope.MonitorScope; import io.holoinsight.server.home.common.util.scope.RequestContext; import io.holoinsight.server.home.dal.model.ApiKey; +import io.holoinsight.server.home.dal.model.TraceAgentConfProp; +import io.holoinsight.server.home.dal.model.TraceAgentConfiguration; import io.holoinsight.server.home.web.common.AesUtil; +import io.holoinsight.server.home.web.common.ManageCallback; +import io.holoinsight.server.home.web.common.ParaCheckUtil; import io.holoinsight.server.home.web.config.TraceAuthEncryptConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import java.util.HashMap; @@ -43,6 +53,10 @@ public class TraceAgentFacadeImpl extends BaseFacade { @Autowired private TenantInitService tenantInitService; + @Autowired + private TraceAgentConfigurationService agentConfigurationService; + @Autowired + private TraceAgentConfPropService traceAgentConfPropService; @Autowired private TraceAuthEncryptConfiguration traceAuthEncryptConfiguration; @@ -100,6 +114,111 @@ public JsonResult> traceAgent( return result; } + @PostMapping(value = "/create/configuration") + @ResponseBody + public JsonResult createAgentConfiguration(@RequestBody Map request) { + final JsonResult result = new JsonResult<>(); + facadeTemplate.manage(result, new ManageCallback() { + @Override + public void checkParameter() { + ParaCheckUtil.checkParaNotNull(request, "request"); + ParaCheckUtil.checkParaNotNull(request.get("tenant"), "tenant"); + ParaCheckUtil.checkEquals(request.get("tenant"), RequestContext.getContext().ms.getTenant(), + "tenant is illegal"); + MonitorScope ms = RequestContext.getContext().ms; + Boolean aBoolean = + tenantInitService.checkTraceParams(ms.getTenant(), ms.getWorkspace(), request); + if (!aBoolean) { + throw new MonitorException("term params is illegal"); + } + } + + @Override + public void doManage() { + TraceAgentConfiguration traceAgentConfiguration = new TraceAgentConfiguration(); + traceAgentConfiguration.setTenant(agentConfigurationTenant(request)); + traceAgentConfiguration.setService(request.get("service")); + traceAgentConfiguration.setType(request.get("type")); + traceAgentConfiguration.setLanguage(request.get("language")); + traceAgentConfiguration.setValue(request.get("value")); + boolean isSuccess = agentConfigurationService.createOrUpdate(traceAgentConfiguration); + if (isSuccess) { + JsonResult.createSuccessResult(result, isSuccess); + } else { + JsonResult.fillFailResultTo(result, "Create agent configuration failed!"); + } + } + }); + + return result; + } + + @PostMapping(value = "/query/configuration") + @ResponseBody + public JsonResult queryAgentConfiguration( + @RequestBody Map request) { + final JsonResult result = new JsonResult<>(); + facadeTemplate.manage(result, new ManageCallback() { + @Override + public void checkParameter() { + ParaCheckUtil.checkParaNotNull(request, "request"); + ParaCheckUtil.checkParaNotNull(request.get("tenant"), "tenant"); + ParaCheckUtil.checkEquals(request.get("tenant"), RequestContext.getContext().ms.getTenant(), + "tenant is illegal"); + MonitorScope ms = RequestContext.getContext().ms; + Boolean aBoolean = + tenantInitService.checkTraceParams(ms.getTenant(), ms.getWorkspace(), request); + if (!aBoolean) { + throw new MonitorException("term params is illegal"); + } + } + + @Override + public void doManage() { + TraceAgentConfiguration traceAgentConfiguration = new TraceAgentConfiguration(); + traceAgentConfiguration.setTenant(agentConfigurationTenant(request)); + traceAgentConfiguration.setService(request.get("service")); + traceAgentConfiguration.setValue(request.get("value")); + traceAgentConfiguration.setType(request.get("type")); + traceAgentConfiguration.setLanguage(request.get("language")); + TraceAgentConfiguration configuration = + agentConfigurationService.get(traceAgentConfiguration); + JsonResult.createSuccessResult(result, configuration); + + } + }); + + return result; + } + + @GetMapping(value = "/query/configuration/properties") + @ResponseBody + public JsonResult> queryAgentConfProperties(@RequestParam String type, + @RequestParam String language) { + final JsonResult> result = new JsonResult<>(); + facadeTemplate.manage(result, new ManageCallback() { + @Override + public void checkParameter() { + ParaCheckUtil.checkParaNotNull(type, "type"); + ParaCheckUtil.checkParaNotNull(language, "language"); + } + + @Override + public void doManage() { + List traceAgentConfProps = + traceAgentConfPropService.get(type, language); + JsonResult.createSuccessResult(result, traceAgentConfProps); + } + }); + + return result; + } + + public String agentConfigurationTenant(Map request) { + return request.get("tenant"); + } + + public Map apikeyConditions(String tenant, Map extendInfo) { Map conditions = new HashMap<>(); conditions.put("tenant", tenantInitService.getTsdbTenant(tenant));