mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
[improvement][project]Adapt docker related scripts to new version.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Use an official OpenJDK runtime as a parent image
|
# Use an official OpenJDK runtime as a parent image
|
||||||
FROM openjdk:8-jdk
|
FROM openjdk:21-jdk-bullseye
|
||||||
|
|
||||||
# Set the working directory in the container
|
# Set the working directory in the container
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
@@ -7,8 +7,6 @@ WORKDIR /usr/src/app
|
|||||||
# Argument to pass in the supersonic version at build time
|
# Argument to pass in the supersonic version at build time
|
||||||
ARG SUPERSONIC_VERSION
|
ARG SUPERSONIC_VERSION
|
||||||
|
|
||||||
RUN apt-get update
|
|
||||||
|
|
||||||
# Install necessary packages, including Postgres client
|
# Install necessary packages, including Postgres client
|
||||||
RUN apt-get update && apt-get install -y postgresql-client
|
RUN apt-get update && apt-get install -y postgresql-client
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
SUPERSONIC_VERSION=0.9.10-SNAPSHOT docker-compose -f docker-compose.yml -p supersonic up
|
SUPERSONIC_VERSION=latest docker-compose -f docker-compose.yml -p supersonic up
|
||||||
@@ -11,8 +11,8 @@ services:
|
|||||||
POSTGRES_PASSWORD: supersonic_password
|
POSTGRES_PASSWORD: supersonic_password
|
||||||
ports:
|
ports:
|
||||||
- "15432:5432"
|
- "15432:5432"
|
||||||
volumes:
|
# volumes:
|
||||||
- postgres_data:/var/lib/postgresql
|
# - postgres_data:/var/lib/postgresql
|
||||||
networks:
|
networks:
|
||||||
- supersonic_network
|
- supersonic_network
|
||||||
dns:
|
dns:
|
||||||
@@ -72,9 +72,9 @@ services:
|
|||||||
- 114.114.114.114
|
- 114.114.114.114
|
||||||
- 8.8.8.8
|
- 8.8.8.8
|
||||||
- 8.8.4.4
|
- 8.8.4.4
|
||||||
volumes:
|
#volumes:
|
||||||
#1.Named Volumes are best for persistent data managed by Docker.
|
#1.Named Volumes are best for persistent data managed by Docker.
|
||||||
- supersonic_data:/usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}
|
#- supersonic_data:/usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}
|
||||||
#2.Bind Mounts are suitable for frequent modifications and debugging.
|
#2.Bind Mounts are suitable for frequent modifications and debugging.
|
||||||
# - ./conf/application-prd.yaml:/usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/application-prd.yaml
|
# - ./conf/application-prd.yaml:/usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/application-prd.yaml
|
||||||
#3.Detailed Bind Mounts offer more control over the mount behavior.
|
#3.Detailed Bind Mounts offer more control over the mount behavior.
|
||||||
@@ -84,9 +84,9 @@ services:
|
|||||||
# bind:
|
# bind:
|
||||||
# propagation: rprivate
|
# propagation: rprivate
|
||||||
# create_host_path: true
|
# create_host_path: true
|
||||||
volumes:
|
#volumes:
|
||||||
postgres_data:
|
# postgres_data:
|
||||||
supersonic_data:
|
# supersonic_data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
supersonic_network:
|
supersonic_network:
|
||||||
@@ -12,6 +12,7 @@ TAGS="latest"
|
|||||||
# If VERSION is provided, add it to TAGS and tag the image as latest
|
# If VERSION is provided, add it to TAGS and tag the image as latest
|
||||||
if [ -n "$VERSION" ]; then
|
if [ -n "$VERSION" ]; then
|
||||||
TAGS="$TAGS $VERSION"
|
TAGS="$TAGS $VERSION"
|
||||||
|
echo "Tagging Docker images $IMAGE_NAME:$VERSION to $IMAGE_NAME:latest"
|
||||||
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:latest
|
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:latest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class QueryStatDO {
|
|||||||
private String queryStructCmd;
|
private String queryStructCmd;
|
||||||
@TableField("struct_cmd_md5")
|
@TableField("struct_cmd_md5")
|
||||||
private String queryStructCmdMd5;
|
private String queryStructCmdMd5;
|
||||||
@TableField("`sql`")
|
@TableField("query_sql")
|
||||||
private String sql;
|
private String sql;
|
||||||
private String sqlMd5;
|
private String sqlMd5;
|
||||||
private String queryEngine;
|
private String queryEngine;
|
||||||
|
|||||||
@@ -16,54 +16,21 @@ import com.tencent.supersonic.chat.server.plugin.build.webservice.WebServiceQuer
|
|||||||
import com.tencent.supersonic.common.pojo.ChatApp;
|
import com.tencent.supersonic.common.pojo.ChatApp;
|
||||||
import com.tencent.supersonic.common.pojo.JoinCondition;
|
import com.tencent.supersonic.common.pojo.JoinCondition;
|
||||||
import com.tencent.supersonic.common.pojo.ModelRela;
|
import com.tencent.supersonic.common.pojo.ModelRela;
|
||||||
import com.tencent.supersonic.common.pojo.enums.AggOperatorEnum;
|
import com.tencent.supersonic.common.pojo.enums.*;
|
||||||
import com.tencent.supersonic.common.pojo.enums.AggregateTypeEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.AppModule;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.FilterOperatorEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.SensitiveLevelEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.StatusEnum;
|
|
||||||
import com.tencent.supersonic.common.pojo.enums.TypeEnums;
|
|
||||||
import com.tencent.supersonic.common.util.ChatAppManager;
|
import com.tencent.supersonic.common.util.ChatAppManager;
|
||||||
import com.tencent.supersonic.common.util.JsonUtil;
|
import com.tencent.supersonic.common.util.JsonUtil;
|
||||||
import com.tencent.supersonic.headless.api.pojo.DataSetDetail;
|
import com.tencent.supersonic.headless.api.pojo.*;
|
||||||
import com.tencent.supersonic.headless.api.pojo.DataSetModelConfig;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.Dimension;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.DimensionTimeTypeParams;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.Field;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.FieldParam;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.Identify;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.Measure;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.MeasureParam;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.MetricDefineByFieldParams;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.MetricDefineByMeasureParams;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.MetricDefineByMetricParams;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.MetricParam;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.ModelDetail;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.enums.DimensionType;
|
import com.tencent.supersonic.headless.api.pojo.enums.DimensionType;
|
||||||
import com.tencent.supersonic.headless.api.pojo.enums.IdentifyType;
|
import com.tencent.supersonic.headless.api.pojo.enums.IdentifyType;
|
||||||
import com.tencent.supersonic.headless.api.pojo.enums.MetricDefineType;
|
import com.tencent.supersonic.headless.api.pojo.enums.MetricDefineType;
|
||||||
import com.tencent.supersonic.headless.api.pojo.enums.SemanticType;
|
import com.tencent.supersonic.headless.api.pojo.enums.SemanticType;
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.DataSetReq;
|
import com.tencent.supersonic.headless.api.pojo.request.*;
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.DimensionReq;
|
import com.tencent.supersonic.headless.api.pojo.response.*;
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.DomainReq;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.MetricReq;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.ModelReq;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.request.TermReq;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.response.DataSetResp;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.response.DatabaseResp;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.response.DimensionResp;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.response.DomainResp;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.response.MetricResp;
|
|
||||||
import com.tencent.supersonic.headless.api.pojo.response.ModelResp;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -86,9 +53,7 @@ public class S2VisitsDemo extends S2BaseDemo {
|
|||||||
|
|
||||||
// create metrics and dimensions
|
// create metrics and dimensions
|
||||||
DimensionResp departmentDimension = getDimension("department", userModel);
|
DimensionResp departmentDimension = getDimension("department", userModel);
|
||||||
MetricResp metricUv = addMetric_uv(pvUvModel, departmentDimension);
|
|
||||||
MetricResp metricPv = getMetric("pv", pvUvModel);
|
MetricResp metricPv = getMetric("pv", pvUvModel);
|
||||||
addMetric_pv_avg(metricPv, metricUv, departmentDimension, pvUvModel);
|
|
||||||
|
|
||||||
DimensionResp pageDimension = getDimension("page", stayTimeModel);
|
DimensionResp pageDimension = getDimension("page", stayTimeModel);
|
||||||
updateDimension(stayTimeModel, pageDimension);
|
updateDimension(stayTimeModel, pageDimension);
|
||||||
@@ -397,31 +362,6 @@ public class S2VisitsDemo extends S2BaseDemo {
|
|||||||
return metricService.createMetric(metricReq, defaultUser);
|
return metricService.createMetric(metricReq, defaultUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MetricResp addMetric_pv_avg(MetricResp metricPv, MetricResp metricUv,
|
|
||||||
DimensionResp departmentDimension, ModelResp pvModel) throws Exception {
|
|
||||||
MetricReq metricReq = new MetricReq();
|
|
||||||
metricReq.setModelId(pvModel.getId());
|
|
||||||
metricReq.setName("人均访问次数");
|
|
||||||
metricReq.setBizName("pv_avg");
|
|
||||||
metricReq.setSensitiveLevel(SensitiveLevelEnum.HIGH.getCode());
|
|
||||||
metricReq.setDescription("每个用户平均访问的次数");
|
|
||||||
metricReq.setClassifications(Collections.singletonList("核心指标"));
|
|
||||||
metricReq.setAlias("平均访问次数");
|
|
||||||
MetricDefineByMetricParams metricTypeParams = new MetricDefineByMetricParams();
|
|
||||||
metricTypeParams.setExpr("pv/uv");
|
|
||||||
List<MetricParam> metrics = new ArrayList<>();
|
|
||||||
MetricParam pv = new MetricParam(metricPv.getId(), metricPv.getBizName());
|
|
||||||
MetricParam uv = new MetricParam(metricUv.getId(), metricUv.getBizName());
|
|
||||||
metrics.add(pv);
|
|
||||||
metrics.add(uv);
|
|
||||||
metricTypeParams.setMetrics(metrics);
|
|
||||||
metricReq.setMetricDefineByMetricParams(metricTypeParams);
|
|
||||||
metricReq.setMetricDefineType(MetricDefineType.METRIC);
|
|
||||||
metricReq.setRelateDimension(
|
|
||||||
getRelateDimension(Lists.newArrayList(departmentDimension.getId())));
|
|
||||||
return metricService.createMetric(metricReq, defaultUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
private DataSetResp addDataSet(DomainResp s2Domain) {
|
private DataSetResp addDataSet(DomainResp s2Domain) {
|
||||||
DataSetReq dataSetReq = new DataSetReq();
|
DataSetReq dataSetReq = new DataSetReq();
|
||||||
dataSetReq.setName("超音数数据集");
|
dataSetReq.setName("超音数数据集");
|
||||||
|
|||||||
@@ -404,4 +404,5 @@ ALTER TABLE s2_query_stat_info RENAME COLUMN `user` TO `query_user`;
|
|||||||
ALTER TABLE s2_chat_context RENAME COLUMN `user` TO `query_user`;
|
ALTER TABLE s2_chat_context RENAME COLUMN `user` TO `query_user`;
|
||||||
|
|
||||||
--20241226
|
--20241226
|
||||||
alter table s2_chat_memory add column `query_id` BIGINT DEFAULT NULL;
|
ALTER TABLE s2_chat_memory add column `query_id` BIGINT DEFAULT NULL;
|
||||||
|
ALTER TABLE s2_query_stat_info RENAME COLUMN `sql` TO `query_sql`;
|
||||||
@@ -299,7 +299,7 @@ CREATE TABLE IF NOT EXISTS `s2_query_stat_info` (
|
|||||||
`sql_cmd_md5` varchar(200) DEFAULT NULL, -- sql type request parameter md5
|
`sql_cmd_md5` varchar(200) DEFAULT NULL, -- sql type request parameter md5
|
||||||
`query_struct_cmd`LONGVARCHAR , -- struct type request parameter
|
`query_struct_cmd`LONGVARCHAR , -- struct type request parameter
|
||||||
`struct_cmd_md5` varchar(200) DEFAULT NULL, -- struct type request parameter md5值
|
`struct_cmd_md5` varchar(200) DEFAULT NULL, -- struct type request parameter md5值
|
||||||
`sql`LONGVARCHAR ,
|
`query_sql` LONGVARCHAR ,
|
||||||
`sql_md5` varchar(200) DEFAULT NULL, -- sql md5
|
`sql_md5` varchar(200) DEFAULT NULL, -- sql md5
|
||||||
`query_engine` varchar(20) DEFAULT NULL,
|
`query_engine` varchar(20) DEFAULT NULL,
|
||||||
`elapsed_ms` bigINT DEFAULT NULL,
|
`elapsed_ms` bigINT DEFAULT NULL,
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ CREATE TABLE IF NOT EXISTS `s2_query_stat_info` (
|
|||||||
`sql_cmd_md5` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql md5值',
|
`sql_cmd_md5` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql md5值',
|
||||||
`query_struct_cmd` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '对应查询的struct',
|
`query_struct_cmd` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '对应查询的struct',
|
||||||
`struct_cmd_md5` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql md5值',
|
`struct_cmd_md5` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql md5值',
|
||||||
`sql` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '对应查询的sql',
|
`query_sql` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '对应查询的sql',
|
||||||
`sql_md5` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql md5值',
|
`sql_md5` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql md5值',
|
||||||
`query_engine` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '查询引擎',
|
`query_engine` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '查询引擎',
|
||||||
`elapsed_ms` bigint(10) DEFAULT NULL COMMENT '查询耗时',
|
`elapsed_ms` bigint(10) DEFAULT NULL COMMENT '查询耗时',
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ CREATE TABLE IF NOT EXISTS s2_query_stat_info (
|
|||||||
sql_cmd_md5 varchar(200) DEFAULT NULL,
|
sql_cmd_md5 varchar(200) DEFAULT NULL,
|
||||||
query_struct_cmd text,
|
query_struct_cmd text,
|
||||||
struct_cmd_md5 varchar(200) DEFAULT NULL,
|
struct_cmd_md5 varchar(200) DEFAULT NULL,
|
||||||
sql text,
|
query_sql text,
|
||||||
sql_md5 varchar(200) DEFAULT NULL,
|
sql_md5 varchar(200) DEFAULT NULL,
|
||||||
query_engine varchar(20) DEFAULT NULL,
|
query_engine varchar(20) DEFAULT NULL,
|
||||||
elapsed_ms bigint DEFAULT NULL,
|
elapsed_ms bigint DEFAULT NULL,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ModelSchemaTest extends BaseTest {
|
|||||||
fieldRemovedReq.setModelId(2L);
|
fieldRemovedReq.setModelId(2L);
|
||||||
fieldRemovedReq.setFields(Lists.newArrayList("pv"));
|
fieldRemovedReq.setFields(Lists.newArrayList("pv"));
|
||||||
UnAvailableItemResp unAvailableItemResp = modelService.getUnAvailableItem(fieldRemovedReq);
|
UnAvailableItemResp unAvailableItemResp = modelService.getUnAvailableItem(fieldRemovedReq);
|
||||||
List<Long> expectedUnAvailableMetricId = Lists.newArrayList(1L, 4L);
|
List<Long> expectedUnAvailableMetricId = Lists.newArrayList(1L);
|
||||||
List<Long> actualUnAvailableMetricId =
|
List<Long> actualUnAvailableMetricId =
|
||||||
unAvailableItemResp.getMetricResps().stream().map(MetricResp::getId)
|
unAvailableItemResp.getMetricResps().stream().map(MetricResp::getId)
|
||||||
.sorted(Comparator.naturalOrder()).collect(Collectors.toList());
|
.sorted(Comparator.naturalOrder()).collect(Collectors.toList());
|
||||||
|
|||||||
Reference in New Issue
Block a user