[hotfix]Fix UITemplate storage Influxdb implamented (#4849)
This commit is contained in:
parent
d094a0f7c0
commit
3f176bf50f
|
|
@ -85,7 +85,7 @@ public class UITemplateManagementDAOImpl implements UITemplateManagementDAO {
|
|||
Point point = Point.measurement(UITemplate.INDEX_NAME)
|
||||
.tag(InfluxConstants.TagName.ID_COLUMN, uiTemplate.id())
|
||||
.fields(builder.data2Map(uiTemplate))
|
||||
.time(0L, TimeUnit.MILLISECONDS)
|
||||
.time(1L, TimeUnit.NANOSECONDS)
|
||||
.build();
|
||||
client.write(point);
|
||||
return TemplateChangeStatus.builder().status(true).build();
|
||||
|
|
@ -104,8 +104,8 @@ public class UITemplateManagementDAOImpl implements UITemplateManagementDAO {
|
|||
if (Objects.nonNull(series)) {
|
||||
Point point = Point.measurement(UITemplate.INDEX_NAME)
|
||||
.fields(builder.data2Map(uiTemplate))
|
||||
.tag(series.getTags())
|
||||
.time(0L, TimeUnit.MILLISECONDS)
|
||||
.tag(InfluxConstants.TagName.ID_COLUMN, uiTemplate.id())
|
||||
.time(1L, TimeUnit.NANOSECONDS)
|
||||
.build();
|
||||
client.write(point);
|
||||
return TemplateChangeStatus.builder().status(true).build();
|
||||
|
|
@ -118,22 +118,13 @@ public class UITemplateManagementDAOImpl implements UITemplateManagementDAO {
|
|||
public TemplateChangeStatus disableTemplate(final String name) throws IOException {
|
||||
WhereQueryImpl<SelectQueryImpl> query = select().all()
|
||||
.from(client.getDatabase(), UITemplate.INDEX_NAME)
|
||||
.where(eq(InfluxConstants.NAME, name));
|
||||
.where(eq(InfluxConstants.TagName.ID_COLUMN, name));
|
||||
QueryResult.Series series = client.queryForSingleSeries(query);
|
||||
if (Objects.nonNull(series)) {
|
||||
List<String> columnNames = series.getColumns();
|
||||
List<Object> columnValues = series.getValues().get(0);
|
||||
|
||||
Map<String, Object> storageData = Maps.newHashMap();
|
||||
for (int i = 1; i < columnNames.size(); i++) {
|
||||
storageData.put(columnNames.get(i), columnValues.get(i));
|
||||
}
|
||||
|
||||
storageData.put(UITemplate.DISABLED, BooleanUtils.TRUE);
|
||||
Point point = Point.measurement(UITemplate.INDEX_NAME)
|
||||
.tag(series.getTags())
|
||||
.fields(storageData)
|
||||
.time(0L, TimeUnit.MILLISECONDS)
|
||||
.tag(InfluxConstants.TagName.ID_COLUMN, name)
|
||||
.addField(UITemplate.DISABLED, BooleanUtils.TRUE)
|
||||
.time(1L, TimeUnit.NANOSECONDS)
|
||||
.build();
|
||||
client.write(point);
|
||||
return TemplateChangeStatus.builder().status(true).build();
|
||||
|
|
|
|||
|
|
@ -34,12 +34,9 @@ services:
|
|||
service: oap
|
||||
environment:
|
||||
SW_STORAGE: influxdb
|
||||
SW_STORAGE_ES_BULK_ACTIONS: 1
|
||||
SW_CORE_DATA_KEEPER_EXECUTE_PERIOD: 1
|
||||
SW_CORE_RECORD_DATA_TTL: 7
|
||||
SW_CORE_MINUTE_METRIC_DATA_TTL: 6000
|
||||
SW_CORE_HOUR_METRIC_DATA_TTL: 100
|
||||
SW_CORE_DAY_METRIC_DATA_TTL: 5
|
||||
SW_CORE_MONTH_METRIC_DATA_TTL: 4
|
||||
SW_STORAGE_ES_FLUSH_INTERVAL: 1
|
||||
depends_on:
|
||||
influxdb:
|
||||
condition: service_healthy
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package org.apache.skywalking.e2e.storage;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.skywalking.e2e.UIConfigurationManagementClient;
|
||||
import org.apache.skywalking.e2e.annotation.ContainerHostAndPort;
|
||||
|
|
@ -170,55 +171,51 @@ public class StorageE2E extends SkyWalkingTestAdapter {
|
|||
|
||||
@Test
|
||||
void addUITemplate() throws Exception {
|
||||
try {
|
||||
TemplateChangeStatus templateChangeStatus = graphql.addTemplate(
|
||||
assertTrue(
|
||||
graphql.addTemplate(
|
||||
emptySetting("test-ui-config-1").type(TemplateType.DASHBOARD)
|
||||
);
|
||||
LOGGER.info("add template = {}", templateChangeStatus);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("add ui template error.", e);
|
||||
}
|
||||
).isStatus()
|
||||
);
|
||||
TimeUnit.SECONDS.sleep(2L);
|
||||
|
||||
verifyTemplates("expected/storage/dashboardConfiguration.yml");
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeTemplate() throws Exception {
|
||||
try {
|
||||
final String name = "test-ui-config-2";
|
||||
assertTrue(
|
||||
graphql.addTemplate(
|
||||
emptySetting(name).type(TemplateType.TOPOLOGY_SERVICE)
|
||||
).isStatus()
|
||||
);
|
||||
final String name = "test-ui-config-2";
|
||||
assertTrue(
|
||||
graphql.addTemplate(
|
||||
emptySetting(name).type(TemplateType.DASHBOARD)
|
||||
).isStatus()
|
||||
);
|
||||
TimeUnit.SECONDS.sleep(2L);
|
||||
|
||||
TemplateChangeStatus templateChangeStatus = graphql.changeTemplate(
|
||||
emptySetting(name).configuration("{\"key\":\"value\"}")
|
||||
);
|
||||
LOGGER.info("change UITemplate = {}", templateChangeStatus);
|
||||
assertTrue(templateChangeStatus.isStatus());
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("add ui template error.", e);
|
||||
}
|
||||
TemplateChangeStatus templateChangeStatus = graphql.changeTemplate(
|
||||
emptySetting(name).type(TemplateType.TOPOLOGY_SERVICE)
|
||||
);
|
||||
LOGGER.info("change UITemplate = {}", templateChangeStatus);
|
||||
assertTrue(templateChangeStatus.isStatus());
|
||||
|
||||
TimeUnit.SECONDS.sleep(2L);
|
||||
verifyTemplates("expected/storage/dashboardConfiguration-change.yml");
|
||||
}
|
||||
|
||||
@Test
|
||||
void disableTemplate() throws IOException {
|
||||
try {
|
||||
final String name = "test-ui-config-3";
|
||||
assertTrue(
|
||||
graphql.addTemplate(
|
||||
emptySetting(name).type(TemplateType.DASHBOARD)
|
||||
).isStatus()
|
||||
);
|
||||
void disableTemplate() throws Exception {
|
||||
final String name = "test-ui-config-3";
|
||||
assertTrue(
|
||||
graphql.addTemplate(
|
||||
emptySetting(name).type(TemplateType.DASHBOARD)
|
||||
).isStatus()
|
||||
);
|
||||
TimeUnit.SECONDS.sleep(2L);
|
||||
|
||||
TemplateChangeStatus templateChangeStatus = graphql.disableTemplate(name);
|
||||
LOGGER.info("disable template = {}", templateChangeStatus);
|
||||
assertTrue(templateChangeStatus.isStatus());
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("add ui template error.", e);
|
||||
}
|
||||
TemplateChangeStatus templateChangeStatus = graphql.disableTemplate(name);
|
||||
LOGGER.info("disable template = {}", templateChangeStatus);
|
||||
assertTrue(templateChangeStatus.isStatus());
|
||||
|
||||
TimeUnit.SECONDS.sleep(2L);
|
||||
verifyTemplates("expected/storage/dashboardConfiguration-disable.yml");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,6 @@
|
|||
configurations:
|
||||
- name: test-ui-config-2
|
||||
type: TOPOLOGY_SERVICE
|
||||
configuration: "{}"
|
||||
configuration: not null
|
||||
activated: true
|
||||
disabled: false
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
configurations:
|
||||
- name: test-ui-config-3
|
||||
type: not null
|
||||
type: DASHBOARD
|
||||
configuration: not null
|
||||
activated: true
|
||||
disabled: true
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
configurations:
|
||||
- name: test-ui-config-1
|
||||
type: not null
|
||||
type: DASHBOARD
|
||||
configuration: not null
|
||||
activated: true
|
||||
disabled: false
|
||||
|
|
|
|||
Loading…
Reference in New Issue