You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/05/13 13:30:39 UTC
[skywalking] branch master updated: Remove InfluxDB 1.x and Apache IoTDB 0.X as storage options (#9060)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new fcc6a16215 Remove InfluxDB 1.x and Apache IoTDB 0.X as storage options (#9060)
fcc6a16215 is described below
commit fcc6a1621558bb9f992ab34da62d0fd6618ccad6
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Fri May 13 21:30:24 2022 +0800
Remove InfluxDB 1.x and Apache IoTDB 0.X as storage options (#9060)
* Remove InfluxDB 1.x and Apache IoTDB as storage options.
* Update dependencies.
---
.github/workflows/skywalking.yaml | 28 --
dist-material/release-docs/LICENSE | 11 +-
docs/en/changes/changes.md | 7 +-
docs/en/setup/backend/backend-storage.md | 36 --
docs/en/setup/backend/configuration-vocabulary.md | 542 ++++++++++-----------
oap-server-bom/pom.xml | 12 -
oap-server/server-starter/pom.xml | 10 -
.../src/main/resources/application.yml | 19 -
oap-server/server-storage-plugin/pom.xml | 2 -
.../storage-influxdb-plugin/pom.xml | 52 --
.../storage/plugin/influxdb/InfluxClient.java | 238 ---------
.../storage/plugin/influxdb/InfluxConstants.java | 58 ---
.../plugin/influxdb/InfluxStorageConfig.java | 39 --
.../plugin/influxdb/InfluxStorageProvider.java | 174 -------
.../plugin/influxdb/InfluxTableInstaller.java | 42 --
.../storage/plugin/influxdb/TableMetaInfo.java | 128 -----
.../storage/plugin/influxdb/base/BatchDAO.java | 60 ---
.../plugin/influxdb/base/HistoryDeleteDAO.java | 50 --
.../plugin/influxdb/base/InfluxInsertRequest.java | 89 ----
.../plugin/influxdb/base/InfluxStorageDAO.java | 59 ---
.../plugin/influxdb/base/ManagementDAO.java | 74 ---
.../storage/plugin/influxdb/base/MetricsDAO.java | 176 -------
.../plugin/influxdb/base/NoneStreamDAO.java | 53 --
.../storage/plugin/influxdb/base/RecordDAO.java | 81 ---
.../plugin/influxdb/query/AggregationQuery.java | 114 -----
.../storage/plugin/influxdb/query/AlarmQuery.java | 128 -----
.../plugin/influxdb/query/BrowserLogQuery.java | 118 -----
.../influxdb/query/EBPFProfilingDataQuery.java | 98 ----
.../influxdb/query/EBPFProfilingScheduleQuery.java | 85 ----
.../influxdb/query/EBPFProfilingTaskQuery.java | 119 -----
.../plugin/influxdb/query/EventQueryDAO.java | 270 ----------
.../storage/plugin/influxdb/query/LogQuery.java | 181 -------
.../plugin/influxdb/query/MetadataQuery.java | 334 -------------
.../plugin/influxdb/query/MetricsQuery.java | 219 ---------
.../influxdb/query/NetworkAddressAliasDAO.java | 87 ----
.../plugin/influxdb/query/ProfileTaskLogQuery.java | 81 ---
.../plugin/influxdb/query/ProfileTaskQuery.java | 142 ------
.../influxdb/query/ProfileThreadSnapshotQuery.java | 216 --------
.../plugin/influxdb/query/ServiceLabelQuery.java | 68 ---
.../influxdb/query/TagAutoCompleteQueryDAO.java | 116 -----
.../plugin/influxdb/query/TopNRecordsQuery.java | 108 ----
.../plugin/influxdb/query/TopologyQuery.java | 308 ------------
.../storage/plugin/influxdb/query/TraceQuery.java | 225 ---------
.../query/UITemplateManagementDAOImpl.java | 177 -------
...alking.oap.server.library.module.ModuleProvider | 19 -
.../storage-iotdb-plugin/pom.xml | 69 ---
.../server/storage/plugin/iotdb/IoTDBClient.java | 282 -----------
.../server/storage/plugin/iotdb/IoTDBIndexes.java | 41 --
.../storage/plugin/iotdb/IoTDBStorageConfig.java | 36 --
.../storage/plugin/iotdb/IoTDBStorageProvider.java | 174 -------
.../storage/plugin/iotdb/IoTDBTableInstaller.java | 45 --
.../storage/plugin/iotdb/IoTDBTableMetaInfo.java | 133 -----
.../storage/plugin/iotdb/base/IoTDBBatchDAO.java | 64 ---
.../plugin/iotdb/base/IoTDBHistoryDeleteDAO.java | 44 --
.../plugin/iotdb/base/IoTDBInsertRequest.java | 69 ---
.../plugin/iotdb/base/IoTDBManagementDAO.java | 43 --
.../storage/plugin/iotdb/base/IoTDBMetricsDAO.java | 70 ---
.../plugin/iotdb/base/IoTDBNoneStreamDAO.java | 42 --
.../storage/plugin/iotdb/base/IoTDBRecordDAO.java | 80 ---
.../storage/plugin/iotdb/base/IoTDBStorageDAO.java | 53 --
.../iotdb/cache/IoTDBNetworkAddressAliasDAO.java | 58 ---
.../management/IoTDBUITemplateManagementDAO.java | 149 ------
.../iotdb/profile/IoTDBProfileTaskLogQueryDAO.java | 73 ---
.../iotdb/profile/IoTDBProfileTaskQueryDAO.java | 122 -----
.../IoTDBProfileThreadSnapshotQueryDAO.java | 181 -------
.../iotdb/query/IoTDBAggregationQueryDAO.java | 136 ------
.../plugin/iotdb/query/IoTDBAlarmQueryDAO.java | 109 -----
.../iotdb/query/IoTDBBrowserLogQueryDAO.java | 144 ------
.../iotdb/query/IoTDBEBPFProfilingDataDAO.java | 71 ---
.../iotdb/query/IoTDBEBPFProfilingScheduleDAO.java | 67 ---
.../iotdb/query/IoTDBEBPFProfilingTaskDAO.java | 113 -----
.../plugin/iotdb/query/IoTDBEventQueryDAO.java | 218 ---------
.../plugin/iotdb/query/IoTDBLogQueryDAO.java | 160 ------
.../plugin/iotdb/query/IoTDBMetadataQueryDAO.java | 323 ------------
.../plugin/iotdb/query/IoTDBMetricsQueryDAO.java | 275 -----------
.../iotdb/query/IoTDBServiceLabelQueryDAO.java | 56 ---
.../iotdb/query/IoTDBTagAutoCompleteQueryDAO.java | 132 -----
.../iotdb/query/IoTDBTopNRecordsQueryDAO.java | 130 -----
.../plugin/iotdb/query/IoTDBTopologyQueryDAO.java | 272 -----------
.../plugin/iotdb/query/IoTDBTraceQueryDAO.java | 176 -------
.../plugin/iotdb/utils/IoTDBDataConverter.java | 194 --------
.../storage/plugin/iotdb/utils/IoTDBUtils.java | 70 ---
...alking.oap.server.library.module.ModuleProvider | 19 -
.../e2e-v2/cases/alarm/influxdb/docker-compose.yml | 57 ---
test/e2e-v2/cases/alarm/influxdb/e2e.yaml | 47 --
test/e2e-v2/cases/alarm/iotdb/docker-compose.yml | 56 ---
test/e2e-v2/cases/alarm/iotdb/e2e.yaml | 47 --
.../e2e-v2/cases/event/influxdb/docker-compose.yml | 45 --
test/e2e-v2/cases/event/influxdb/e2e.yaml | 37 --
test/e2e-v2/cases/event/iotdb/docker-compose.yml | 45 --
test/e2e-v2/cases/event/iotdb/e2e.yaml | 37 --
test/e2e-v2/cases/kafka/profile/docker-compose.yml | 15 -
test/e2e-v2/cases/log/influxdb/docker-compose.yml | 59 ---
test/e2e-v2/cases/log/influxdb/e2e.yaml | 50 --
test/e2e-v2/cases/log/iotdb/docker-compose.yml | 59 ---
test/e2e-v2/cases/log/iotdb/e2e.yaml | 50 --
.../profiling/ebpf/influxdb/docker-compose.yml | 63 ---
test/e2e-v2/cases/profiling/ebpf/influxdb/e2e.yaml | 37 --
.../cases/profiling/ebpf/iotdb/docker-compose.yml | 65 ---
test/e2e-v2/cases/profiling/ebpf/iotdb/e2e.yaml | 37 --
.../profiling/trace/influxdb/docker-compose.yml | 54 --
.../e2e-v2/cases/profiling/trace/influxdb/e2e.yaml | 37 --
.../cases/profiling/trace/iotdb/docker-compose.yml | 54 --
test/e2e-v2/cases/profiling/trace/iotdb/e2e.yaml | 37 --
.../cases/storage/influxdb/docker-compose.yml | 71 ---
test/e2e-v2/cases/storage/influxdb/e2e.yaml | 47 --
test/e2e-v2/cases/storage/iotdb/docker-compose.yml | 70 ---
test/e2e-v2/cases/storage/iotdb/e2e.yaml | 47 --
test/e2e-v2/cases/ttl/influxdb/docker-compose.yml | 66 ---
test/e2e-v2/cases/ttl/influxdb/e2e.yaml | 37 --
test/e2e-v2/cases/ttl/iotdb/docker-compose.yml | 66 ---
test/e2e-v2/cases/ttl/iotdb/e2e.yaml | 37 --
.../known-oap-backend-dependencies.txt | 11 +-
tools/profile-exporter/application.yml | 9 -
114 files changed, 270 insertions(+), 10925 deletions(-)
diff --git a/.github/workflows/skywalking.yaml b/.github/workflows/skywalking.yaml
index 707dc0cf8a..9f2b9c19b0 100644
--- a/.github/workflows/skywalking.yaml
+++ b/.github/workflows/skywalking.yaml
@@ -291,12 +291,8 @@ jobs:
config: test/e2e-v2/cases/storage/mysql/e2e.yaml
- name: Storage TiDB
config: test/e2e-v2/cases/storage/tidb/e2e.yaml
- - name: Storage InfluxDB
- config: test/e2e-v2/cases/storage/influxdb/e2e.yaml
- name: Storage PostgreSQL
config: test/e2e-v2/cases/storage/postgres/e2e.yaml
- - name: Storage IoTDB
- config: test/e2e-v2/cases/storage/iotdb/e2e.yaml
- name: Storage ES 6.3.2
config: test/e2e-v2/cases/storage/es/e2e.yaml
env: ES_VERSION=6.3.2
@@ -331,21 +327,13 @@ jobs:
config: test/e2e-v2/cases/alarm/es/e2e.yaml
- name: Alarm MySQL
config: test/e2e-v2/cases/alarm/mysql/e2e.yaml
- - name: Alarm InfluxDB
- config: test/e2e-v2/cases/alarm/influxdb/e2e.yaml
- name: Alarm PostgreSQL
config: test/e2e-v2/cases/alarm/postgres/e2e.yaml
- - name: Alarm IoTDB
- config: test/e2e-v2/cases/alarm/iotdb/e2e.yaml
- name: TTL TiDB
config: test/e2e-v2/cases/ttl/tidb/e2e.yaml
- - name: TTL InfluxDB
- config: test/e2e-v2/cases/ttl/influxdb/e2e.yaml
- name: TTL PostgreSQL
config: test/e2e-v2/cases/ttl/postgresql/e2e.yaml
- - name: TTL IotDB
- config: test/e2e-v2/cases/ttl/iotdb/e2e.yaml
- name: TTL ES 6.3.2
config: test/e2e-v2/cases/ttl/es/e2e.yaml
env: ES_VERSION=6.3.2
@@ -362,21 +350,13 @@ jobs:
config: test/e2e-v2/cases/event/es/e2e.yaml
- name: Event MySQL
config: test/e2e-v2/cases/event/mysql/e2e.yaml
- - name: Event InfluxDB
- config: test/e2e-v2/cases/event/influxdb/e2e.yaml
- - name: Event IoTDB
- config: test/e2e-v2/cases/event/iotdb/e2e.yaml
- name: Log H2
config: test/e2e-v2/cases/log/h2/e2e.yaml
- name: Log MySQL
config: test/e2e-v2/cases/log/mysql/e2e.yaml
- - name: Log InfluxDB
- config: test/e2e-v2/cases/log/influxdb/e2e.yaml
- name: Log PostgreSQL
config: test/e2e-v2/cases/log/postgres/e2e.yaml
- - name: Log IoTDB
- config: test/e2e-v2/cases/log/iotdb/e2e.yaml
- name: Log ES 6.3.2
config: test/e2e-v2/cases/log/es/e2e.yaml
env: ES_VERSION=6.3.2
@@ -424,10 +404,6 @@ jobs:
config: test/e2e-v2/cases/profiling/trace/es/e2e.yaml
- name: Trace Profiling MySQL
config: test/e2e-v2/cases/profiling/trace/mysql/e2e.yaml
- - name: Trace Profiling InfluxDB
- config: test/e2e-v2/cases/profiling/trace/influxdb/e2e.yaml
- - name: Trace Profiling IoTDB
- config: test/e2e-v2/cases/profiling/trace/iotdb/e2e.yaml
- name: eBPF Profiling H2
config: test/e2e-v2/cases/profiling/ebpf/h2/e2e.yaml
@@ -435,10 +411,6 @@ jobs:
config: test/e2e-v2/cases/profiling/ebpf/es/e2e.yaml
- name: eBPF Profiling MySQL
config: test/e2e-v2/cases/profiling/ebpf/mysql/e2e.yaml
- - name: eBPF Profiling InfluxDB
- config: test/e2e-v2/cases/profiling/ebpf/influxdb/e2e.yaml
- - name: eBPF Profiling IoTDB
- config: test/e2e-v2/cases/profiling/ebpf/iotdb/e2e.yaml
- name: Kafka Basic
config: test/e2e-v2/cases/kafka/simple-so11y/e2e.yaml
diff --git a/dist-material/release-docs/LICENSE b/dist-material/release-docs/LICENSE
index d601d548ff..624aba5a4e 100755
--- a/dist-material/release-docs/LICENSE
+++ b/dist-material/release-docs/LICENSE
@@ -308,12 +308,9 @@ The text of each license is the standard Apache 2.0 license.
javaassist 3.25.0-GA: https://github.com/jboss-javassist/javassist Apache 2.0
jackson-module-afterburner 2.12.2: https://github.com/FasterXML/jackson-modules-base, Apache 2.0
perfmark-api 0.23.0: https://github.com/perfmark/perfmark, Apache 2.0
- moshi 1.5.0: https://github.com/square/moshi, Apache 2.0
- logging-interceptor 3.13.1: https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor, Apache 2.0
- msgpack-core 0.8.16: https://github.com/msgpack/msgpack-java, Apache 2.0
+ logging-interceptor 4.9.1: https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor, Apache 2.0
swagger-annotations 1.6.3: https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-annotations, Apache 2.0
jose4j 0.7.9: https://mvnrepository.com/artifact/org.bitbucket.b_c/jose4j, Apache 2.0
- converter-moshi 2.5.0: https://mvnrepository.com/artifact/com.squareup.retrofit2/converter-moshi, Apache 2.0
vavr 0.10.3: https://github.com/vavr-io/vavr, Apache 2.0
kafka-clients 2.4.1: https://github.com/apache/kafka, Apache 2.0
lz4-java 1.6.0: https://github.com/jpountz/lz4-java, Apache 2.0
@@ -327,11 +324,6 @@ The text of each license is the standard Apache 2.0 license.
Armeria 1.14.1, http://github.com/line/armeria, Apache 2.0
Brotli4j 1.6.0, https://github.com/hyperxpro/Brotli4j, Apache 2.0
micrometer 1.8.2, https://github.com/micrometer-metrics/micrometer, Apache 2.0
- iotdb-session 0.12.5: https://github.com/apache/iotdb, Apache 2.0
- iotdb-thrift 0.12.5: https://github.com/apache/iotdb, Apache 2.0
- service-rpc 0.12.5: https://github.com/apache/iotdb, Apache 2.0
- tsfile 0.12.5 https://github.com/apache/iotdb Apache 2.0
- libthrift 0.14.1: https://github.com/apache/thrift Apache 2.0
j2objc 1.3: https://github.com/google/j2objc Apache 2.0
evictor 1.0.0: https://github.com/stoyanr/Evictor Apache 2.0
@@ -350,7 +342,6 @@ The text of each license is also included at licenses/LICENSE-[project].txt.
bcprov-ext-jdk15on 1.69: http://www.bouncycastle.org/licence.html , MIT
bcutil-ext-jdk15on 1.69: http://www.bouncycastle.org/licence.html , MIT
checker-qual 2.8.1: https://github.com/typetools/checker-framework, MIT
- influxdb-java 2.15: https://github.com/influxdata/influxdb-java, MIT
========================================================================
MIT licenses
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index d0d5f2629d..aabac94d9f 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -2,6 +2,10 @@
#### Project
+* [**IMPORTANT**] Remove InfluxDB 1.x and Apache IoTDB 0.X as storage options, check details
+ at [here](https://github.com/apache/skywalking/discussions/9059). Remove converter-moshi 2.5.0, influx-java 2.15,
+ iotdb java 0.12.5, thrift 0.14.1, moshi 1.5.0, msgpack 0.8.16 dependencies. Remove InfluxDB and IoTDB relative codes
+ and E2E tests.
* Upgrade OAP dependencies zipkin to 2.23.16, H2 to 2.1.212, Apache Freemarker to 2.3.31, gRPC-java 1.46.0, netty to
4.1.76.
* Upgrade Webapp dependencies, spring-cloud-dependencies to 2021.0.2, logback-classic to 1.2.11
@@ -40,7 +44,8 @@
* E2E: fix log test miss verify LAL and metrics.
* Enhance Converter mechanism in kernel level to make BanyanDB native feature more effective.
* Add TermsAggregation properties collect_mode and execution_hint.
-* Add "execution_hint": "map", "collect_mode": "breadth_first" for aggregation and topology query to improve 5-10x performance.
+* Add "execution_hint": "map", "collect_mode": "breadth_first" for aggregation and topology query to improve 5-10x
+ performance.
* Clean up scroll contexts after used.
* Support autocomplete tags in logs query.
* Enhance Deprecated MetricQuery(v1) getValues querying to asynchronous concurrency query
diff --git a/docs/en/setup/backend/backend-storage.md b/docs/en/setup/backend/backend-storage.md
index abdb00234b..0920b8efc3 100644
--- a/docs/en/setup/backend/backend-storage.md
+++ b/docs/en/setup/backend/backend-storage.md
@@ -13,9 +13,7 @@ Natively supported storage:
- ElasticSearch 6, 7, 8
- MySQL
- TiDB
-- InfluxDB
- PostgreSQL
-- IoTDB
## H2
@@ -239,23 +237,6 @@ All connection-related settings, including URL link, username, and password are
For details on settings, refer to the configuration of *MySQL* above.
To understand the function of the parameter `rewriteBatchedStatements=true` in TiDB, see the document of [TiDB best practices](https://docs.pingcap.com/tidb/stable/java-app-best-practices#use-batch-api).
-## InfluxDB
-InfluxDB storage provides a time-series database as a new storage option.
-
-```yaml
-storage:
- selector: ${SW_STORAGE:influxdb}
- influxdb:
- url: ${SW_STORAGE_INFLUXDB_URL:http://localhost:8086}
- user: ${SW_STORAGE_INFLUXDB_USER:root}
- password: ${SW_STORAGE_INFLUXDB_PASSWORD:}
- database: ${SW_STORAGE_INFLUXDB_DATABASE:skywalking}
- actions: ${SW_STORAGE_INFLUXDB_ACTIONS:1000} # the number of actions to collect
- duration: ${SW_STORAGE_INFLUXDB_DURATION:1000} # the time to wait at most (milliseconds)
- fetchTaskLogMaxSize: ${SW_STORAGE_INFLUXDB_FETCH_TASK_LOG_MAX_SIZE:5000} # the max number of fetch task log in a request
-```
-All connection-related settings, including URL link, username, and password, are found in `application.yml`. For metadata storage provider settings, refer to **H2/MySQL** configurations above.
-
## PostgreSQL
PostgreSQL JDBC driver uses version 42.3.2. It supports PostgreSQL 8.2 or newer.
Activate PostgreSQL as storage, and set storage provider to **postgresql**.
@@ -281,23 +262,6 @@ storage:
All connection-related settings, including URL link, username, and password, are found in `application.yml`.
Only part of the settings is listed here. Please follow [HikariCP](https://github.com/brettwooldridge/HikariCP) connection pool document for full settings.
-## IoTDB
-IoTDB is a time-series database from Apache, which is one of the storage plugin options.
-IoTDB storage plugin is still in progress. Its efficiency will improve in the future.
-
-```yaml
-storage:
- selector: ${SW_STORAGE:iotdb}
- iotdb:
- host: ${SW_STORAGE_IOTDB_HOST:127.0.0.1}
- rpcPort: ${SW_STORAGE_IOTDB_RPC_PORT:6667}
- username: ${SW_STORAGE_IOTDB_USERNAME:root}
- password: ${SW_STORAGE_IOTDB_PASSWORD:root}
- storageGroup: ${SW_STORAGE_IOTDB_STORAGE_GROUP:root.skywalking}
- sessionPoolSize: ${SW_STORAGE_IOTDB_SESSIONPOOL_SIZE:8} # If it's zero, the SessionPool size will be 2*CPU_Cores
- fetchTaskLogMaxSize: ${SW_STORAGE_IOTDB_FETCH_TASK_LOG_MAX_SIZE:1000} # the max number of fetch task log in a request
-```
-All connection-related settings, including host, rpcPort, username, and password, are found in `application.yml`. Please ensure the IoTDB version >= 0.12.3.
## More storage extension solutions
Follow the [Storage extension development guide](../../guides/storage-extention.md)
diff --git a/docs/en/setup/backend/configuration-vocabulary.md b/docs/en/setup/backend/configuration-vocabulary.md
index 70c2d06ac3..9f5b9f6080 100644
--- a/docs/en/setup/backend/configuration-vocabulary.md
+++ b/docs/en/setup/backend/configuration-vocabulary.md
@@ -1,286 +1,268 @@
# Configuration Vocabulary
The Configuration Vocabulary lists all available configurations provided by `application.yml`.
-Module | Provider | Settings | Value(s) and Explanation | System Environment Variable¹ | Default |
------------ | ---------- | --------- | --------- |--------- |-------------------------------------------------------------------------|
-core|default|role|Option values: `Mixed/Receiver/Aggregator`. **Receiver** mode OAP opens the service to the agents, then analyzes and aggregates the results, and forwards the results for distributed aggregation. Aggregator mode OAP receives data from Mixer and Receiver role OAP nodes, and performs 2nd level aggregation. **Mixer** means both Receiver and Aggregator. |SW_CORE_ROLE| Mixed |
-| - | - | restHost| Binding IP of RESTful services. Services include GraphQL query and HTTP data report. |SW_CORE_REST_HOST| 0.0.0.0 |
-| - | - | restPort | Binding port of RESTful services. | SW_CORE_REST_PORT| 12800 |
-| - | - | restContextPath| Web context path of RESTful services. | SW_CORE_REST_CONTEXT_PATH| / |
-| - | - | restMaxThreads| Maximum thread number of RESTful services. | SW_CORE_REST_REST_MAX_THREADS| 200 |
-| - | - | restIdleTimeOut| Connector idle timeout of RESTful services (in milliseconds). | SW_CORE_REST_IDLE_TIMEOUT| 30000 |
-| - | - | restAcceptQueueSize| ServerSocketChannel Backlog of RESTful services. | SW_CORE_REST_QUEUE_SIZE| 0 |
-| - | - | httpMaxRequestHeaderSize| Maximum request header size accepted. | SW_CORE_HTTP_MAX_REQUEST_HEADER_SIZE| 8192 |
-| - | - | gRPCHost| Binding IP of gRPC services, including gRPC data report and internal communication among OAP nodes. |SW_CORE_GRPC_HOST| 0.0.0.0 |
-| - | - | gRPCPort| Binding port of gRPC services. | SW_CORE_GRPC_PORT| 11800 |
-| - | - | gRPCSslEnabled| Activates SSL for gRPC services. | SW_CORE_GRPC_SSL_ENABLED| false |
-| - | - | gRPCSslKeyPath| File path of gRPC SSL key. | SW_CORE_GRPC_SSL_KEY_PATH| - |
-| - | - | gRPCSslCertChainPath| File path of gRPC SSL cert chain. | SW_CORE_GRPC_SSL_CERT_CHAIN_PATH| - |
-| - | - | gRPCSslTrustedCAPath| File path of gRPC trusted CA. | SW_CORE_GRPC_SSL_TRUSTED_CA_PATH| - |
-| - | - | downsampling| Activated level of down sampling aggregation. | | Hour,Day |
-| - | - | persistentPeriod| Execution period of the persistent timer (in seconds). | | 25 |
-| - | - | enableDataKeeperExecutor| Controller of TTL scheduler. Once disabled, TTL wouldn't work. |SW_CORE_ENABLE_DATA_KEEPER_EXECUTOR| true |
-| - | - | dataKeeperExecutePeriod| Execution period of TTL scheduler (in minutes). Execution doesn't mean deleting data. The storage provider (e.g. ElasticSearch storage) could override this.|SW_CORE_DATA_KEEPER_EXECUTE_PERIOD| 5 |
-| - | - | recordDataTTL| The lifecycle of record data (in days). Record data includes traces, top N sample records, and logs. Minimum value is 2. |SW_CORE_RECORD_DATA_TTL| 3 |
-| - | - | metricsDataTTL| The lifecycle of metrics data (in days), including metadata. We recommend setting metricsDataTTL >= recordDataTTL. Minimum value is 2. | SW_CORE_METRICS_DATA_TTL| 7 |
-| - | - | l1FlushPeriod| The period of L1 aggregation flush to L2 aggregation (in milliseconds). | SW_CORE_L1_AGGREGATION_FLUSH_PERIOD | 500 |
-| - | - | storageSessionTimeout| The threshold of session time (in milliseconds). Default value is 70000. | SW_CORE_STORAGE_SESSION_TIMEOUT | 70000 |
-| - | - | persistentPeriod| The period of doing data persistence. Unit is second.Default value is 25s | SW_CORE_PERSISTENT_PERIOD | 25 |
-| - | - | enableDatabaseSession| Cache metrics data for 1 minute to reduce database queries, and if the OAP cluster changes within that minute. |SW_CORE_ENABLE_DATABASE_SESSION| true |
-| - | - | topNReportPeriod|The execution period (in minutes) of top N sampler, which saves sampled data into the storage. |SW_CORE_TOPN_REPORT_PERIOD| 10 |
-| - | - | activeExtraModelColumns|Appends entity names (e.g. service names) into metrics storage entities. |SW_CORE_ACTIVE_EXTRA_MODEL_COLUMNS| false |
-| - | - | serviceNameMaxLength| Maximum length limit of service names. |SW_SERVICE_NAME_MAX_LENGTH| 70 |
-| - | - | instanceNameMaxLength| Maximum length limit of service instance names. The maximum length of service + instance names should be less than 200.|SW_INSTANCE_NAME_MAX_LENGTH| 70 |
-| - | - | endpointNameMaxLength| Maximum length limit of endpoint names. The maximum length of service + endpoint names should be less than 240.|SW_ENDPOINT_NAME_MAX_LENGTH| 150 |
-| - | - | searchableTracesTags | Defines a set of span tag keys which are searchable through GraphQL. Multiple values are separated by commas. | SW_SEARCHABLE_TAG_KEYS | http.method,status_code,db.type,db.instance,mq.queue,mq.topic,mq.broker |
-| - | - | searchableLogsTags | Defines a set of log tag keys which are searchable through GraphQL. Multiple values are separated by commas. | SW_SEARCHABLE_LOGS_TAG_KEYS | level |
-| - | - | searchableAlarmTags | Defines a set of alarm tag keys which are searchable through GraphQL. Multiple values are separated by commas. | SW_SEARCHABLE_ALARM_TAG_KEYS | level |
-| - | - | gRPCThreadPoolSize| Pool size of gRPC server. | SW_CORE_GRPC_THREAD_POOL_SIZE | CPU core * 4 |
-| - | - | gRPCThreadPoolQueueSize| Queue size of gRPC server. | SW_CORE_GRPC_POOL_QUEUE_SIZE | 10000 |
-| - | - | maxConcurrentCallsPerConnection | The maximum number of concurrent calls permitted for each incoming connection. Defaults to no limit. | SW_CORE_GRPC_MAX_CONCURRENT_CALL | - |
-| - | - | maxMessageSize | Sets the maximum message size allowed to be received on the server. Empty means 4 MiB. | SW_CORE_GRPC_MAX_MESSAGE_SIZE | 4M(based on Netty) |
-| - | - | remoteTimeout | Timeout for cluster internal communication (in seconds). | - | 20 |
-| - | - | maxSizeOfNetworkAddressAlias| The maximum size of network address detected in the system being monitored. | - | 1_000_000 |
-| - | - | maxPageSizeOfQueryProfileSnapshot| The maximum size for snapshot analysis in an OAP query. | - | 500 |
-| - | - | maxSizeOfAnalyzeProfileSnapshot| The maximum number of snapshots analyzed by the OAP. | - | 12000 |
-| - | - | prepareThreads| The number of threads used to prepare metrics data to the storage. | SW_CORE_PREPARE_THREADS | 2 |
-| - | - | enableEndpointNameGroupingByOpenapi | Automatically groups endpoints by the given OpenAPI definitions. | SW_CORE_ENABLE_ENDPOINT_NAME_GROUPING_BY_OPAENAPI | true |
-| - | - | maxDurationOfQueryEBPFProfilingData| The maximum duration(in second) of query the eBPF profiling data from database. | - | 30 |
-| - | - | maxThreadCountOfQueryEBPFProfilingData| The maximum thread count of query the eBPF profiling data from database. | - | System CPU core size |
-|cluster|standalone| - | Standalone is not suitable for running on a single node running. No configuration available. | - | - |
-| - | zookeeper|namespace| The namespace, represented by root path, isolates the configurations in Zookeeper.|SW_NAMESPACE| `/`, root path |
-| - | - | hostPort| Hosts and ports of Zookeeper Cluster. |SW_CLUSTER_ZK_HOST_PORT| localhost:2181 |
-| - | - | baseSleepTimeMs| The period of Zookeeper client between two retries (in milliseconds). |SW_CLUSTER_ZK_SLEEP_TIME| 1000 |
-| - | - | maxRetries| The maximum retry time. |SW_CLUSTER_ZK_MAX_RETRIES| 3 |
-| - | - | enableACL| Opens ACL using `schema` and `expression`. |SW_ZK_ENABLE_ACL| false |
-| - | - | schema | Schema for the authorization. |SW_ZK_SCHEMA| digest |
-| - | - | expression | Expression for the authorization. |SW_ZK_EXPRESSION| skywalking:skywalking |
-| - | - | internalComHost| The hostname registered in Zookeeper for the internal communication of OAP cluster. | SW_CLUSTER_INTERNAL_COM_HOST | - |
-| - | - | internalComPort| The port registered in Zookeeper for the internal communication of OAP cluster. | SW_CLUSTER_INTERNAL_COM_PORT | -1 |
-| - | kubernetes| namespace| Namespace deployed by SkyWalking in k8s. |SW_CLUSTER_K8S_NAMESPACE| default |
-| - | - | labelSelector| Labels used for filtering OAP deployment in k8s. |SW_CLUSTER_K8S_LABEL| app=collector,release=skywalking |
-| - | - | uidEnvName| Environment variable name for reading uid. | SW_CLUSTER_K8S_UID| SKYWALKING_COLLECTOR_UID |
-| - | consul| serviceName| Service name for SkyWalking cluster. |SW_SERVICE_NAME| SkyWalking_OAP_Cluster |
-| - | - | hostPort| Hosts and ports for Consul cluster.| SW_CLUSTER_CONSUL_HOST_PORT| localhost:8500 |
-| - | - | aclToken| ACL Token of Consul. Empty string means `without ALC token`. | SW_CLUSTER_CONSUL_ACLTOKEN | - |
-| - | - | internalComHost| The hostname registered in Consul for internal communications of the OAP cluster. | SW_CLUSTER_INTERNAL_COM_HOST | - |
-| - | - | internalComPort| The port registered in Consul for internal communications of the OAP cluster. | SW_CLUSTER_INTERNAL_COM_PORT | -1 |
-| - | etcd| serviceName| Service name for SkyWalking cluster. |SW_CLUSTER_ETCD_SERVICE_NAME| SkyWalking_OAP_Cluster |
-| - | - | endpoints| Hosts and ports for etcd cluster. | SW_CLUSTER_ETCD_ENDPOINTS| localhost:2379 |
-| - | - | namespace | Namespace for SkyWalking cluster. |SW_CLUSTER_ETCD_NAMESPACE | /skywalking |
-| - | - | authentication | Indicates whether there is authentication. | SW_CLUSTER_ETCD_AUTHENTICATION | false |
-| - | - | user | Etcd auth username. | SW_CLUSTER_ETCD_USER | |
-| - | - | password | Etcd auth password. | SW_CLUSTER_ETCD_PASSWORD | |
-| - | - | internalComHost| The hostname registered in etcd for internal communications of the OAP cluster. | SW_CLUSTER_INTERNAL_COM_HOST | - |
-| - | - | internalComPort| The port registered in etcd for internal communications of the OAP cluster. | SW_CLUSTER_INTERNAL_COM_PORT | -1 |
-| - | Nacos| serviceName| Service name for SkyWalking cluster. |SW_SERVICE_NAME| SkyWalking_OAP_Cluster |
-| - | - | hostPort| Hosts and ports for Nacos cluster.| SW_CLUSTER_NACOS_HOST_PORT| localhost:8848 |
-| - | - | namespace| Namespace used by SkyWalking node coordination. | SW_CLUSTER_NACOS_NAMESPACE| public |
-| - | - | internalComHost| The hostname registered in Nacos for internal communications of the OAP cluster. | SW_CLUSTER_INTERNAL_COM_HOST | - |
-| - | - | internalComPort| The port registered in Nacos for internal communications of the OAP cluster. | SW_CLUSTER_INTERNAL_COM_PORT | -1 |
-| - | - | username | Nacos Auth username. | SW_CLUSTER_NACOS_USERNAME | - |
-| - | - | password | Nacos Auth password. | SW_CLUSTER_NACOS_PASSWORD | - |
-| - | - | accessKey | Nacos Auth accessKey. | SW_CLUSTER_NACOS_ACCESSKEY | - |
-| - | - | secretKey | Nacos Auth secretKey. | SW_CLUSTER_NACOS_SECRETKEY | - |
-| storage|elasticsearch| - | ElasticSearch (and OpenSearch) storage implementation. | - | - |
-| - | - | namespace | Prefix of indexes created and used by SkyWalking. | SW_NAMESPACE | - |
-| - | - | clusterNodes | ElasticSearch cluster nodes for client connection.| SW_STORAGE_ES_CLUSTER_NODES | localhost |
-| - | - | protocol | HTTP or HTTPs. | SW_STORAGE_ES_HTTP_PROTOCOL | HTTP |
-| - | - | connectTimeout | Connect timeout of ElasticSearch client (in milliseconds). | SW_STORAGE_ES_CONNECT_TIMEOUT | 3000 |
-| - | - | socketTimeout | Socket timeout of ElasticSearch client (in milliseconds). | SW_STORAGE_ES_SOCKET_TIMEOUT | 30000 |
-| - | - | responseTimeout | Response timeout of ElasticSearch client (in milliseconds), `0` disables the timeout. | SW_STORAGE_ES_RESPONSE_TIMEOUT | 1500 |
-| - | - | numHttpClientThread | The number of threads for the underlying HTTP client to perform socket I/O. If the value is <= 0, the number of available processors will be used. | SW_STORAGE_ES_NUM_HTTP_CLIENT_THREAD | 0 |
-| - | - | user| Username of ElasticSearch cluster. | SW_ES_USER | - |
-| - | - | password | Password of ElasticSearch cluster. | SW_ES_PASSWORD | - |
-| - | - | trustStorePath | Trust JKS file path. Only works when username and password are enabled. | SW_STORAGE_ES_SSL_JKS_PATH | - |
-| - | - | trustStorePass | Trust JKS file password. Only works when username and password are enabled. | SW_STORAGE_ES_SSL_JKS_PASS | - |
-| - | - | secretsManagementFile| Secrets management file in the properties format, including username and password, which are managed by a 3rd party tool. Capable of being updated them at runtime. |SW_ES_SECRETS_MANAGEMENT_FILE | - |
-| - | - | dayStep| Represents the number of days in the one-minute/hour/day index. | SW_STORAGE_DAY_STEP | 1 |
-| - | - | indexShardsNumber | Shard number of new indexes. | SW_STORAGE_ES_INDEX_SHARDS_NUMBER | 1 |
-| - | - | indexReplicasNumber | Replicas number of new indexes. | SW_STORAGE_ES_INDEX_REPLICAS_NUMBER | 0 |
-| - | - | superDatasetDayStep | Represents the number of days in the super size dataset record index. Default value is the same as dayStep when the value is less than 0. |SW_SUPERDATASET_STORAGE_DAY_STEP| -1 |
-| - | - | superDatasetIndexShardsFactor | Super dataset is defined in the code (e.g. trace segments). This factor provides more shards for the super dataset: shards number = indexShardsNumber * superDatasetIndexShardsFactor. This factor also affects Zipkin and Jaeger traces. |SW_STORAGE_ES_SUPER_DATASET_INDEX_SHARDS_FACTOR| 5 |
-| - | - | superDatasetIndexReplicasNumber | Represents the replicas number in the super size dataset record index. |SW_STORAGE_ES_SUPER_DATASET_INDEX_REPLICAS_NUMBER| 0 |
-| - | - | indexTemplateOrder| The order of index template. | SW_STORAGE_ES_INDEX_TEMPLATE_ORDER| 0 |
-| - | - | bulkActions| Async bulk size of the record data batch execution. | SW_STORAGE_ES_BULK_ACTIONS| 5000 |
-| - | - | flushInterval| Period of flush (in seconds). Does not matter whether `bulkActions` is reached or not. INT(flushInterval * 2/3) is used for index refresh period. | SW_STORAGE_ES_FLUSH_INTERVAL | 15 (index refresh period = 10) |
-| - | - | concurrentRequests| The number of concurrent requests allowed to be executed. | SW_STORAGE_ES_CONCURRENT_REQUESTS| 2 |
-| - | - | resultWindowMaxSize | The maximum size of dataset when the OAP loads cache, such as network aliases. | SW_STORAGE_ES_QUERY_MAX_WINDOW_SIZE | 10000 |
-| - | - | metadataQueryMaxSize | The maximum size of metadata per query. | SW_STORAGE_ES_QUERY_MAX_SIZE | 10000 |
-| - | - | scrollingBatchSize | The batch size of metadata per iteration when `metadataQueryMaxSize` or `resultWindowMaxSize` is too large to be retrieved in a single query. | SW_STORAGE_ES_SCROLLING_BATCH_SIZE | 5000 |
-| - | - | segmentQueryMaxSize | The maximum size of trace segments per query. | SW_STORAGE_ES_QUERY_SEGMENT_SIZE | 200 |
-| - | - | profileTaskQueryMaxSize | The maximum size of profile task per query. | SW_STORAGE_ES_QUERY_PROFILE_TASK_SIZE | 200 |
-| - | - | advanced | All settings of ElasticSearch index creation. The value should be in JSON format. | SW_STORAGE_ES_ADVANCED | - |
-| - |h2| - | H2 storage is designed for demonstration and running in short term (i.e. 1-2 hours) only. | - | - |
-| - | - | driver | H2 JDBC driver. | SW_STORAGE_H2_DRIVER | org.h2.jdbcx.JdbcDataSource |
-| - | - | url | H2 connection URL. Defaults to H2 memory mode. | SW_STORAGE_H2_URL | jdbc:h2:mem:skywalking-oap-db |
-| - | - | user | Username of H2 database. | SW_STORAGE_H2_USER | sa |
-| - | - | password | Password of H2 database. | - | - |
-| - | - | metadataQueryMaxSize | The maximum size of metadata per query. | SW_STORAGE_H2_QUERY_MAX_SIZE | 5000 |
-| - | - | maxSizeOfArrayColumn | Some entities (e.g. trace segments) include the logic column with multiple values. In H2, we use multiple physical columns to host the values: e.g. change column_a with values [1,2,3,4,5] to `column_a_0 = 1, column_a_1 = 2, column_a_2 = 3 , column_a_3 = 4, column_a_4 = 5`. | SW_STORAGE_MAX_SIZE_OF_ARRAY_COLUMN | 20 |
-| - | - | numOfSearchableValuesPerTag | In a trace segment, this includes multiple spans with multiple tags. Different spans may have the same tag key, e.g. multiple HTTP exit spans all have their own `http.method` tags. This configuration sets the limit on the maximum number of values for the same tag key. | SW_STORAGE_NUM_OF_SEARCHABLE_VALUES_PER_TAG | 2 |
-| - | - | maxSizeOfBatchSql | The maximum size of batch size of SQL execution | SW_STORAGE_MAX_SIZE_OF_BATCH_SQL | 100 |
-| - | - | asyncBatchPersistentPoolSize | async flush data into database thread size | SW_STORAGE_ASYNC_BATCH_PERSISTENT_POOL_SIZE | 1 |
-| - |mysql| - | MySQL Storage. The MySQL JDBC Driver is not in the dist. Please copy it into the oap-lib folder manually. | - | - |
-| - | - | properties | Hikari connection pool configurations. | - | Listed in the `application.yaml`. |
-| - | - | metadataQueryMaxSize | The maximum size of metadata per query. | SW_STORAGE_MYSQL_QUERY_MAX_SIZE | 5000 |
-| - | - | maxSizeOfArrayColumn | Some entities (e.g. trace segments) include the logic column with multiple values. In MySQL, we use multiple physical columns to host the values, e.g. change column_a with values [1,2,3,4,5] to `column_a_0 = 1, column_a_1 = 2, column_a_2 = 3 , column_a_3 = 4, column_a_4 = 5`. | SW_STORAGE_MAX_SIZE_OF_ARRAY_COLUMN | 20 |
-| - | - | numOfSearchableValuesPerTag | In a trace segment, this includes multiple spans with multiple tags. Different spans may have same tag key, e.g. multiple HTTP exit spans all have their own `http.method` tags. This configuration sets the limit on the maximum number of values for the same tag key. | SW_STORAGE_NUM_OF_SEARCHABLE_VALUES_PER_TAG | 2 |
-| - | - | maxSizeOfBatchSql | The maximum size of batch size of SQL execution | SW_STORAGE_MAX_SIZE_OF_BATCH_SQL | 2000 |
-| - | - | asyncBatchPersistentPoolSize | async flush data into database thread size | SW_STORAGE_ASYNC_BATCH_PERSISTENT_POOL_SIZE | 4 |
-| - |postgresql| - | PostgreSQL storage. | - | - |
-| - | - | properties | Hikari connection pool configurations. | - | Listed in the `application.yaml`. |
-| - | - | metadataQueryMaxSize | The maximum size of metadata per query. | SW_STORAGE_MYSQL_QUERY_MAX_SIZE | 5000 |
-| - | - | maxSizeOfArrayColumn | Some entities (e.g. trace segments) include the logic column with multiple values. In PostgreSQL, we use multiple physical columns to host the values, e.g. change column_a with values [1,2,3,4,5] to `column_a_0 = 1, column_a_1 = 2, column_a_2 = 3 , column_a_3 = 4, column_a_4 = 5` | SW_STORAGE_MAX_SIZE_OF_ARRAY_COLUMN | 20 |
-| - | - | numOfSearchableValuesPerTag | In a trace segment, this includes multiple spans with multiple tags. Different spans may have same tag key, e.g. multiple HTTP exit spans all have their own `http.method` tags. This configuration sets the limit on the maximum number of values for the same tag key. | SW_STORAGE_NUM_OF_SEARCHABLE_VALUES_PER_TAG | 2 |
-| - | - | maxSizeOfBatchSql | The maximum size of batch size of SQL execution | SW_STORAGE_MAX_SIZE_OF_BATCH_SQL | 2000 |
-| - | - | asyncBatchPersistentPoolSize | async flush data into database thread size | SW_STORAGE_ASYNC_BATCH_PERSISTENT_POOL_SIZE | 4 |
-| - |influxdb| - | InfluxDB storage. |- | - |
-| - | - | url| InfluxDB connection URL. | SW_STORAGE_INFLUXDB_URL | http://localhost:8086 |
-| - | - | user | User name of InfluxDB. | SW_STORAGE_INFLUXDB_USER | root |
-| - | - | password | Password of InfluxDB. | SW_STORAGE_INFLUXDB_PASSWORD | - |
-| - | - | database | Database of InfluxDB. | SW_STORAGE_INFLUXDB_DATABASE | skywalking |
-| - | - | actions | The number of actions to collect. | SW_STORAGE_INFLUXDB_ACTIONS | 1000 |
-| - | - | duration | The maximum waiting time (in milliseconds). | SW_STORAGE_INFLUXDB_DURATION | 1000 |
-| - | - | batchEnabled | If true, write points with batch API. | SW_STORAGE_INFLUXDB_BATCH_ENABLED | true |
-| - | - | fetchTaskLogMaxSize | The maximum number of fetch task log in a request. | SW_STORAGE_INFLUXDB_FETCH_TASK_LOG_MAX_SIZE | 5000 |
-| - | - | connectionResponseFormat | The response format of connection to influxDB. It can only be MSGPACK or JSON. | SW_STORAGE_INFLUXDB_CONNECTION_RESPONSE_FORMAT | MSGPACK |
-| - | iotdb | - | IoTDB storage. | - | - |
-| - | - | host | The host of IoTDB server. | SW_STORAGE_IOTDB_HOST | 127.0.0.1 |
-| - | - | rpcPort | The port listened by IoTDB server. | SW_STORAGE_IOTDB_RPC_PORT | 6667 |
-| - | - | username | The username of IoTDB | SW_STORAGE_IOTDB_USERNAME | root |
-| - | - | password | The password of IoTDB | SW_STORAGE_IOTDB_PASSWORD | root |
-| - | - | storageGroup | The path of Storage Group and it must start with `root.` | SW_STORAGE_IOTDB_STORAGE_GROUP | root.skywalking |
-| - | - | sessionPoolSize | The connection pool size for IoTDB. If the value is 0, the size of SessionPool will be 2 * CPU_Cores | SW_STORAGE_IOTDB_SESSIONPOOL_SIZE | 8 |
-| - | - | fetchTaskLogMaxSize | the max number of fetch task log in a request | SW_STORAGE_IOTDB_FETCH_TASK_LOG_MAX_SIZE | 1000 |
-| agent-analyzer | default | Agent Analyzer. | SW_AGENT_ANALYZER | default |
-| - | - | traceSamplingPolicySettingsFile | The sampling policy including `sampling rate` and `the threshold of trace segment latency` can be configured by the `traceSamplingPolicySettingsFile` file. | SW_TRACE_SAMPLING_POLICY_SETTINGS_FILE | `trace-sampling-policy-settings.yml` |
-| - | - |slowDBAccessThreshold| The slow database access threshold (in milliseconds). |SW_SLOW_DB_THRESHOLD| default:200,mongodb:100 |
-| - | - |forceSampleErrorSegment| When sampling mechanism is activated, this config samples the error status segment and ignores the sampling rate. |SW_FORCE_SAMPLE_ERROR_SEGMENT| true |
-| - | - |segmentStatusAnalysisStrategy| Determines the final segment status from span status. Available values are `FROM_SPAN_STATUS` , `FROM_ENTRY_SPAN`, and `FROM_FIRST_SPAN`. `FROM_SPAN_STATUS` indicates that the segment status would be error if any span has an error status. `FROM_ENTRY_SPAN` means that the segment status would only be determined by the status of entry spans. `FROM_FIRST_SPAN` means that the segment status would only be determined by the status of the first span. |SW_ [...]
-| - | - |noUpstreamRealAddressAgents| Exit spans with the component in the list would not generate client-side instance relation metrics, since some tracing plugins (e.g. Nginx-LUA and Envoy) can't collect the real peer IP address. |SW_NO_UPSTREAM_REAL_ADDRESS| 6000,9000 |
-| - | - |meterAnalyzerActiveFiles| Indicates which files could be instrumented and analyzed. Multiple files are split by ",". |SW_METER_ANALYZER_ACTIVE_FILES||
-| receiver-sharing-server|default| Sharing server provides new gRPC and restful servers for data collection. Ana designates that servers in the core module are to be used for internal communication only. | - | - |
-| - | - | restHost| Binding IP of RESTful services. Services include GraphQL query and HTTP data report. | SW_RECEIVER_SHARING_REST_HOST | - |
-| - | - | restPort | Binding port of RESTful services. | SW_RECEIVER_SHARING_REST_PORT | - |
-| - | - | restContextPath| Web context path of RESTful services. | SW_RECEIVER_SHARING_REST_CONTEXT_PATH | - |
-| - | - | restMaxThreads| Maximum thread number of RESTful services. | SW_RECEIVER_SHARING_REST_MAX_THREADS| 200 |
-| - | - | restIdleTimeOut| Connector idle timeout of RESTful services (in milliseconds). | SW_RECEIVER_SHARING_REST_IDLE_TIMEOUT| 30000 |
-| - | - | restAcceptQueueSize| ServerSocketChannel backlog of RESTful services. | SW_RECEIVER_SHARING_REST_QUEUE_SIZE| 0 |
-| - | - | httpMaxRequestHeaderSize| Maximum request header size accepted. | SW_RECEIVER_SHARING_HTTP_MAX_REQUEST_HEADER_SIZE| 8192 |
-| - | - | gRPCHost| Binding IP of gRPC services. Services include gRPC data report and internal communication among OAP nodes. | SW_RECEIVER_GRPC_HOST | 0.0.0.0. Not Activated |
-| - | - | gRPCPort| Binding port of gRPC services. | SW_RECEIVER_GRPC_PORT | Not Activated |
-| - | - | gRPCThreadPoolSize| Pool size of gRPC server. | SW_RECEIVER_GRPC_THREAD_POOL_SIZE | CPU core * 4 |
-| - | - | gRPCThreadPoolQueueSize| Queue size of gRPC server. | SW_RECEIVER_GRPC_POOL_QUEUE_SIZE | 10000 |
-| - | - | gRPCSslEnabled| Activates SSL for gRPC services. | SW_RECEIVER_GRPC_SSL_ENABLED | false |
-| - | - | gRPCSslKeyPath| File path of gRPC SSL key. | SW_RECEIVER_GRPC_SSL_KEY_PATH | - |
-| - | - | gRPCSslCertChainPath| File path of gRPC SSL cert chain. | SW_RECEIVER_GRPC_SSL_CERT_CHAIN_PATH | - |
-| - | - | maxConcurrentCallsPerConnection | The maximum number of concurrent calls permitted for each incoming connection. Defaults to no limit. | SW_RECEIVER_GRPC_MAX_CONCURRENT_CALL | - |
-| - | - | authentication | The token text for authentication. Works for gRPC connection only. Once this is set, the client is required to use the same token. | SW_AUTHENTICATION | - |
-| log-analyzer | default | Log Analyzer. | SW_LOG_ANALYZER | default |
-| - | - | lalFiles | The LAL configuration file names (without file extension) to be activated. Read [LAL](../../concepts-and-designs/lal.md) for more details. | SW_LOG_LAL_FILES | default |
-| - | - | malFiles | The MAL configuration file names (without file extension) to be activated. Read [LAL](../../concepts-and-designs/lal.md) for more details. | SW_LOG_MAL_FILES | "" |
-| event-analyzer | default | Event Analyzer. | SW_EVENT_ANALYZER | default |
-| receiver-register|default| gRPC and HTTPRestful services that provide service, service instance and endpoint register. | - | - |
-| receiver-trace|default| gRPC and HTTPRestful services that accept SkyWalking format traces. | - | - |
-| receiver-jvm| default| gRPC services that accept JVM metrics data. | - | - |
-| receiver-clr| default|gRPC services that accept .Net CLR metrics data. | - | - |
-| receiver-profile| default| gRPC services that accept profile task status and snapshot reporter. | - | - |
-| receiver-zabbix| default| TCP receiver accepts Zabbix format metrics. | - | - |
-| - | - | port| Exported TCP port. Zabbix agent could connect and transport data. | SW_RECEIVER_ZABBIX_PORT | 10051 |
-| - | - | host| Binds to host. | SW_RECEIVER_ZABBIX_HOST | 0.0.0.0 |
-| - | - | activeFiles| Enables config when agent request is received. | SW_RECEIVER_ZABBIX_ACTIVE_FILES | agent |
-| service-mesh| default| gRPC services that accept data from inbound mesh probes. | - | - |
-| envoy-metric| default| Envoy `metrics_service` and `ALS(access log service)` are supported by this receiver. The OAL script supports all GAUGE type metrics. | - | - |
-| - | - | acceptMetricsService | Starts Envoy Metrics Service analysis. | SW_ENVOY_METRIC_SERVICE | true |
-| - | - | alsHTTPAnalysis | Starts Envoy HTTP Access Log Service analysis. Value = `k8s-mesh` means starting the analysis. | SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS | - |
-| - | - | alsTCPAnalysis | Starts Envoy TCP Access Log Service analysis. Value = `k8s-mesh` means starting the analysis. | SW_ENVOY_METRIC_ALS_TCP_ANALYSIS | - |
-| - | - | k8sServiceNameRule | `k8sServiceNameRule` allows you to customize the service name in ALS via Kubernetes metadata. The available variables are `pod` and `service`. E.g. you can use `${service.metadata.name}-${pod.metadata.labels.version}` to append the version number to the service name. Note that when using environment variables to pass this configuration, use single quotes(`''`) to avoid being evaluated by the shell. | - |
-| receiver-otel | default | A receiver for analyzing metrics data from OpenTelemetry. | - | - |
-| - | - | enabledHandlers| Enabled handlers for otel. | SW_OTEL_RECEIVER_ENABLED_HANDLERS | - |
-| - | - | enabledOcRules| Enabled metric rules for OC handler. | SW_OTEL_RECEIVER_ENABLED_OC_RULES | - |
- receiver-zipkin |default| A receiver for Zipkin traces. | - | - |
-| - | - | restHost| Binding IP of RESTful services. |SW_RECEIVER_ZIPKIN_REST_HOST| 0.0.0.0 |
-| - | - | restPort | Binding port of RESTful services. | SW_RECEIVER_ZIPKIN_REST_PORT| 9411 |
-| - | - | restContextPath| Web context path of RESTful services. | SW_RECEIVER_ZIPKIN_REST_CONTEXT_PATH| / |
-| - | - | restMaxThreads| Maximum thread number of RESTful services. | SW_RECEIVER_ZIPKIN_REST_MAX_THREADS| 200 |
-| - | - | restIdleTimeOut| Connector idle timeout of RESTful services (in milliseconds). | SW_RECEIVER_ZIPKIN_REST_IDLE_TIMEOUT| 30000 | |
-| - | - | restAcceptQueueSize| Maximum request header size accepted. | SW_RECEIVER_ZIPKIN_REST_QUEUE_SIZE| 0 |
-| - | - | instanceNameRule| Get the instance name from these tags. | SW_RECEIVER_ZIPKIN_INSTANCE_NAME_RULE| [spring.instance_id,node_id] |
-| - | - | searchableTracesTags| Defines a set of span tag keys which are searchable. Multiple values are separated by commas. | SW_ZIPKIN_SEARCHABLE_TAG_KEYS| http.method |
-| prometheus-fetcher | default | Prometheus fetcher reads metrics from Prometheus endpoint, and transfer the metrics into SkyWalking native format for the MAL engine. | - | - |
-| - | - | enabledRules | Enabled rules. | SW_PROMETHEUS_FETCHER_ENABLED_RULES | self |
-| - | - | maxConvertWorker | The maximize meter convert worker. | SW_PROMETHEUS_FETCHER_NUM_CONVERT_WORKER | -1(by default, half the number of CPU core(s)) |
-| kafka-fetcher | default | Read SkyWalking's native metrics/logs/traces through Kafka server. | - | - |
-| - | - | bootstrapServers | A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. | SW_KAFKA_FETCHER_SERVERS | localhost:9092 |
-| - | - | namespace | Namespace aims to isolate multi OAP cluster when using the same Kafka cluster. If you set a namespace for Kafka fetcher, OAP will add a prefix to topic name. You should also set namespace in `agent.config`. The property is named `plugin.kafka.namespace`. | SW_NAMESPACE | - |
-| - | - | groupId | A unique string that identifies the consumer group to which this consumer belongs.| - | skywalking-consumer |
-| - | - | createTopicIfNotExist | If true, this creates Kafka topic (if it does not already exist). | - | true |
-| - | - | partitions | The number of partitions for the topic being created. | SW_KAFKA_FETCHER_PARTITIONS | 3 |
-| - | - | consumers | The number of consumers to create. | SW_KAFKA_FETCHER_CONSUMERS | 1 |
-| - | - | enableNativeProtoLog | Enables fetching and handling native proto log data. | SW_KAFKA_FETCHER_ENABLE_NATIVE_PROTO_LOG | true |
-| - | - | enableNativeJsonLog | Enables fetching and handling native json log data. | SW_KAFKA_FETCHER_ENABLE_NATIVE_JSON_LOG | true |
-| - | - | replicationFactor | The replication factor for each partition in the topic being created. | SW_KAFKA_FETCHER_PARTITIONS_FACTOR | 2 |
-| - | - | kafkaHandlerThreadPoolSize | Pool size of Kafka message handler executor. | SW_KAFKA_HANDLER_THREAD_POOL_SIZE | CPU core * 2 |
-| - | - | kafkaHandlerThreadPoolQueueSize | Queue size of Kafka message handler executor. | SW_KAFKA_HANDLER_THREAD_POOL_QUEUE_SIZE | 10000 |
-| - | - | topicNameOfMeters | Kafka topic name for meter system data. | - | skywalking-meters |
-| - | - | topicNameOfMetrics | Kafka topic name for JVM metrics data. | - | skywalking-metrics |
-| - | - | topicNameOfProfiling | Kafka topic name for profiling data. | - | skywalking-profilings |
-| - | - | topicNameOfTracingSegments | Kafka topic name for tracing data. | - | skywalking-segments |
-| - | - | topicNameOfManagements | Kafka topic name for service instance reporting and registration. | - | skywalking-managements |
-| - | - | topicNameOfLogs | Kafka topic name for native proto log data. | - | skywalking-logs |
-| - | - | topicNameOfJsonLogs | Kafka topic name for native json log data. | - | skywalking-logs-json |
-| receiver-browser | default | gRPC services that accept browser performance data and error log. | - | - | - |
-| - | - | sampleRate | Sampling rate for receiving trace. Precise to 1/10000. 10000 means sampling rate of 100% by default. | SW_RECEIVER_BROWSER_SAMPLE_RATE | 10000 |
-| query | graphql | - | GraphQL query implementation. | - |
-| - | - | enableLogTestTool | Enable the log testing API to test the LAL. **NOTE**: This API evaluates untrusted code on the OAP server. A malicious script can do significant damage (steal keys and secrets, remove files and directories, install malware, etc). As such, please enable this API only when you completely trust your users. | SW_QUERY_GRAPHQL_ENABLE_LOG_TEST_TOOL | false |
-| - | - | maxQueryComplexity | Maximum complexity allowed for the GraphQL query that can be used to abort a query if the total number of data fields queried exceeds the defined threshold. | SW_QUERY_MAX_QUERY_COMPLEXITY | 1000 |
-| - | - | enableUpdateUITemplate | Allow user add,disable and update UI template. | SW_ENABLE_UPDATE_UI_TEMPLATE | false |
-| alarm | default | - | Read [alarm doc](backend-alarm.md) for more details. | - |
-| telemetry | - | - | Read [telemetry doc](backend-telemetry.md) for more details. | - |
-| - | none| - | No op implementation. | - |
-| - | prometheus| host | Binding host for Prometheus server fetching data. | SW_TELEMETRY_PROMETHEUS_HOST| 0.0.0.0 |
-| - | - | port| Binding port for Prometheus server fetching data. |SW_TELEMETRY_PROMETHEUS_PORT| 1234 |
-| configuration | - | - | Read [dynamic configuration doc](dynamic-config.md) for more details. | - |
-| - | grpc| host | DCS server binding hostname. | SW_DCS_SERVER_HOST | - |
-| - | - | port | DCS server binding port. | SW_DCS_SERVER_PORT | 80 |
-| - | - | clusterName | Cluster name when reading the latest configuration from DSC server. | SW_DCS_CLUSTER_NAME | SkyWalking |
-| - | - | period | The period of reading data from DSC server by the OAP (in seconds). | SW_DCS_PERIOD | 20 |
-| - | apollo| apolloMeta| `apollo.meta` in Apollo. | SW_CONFIG_APOLLO | http://localhost:8080 |
-| - | - | apolloCluster | `apollo.cluster` in Apollo. | SW_CONFIG_APOLLO_CLUSTER | default |
-| - | - | apolloEnv | `env` in Apollo. | SW_CONFIG_APOLLO_ENV | - |
-| - | - | appId | `app.id` in Apollo. | SW_CONFIG_APOLLO_APP_ID | skywalking |
-| - | - | period | The period of data sync (in seconds). | SW_CONFIG_APOLLO_PERIOD | 60 |
-| - | zookeeper|namespace| The namespace (represented by root path) that isolates the configurations in the Zookeeper. |SW_CONFIG_ZK_NAMESPACE| `/`, root path |
-| - | - | hostPort| Hosts and ports of Zookeeper Cluster. |SW_CONFIG_ZK_HOST_PORT| localhost:2181 |
-| - | - | baseSleepTimeMs|The period of Zookeeper client between two retries (in milliseconds). |SW_CONFIG_ZK_BASE_SLEEP_TIME_MS| 1000 |
-| - | - | maxRetries| The maximum retry time. |SW_CONFIG_ZK_MAX_RETRIES| 3 |
-| - | - | period | The period of data sync (in seconds). | SW_CONFIG_ZK_PERIOD | 60 |
-| - | etcd| endpoints | Hosts and ports for etcd cluster (separated by commas if multiple). | SW_CONFIG_ETCD_ENDPOINTS | http://localhost:2379 |
-| - | - | namespace | Namespace for SkyWalking cluster. |SW_CONFIG_ETCD_NAMESPACE | /skywalking |
-| - | - | authentication | Indicates whether there is authentication. | SW_CONFIG_ETCD_AUTHENTICATION | false |
-| - | - | user | Etcd auth username. | SW_CONFIG_ETCD_USER | |
-| - | - | password | Etcd auth password. | SW_CONFIG_ETCD_PASSWORD | |
-| - | - | period | The period of data sync (in seconds). | SW_CONFIG_ZK_PERIOD | 60
-| - | consul | hostPort| Hosts and ports for Consul cluster.| SW_CONFIG_CONSUL_HOST_AND_PORTS| localhost:8500 |
-| - | - | aclToken| ACL Token of Consul. Empty string means `without ACL token`.| SW_CONFIG_CONSUL_ACL_TOKEN | - |
-| - | - | period | The period of data sync (in seconds). | SW_CONFIG_CONSUL_PERIOD | 60 |
-| - | k8s-configmap | namespace | Deployment namespace of the config map. |SW_CLUSTER_K8S_NAMESPACE| default |
-| - | - | labelSelector| Labels for locating configmap. |SW_CLUSTER_K8S_LABEL| app=collector,release=skywalking |
-| - | - | period | The period of data sync (in seconds). | SW_CONFIG_ZK_PERIOD | 60 |
-| - | nacos | serverAddr | Nacos Server Host. | SW_CONFIG_NACOS_SERVER_ADDR | 127.0.0.1 |
-| - | - | port | Nacos Server Port. | SW_CONFIG_NACOS_SERVER_PORT | 8848 |
-| - | - | group | Nacos Configuration namespace. | SW_CONFIG_NACOS_SERVER_NAMESPACE | - |
-| - | - | period | The period of data sync (in seconds). | SW_CONFIG_CONFIG_NACOS_PERIOD | 60 |
-| - | - | username | Nacos Auth username. | SW_CONFIG_NACOS_USERNAME | - |
-| - | - | password | Nacos Auth password. | SW_CONFIG_NACOS_PASSWORD | - |
-| - | - | accessKey | Nacos Auth accessKey. | SW_CONFIG_NACOS_ACCESSKEY | - |
-| - | - | secretKey | Nacos Auth secretKey. | SW_CONFIG_NACOS_SECRETKEY | - |
-| exporter | grpc | targetHost | The host of target gRPC server for receiving export data. | SW_EXPORTER_GRPC_HOST | 127.0.0.1 |
-| - | - | targetPort | The port of target gRPC server for receiving export data. | SW_EXPORTER_GRPC_PORT | 9870 |
-| health-checker | default | checkIntervalSeconds | The period of checking OAP internal health status (in seconds). | SW_HEALTH_CHECKER_INTERVAL_SECONDS | 5 |
-| configuration-discovery | default | disableMessageDigest | If true, agent receives the latest configuration every time, even without making any changes. By default, OAP uses the SHA512 message digest mechanism to detect changes in configuration. | SW_DISABLE_MESSAGE_DIGEST | false
-| receiver-event|default| gRPC services that handle events data. | - | - |
+| Module | Provider | Settings | Value(s) and Explanation [...]
+|-------------------------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [...]
+| core | default | role | Option values: `Mixed/Receiver/Aggregator`. **Receiver** mode OAP opens the service to the agents, then analyzes and aggregates the results, and forwards the results for distributed aggregation. Aggregator mode OAP receives data from Mixer and Receiver role OAP nodes, and perf [...]
+| - | - | restHost | Binding IP of RESTful services. Services include GraphQL query and HTTP data report. [...]
+| - | - | restPort | Binding port of RESTful services. [...]
+| - | - | restContextPath | Web context path of RESTful services. [...]
+| - | - | restMaxThreads | Maximum thread number of RESTful services. [...]
+| - | - | restIdleTimeOut | Connector idle timeout of RESTful services (in milliseconds). [...]
+| - | - | restAcceptQueueSize | ServerSocketChannel Backlog of RESTful services. [...]
+| - | - | httpMaxRequestHeaderSize | Maximum request header size accepted. [...]
+| - | - | gRPCHost | Binding IP of gRPC services, including gRPC data report and internal communication among OAP nodes. [...]
+| - | - | gRPCPort | Binding port of gRPC services. [...]
+| - | - | gRPCSslEnabled | Activates SSL for gRPC services. [...]
+| - | - | gRPCSslKeyPath | File path of gRPC SSL key. [...]
+| - | - | gRPCSslCertChainPath | File path of gRPC SSL cert chain. [...]
+| - | - | gRPCSslTrustedCAPath | File path of gRPC trusted CA. [...]
+| - | - | downsampling | Activated level of down sampling aggregation. [...]
+| - | - | persistentPeriod | Execution period of the persistent timer (in seconds). [...]
+| - | - | enableDataKeeperExecutor | Controller of TTL scheduler. Once disabled, TTL wouldn't work. [...]
+| - | - | dataKeeperExecutePeriod | Execution period of TTL scheduler (in minutes). Execution doesn't mean deleting data. The storage provider (e.g. ElasticSearch storage) could override this. [...]
+| - | - | recordDataTTL | The lifecycle of record data (in days). Record data includes traces, top N sample records, and logs. Minimum value is 2. [...]
+| - | - | metricsDataTTL | The lifecycle of metrics data (in days), including metadata. We recommend setting metricsDataTTL >= recordDataTTL. Minimum value is 2. [...]
+| - | - | l1FlushPeriod | The period of L1 aggregation flush to L2 aggregation (in milliseconds). [...]
+| - | - | storageSessionTimeout | The threshold of session time (in milliseconds). Default value is 70000. [...]
+| - | - | persistentPeriod | The period of doing data persistence. Unit is second.Default value is 25s [...]
+| - | - | enableDatabaseSession | Cache metrics data for 1 minute to reduce database queries, and if the OAP cluster changes within that minute. [...]
+| - | - | topNReportPeriod | The execution period (in minutes) of top N sampler, which saves sampled data into the storage. [...]
+| - | - | activeExtraModelColumns | Appends entity names (e.g. service names) into metrics storage entities. [...]
+| - | - | serviceNameMaxLength | Maximum length limit of service names. [...]
+| - | - | instanceNameMaxLength | Maximum length limit of service instance names. The maximum length of service + instance names should be less than 200. [...]
+| - | - | endpointNameMaxLength | Maximum length limit of endpoint names. The maximum length of service + endpoint names should be less than 240. [...]
+| - | - | searchableTracesTags | Defines a set of span tag keys which are searchable through GraphQL. Multiple values are separated by commas. [...]
+| - | - | searchableLogsTags | Defines a set of log tag keys which are searchable through GraphQL. Multiple values are separated by commas. [...]
+| - | - | searchableAlarmTags | Defines a set of alarm tag keys which are searchable through GraphQL. Multiple values are separated by commas. [...]
+| - | - | gRPCThreadPoolSize | Pool size of gRPC server. [...]
+| - | - | gRPCThreadPoolQueueSize | Queue size of gRPC server. [...]
+| - | - | maxConcurrentCallsPerConnection | The maximum number of concurrent calls permitted for each incoming connection. Defaults to no limit. [...]
+| - | - | maxMessageSize | Sets the maximum message size allowed to be received on the server. Empty means 4 MiB. [...]
+| - | - | remoteTimeout | Timeout for cluster internal communication (in seconds). [...]
+| - | - | maxSizeOfNetworkAddressAlias | The maximum size of network address detected in the system being monitored. [...]
+| - | - | maxPageSizeOfQueryProfileSnapshot | The maximum size for snapshot analysis in an OAP query. [...]
+| - | - | maxSizeOfAnalyzeProfileSnapshot | The maximum number of snapshots analyzed by the OAP. [...]
+| - | - | prepareThreads | The number of threads used to prepare metrics data to the storage. [...]
+| - | - | enableEndpointNameGroupingByOpenapi | Automatically groups endpoints by the given OpenAPI definitions. [...]
+| - | - | maxDurationOfQueryEBPFProfilingData | The maximum duration(in second) of query the eBPF profiling data from database. [...]
+| - | - | maxThreadCountOfQueryEBPFProfilingData | The maximum thread count of query the eBPF profiling data from database. [...]
+| cluster | standalone | - | Standalone is not suitable for running on a single node running. No configuration available. [...]
+| - | zookeeper | namespace | The namespace, represented by root path, isolates the configurations in Zookeeper. [...]
+| - | - | hostPort | Hosts and ports of Zookeeper Cluster. [...]
+| - | - | baseSleepTimeMs | The period of Zookeeper client between two retries (in milliseconds). [...]
+| - | - | maxRetries | The maximum retry time. [...]
+| - | - | enableACL | Opens ACL using `schema` and `expression`. [...]
+| - | - | schema | Schema for the authorization. [...]
+| - | - | expression | Expression for the authorization. [...]
+| - | - | internalComHost | The hostname registered in Zookeeper for the internal communication of OAP cluster. [...]
+| - | - | internalComPort | The port registered in Zookeeper for the internal communication of OAP cluster. [...]
+| - | kubernetes | namespace | Namespace deployed by SkyWalking in k8s. [...]
+| - | - | labelSelector | Labels used for filtering OAP deployment in k8s. [...]
+| - | - | uidEnvName | Environment variable name for reading uid. [...]
+| - | consul | serviceName | Service name for SkyWalking cluster. [...]
+| - | - | hostPort | Hosts and ports for Consul cluster. [...]
+| - | - | aclToken | ACL Token of Consul. Empty string means `without ALC token`. [...]
+| - | - | internalComHost | The hostname registered in Consul for internal communications of the OAP cluster. [...]
+| - | - | internalComPort | The port registered in Consul for internal communications of the OAP cluster. [...]
+| - | etcd | serviceName | Service name for SkyWalking cluster. [...]
+| - | - | endpoints | Hosts and ports for etcd cluster. [...]
+| - | - | namespace | Namespace for SkyWalking cluster. [...]
+| - | - | authentication | Indicates whether there is authentication. [...]
+| - | - | user | Etcd auth username. [...]
+| - | - | password | Etcd auth password. [...]
+| - | - | internalComHost | The hostname registered in etcd for internal communications of the OAP cluster. [...]
+| - | - | internalComPort | The port registered in etcd for internal communications of the OAP cluster. [...]
+| - | Nacos | serviceName | Service name for SkyWalking cluster. [...]
+| - | - | hostPort | Hosts and ports for Nacos cluster. [...]
+| - | - | namespace | Namespace used by SkyWalking node coordination. [...]
+| - | - | internalComHost | The hostname registered in Nacos for internal communications of the OAP cluster. [...]
+| - | - | internalComPort | The port registered in Nacos for internal communications of the OAP cluster. [...]
+| - | - | username | Nacos Auth username. [...]
+| - | - | password | Nacos Auth password. [...]
+| - | - | accessKey | Nacos Auth accessKey. [...]
+| - | - | secretKey | Nacos Auth secretKey. [...]
+| storage | elasticsearch | - | ElasticSearch (and OpenSearch) storage implementation. [...]
+| - | - | namespace | Prefix of indexes created and used by SkyWalking. [...]
+| - | - | clusterNodes | ElasticSearch cluster nodes for client connection. [...]
+| - | - | protocol | HTTP or HTTPs. [...]
+| - | - | connectTimeout | Connect timeout of ElasticSearch client (in milliseconds). [...]
+| - | - | socketTimeout | Socket timeout of ElasticSearch client (in milliseconds). [...]
+| - | - | responseTimeout | Response timeout of ElasticSearch client (in milliseconds), `0` disables the timeout. [...]
+| - | - | numHttpClientThread | The number of threads for the underlying HTTP client to perform socket I/O. If the value is <= 0, the number of available processors will be used. [...]
+| - | - | user | Username of ElasticSearch cluster. [...]
+| - | - | password | Password of ElasticSearch cluster. [...]
+| - | - | trustStorePath | Trust JKS file path. Only works when username and password are enabled. [...]
+| - | - | trustStorePass | Trust JKS file password. Only works when username and password are enabled. [...]
+| - | - | secretsManagementFile | Secrets management file in the properties format, including username and password, which are managed by a 3rd party tool. Capable of being updated them at runtime. [...]
+| - | - | dayStep | Represents the number of days in the one-minute/hour/day index. [...]
+| - | - | indexShardsNumber | Shard number of new indexes. [...]
+| - | - | indexReplicasNumber | Replicas number of new indexes. [...]
+| - | - | superDatasetDayStep | Represents the number of days in the super size dataset record index. Default value is the same as dayStep when the value is less than 0. [...]
+| - | - | superDatasetIndexShardsFactor | Super dataset is defined in the code (e.g. trace segments). This factor provides more shards for the super dataset: shards number = indexShardsNumber * superDatasetIndexShardsFactor. This factor also affects Zipkin and Jaeger traces. [...]
+| - | - | superDatasetIndexReplicasNumber | Represents the replicas number in the super size dataset record index. [...]
+| - | - | indexTemplateOrder | The order of index template. [...]
+| - | - | bulkActions | Async bulk size of the record data batch execution. [...]
+| - | - | flushInterval | Period of flush (in seconds). Does not matter whether `bulkActions` is reached or not. INT(flushInterval * 2/3) is used for index refresh period. [...]
+| - | - | concurrentRequests | The number of concurrent requests allowed to be executed. [...]
+| - | - | resultWindowMaxSize | The maximum size of dataset when the OAP loads cache, such as network aliases. [...]
+| - | - | metadataQueryMaxSize | The maximum size of metadata per query. [...]
+| - | - | scrollingBatchSize | The batch size of metadata per iteration when `metadataQueryMaxSize` or `resultWindowMaxSize` is too large to be retrieved in a single query. [...]
+| - | - | segmentQueryMaxSize | The maximum size of trace segments per query. [...]
+| - | - | profileTaskQueryMaxSize | The maximum size of profile task per query. [...]
+| - | - | advanced | All settings of ElasticSearch index creation. The value should be in JSON format. [...]
+| - | h2 | - | H2 storage is designed for demonstration and running in short term (i.e. 1-2 hours) only. [...]
+| - | - | driver | H2 JDBC driver. [...]
+| - | - | url | H2 connection URL. Defaults to H2 memory mode. [...]
+| - | - | user | Username of H2 database. [...]
+| - | - | password | Password of H2 database. [...]
+| - | - | metadataQueryMaxSize | The maximum size of metadata per query. [...]
+| - | - | maxSizeOfArrayColumn | Some entities (e.g. trace segments) include the logic column with multiple values. In H2, we use multiple physical columns to host the values: e.g. change column_a with values [1,2,3,4,5] to `column_a_0 = 1, column_a_1 = 2, column_a_2 = 3 , column_a_3 = 4, column_a_4 = 5`. [...]
+| - | - | numOfSearchableValuesPerTag | In a trace segment, this includes multiple spans with multiple tags. Different spans may have the same tag key, e.g. multiple HTTP exit spans all have their own `http.method` tags. This configuration sets the limit on the maximum number of values for the same tag key. [...]
+| - | - | maxSizeOfBatchSql | The maximum size of batch size of SQL execution [...]
+| - | - | asyncBatchPersistentPoolSize | async flush data into database thread size [...]
+| - | mysql | - | MySQL Storage. The MySQL JDBC Driver is not in the dist. Please copy it into the oap-lib folder manually. [...]
+| - | - | properties | Hikari connection pool configurations. [...]
+| - | - | metadataQueryMaxSize | The maximum size of metadata per query. [...]
+| - | - | maxSizeOfArrayColumn | Some entities (e.g. trace segments) include the logic column with multiple values. In MySQL, we use multiple physical columns to host the values, e.g. change column_a with values [1,2,3,4,5] to `column_a_0 = 1, column_a_1 = 2, column_a_2 = 3 , column_a_3 = 4, column_a_4 = 5`. [...]
+| - | - | numOfSearchableValuesPerTag | In a trace segment, this includes multiple spans with multiple tags. Different spans may have same tag key, e.g. multiple HTTP exit spans all have their own `http.method` tags. This configuration sets the limit on the maximum number of values for the same tag key. [...]
+| - | - | maxSizeOfBatchSql | The maximum size of batch size of SQL execution [...]
+| - | - | asyncBatchPersistentPoolSize | async flush data into database thread size [...]
+| - | postgresql | - | PostgreSQL storage. [...]
+| - | - | properties | Hikari connection pool configurations. [...]
+| - | - | metadataQueryMaxSize | The maximum size of metadata per query. [...]
+| - | - | maxSizeOfArrayColumn | Some entities (e.g. trace segments) include the logic column with multiple values. In PostgreSQL, we use multiple physical columns to host the values, e.g. change column_a with values [1,2,3,4,5] to `column_a_0 = 1, column_a_1 = 2, column_a_2 = 3 , column_a_3 = 4, column_a_4 = [...]
+| - | - | numOfSearchableValuesPerTag | In a trace segment, this includes multiple spans with multiple tags. Different spans may have same tag key, e.g. multiple HTTP exit spans all have their own `http.method` tags. This configuration sets the limit on the maximum number of values for the same tag key. [...]
+| - | - | maxSizeOfBatchSql | The maximum size of batch size of SQL execution [...]
+| - | - | asyncBatchPersistentPoolSize | async flush data into database thread size [...]
+| agent-analyzer | default | Agent Analyzer. | SW_AGENT_ANALYZER [...]
+| - | - | traceSamplingPolicySettingsFile | The sampling policy including `sampling rate` and `the threshold of trace segment latency` can be configured by the `traceSamplingPolicySettingsFile` file. [...]
+| - | - | slowDBAccessThreshold | The slow database access threshold (in milliseconds). [...]
+| - | - | forceSampleErrorSegment | When sampling mechanism is activated, this config samples the error status segment and ignores the sampling rate. [...]
+| - | - | segmentStatusAnalysisStrategy | Determines the final segment status from span status. Available values are `FROM_SPAN_STATUS` , `FROM_ENTRY_SPAN`, and `FROM_FIRST_SPAN`. `FROM_SPAN_STATUS` indicates that the segment status would be error if any span has an error status. `FROM_ENTRY_SPAN` means that the segme [...]
+| - | - | noUpstreamRealAddressAgents | Exit spans with the component in the list would not generate client-side instance relation metrics, since some tracing plugins (e.g. Nginx-LUA and Envoy) can't collect the real peer IP address. [...]
+| - | - | meterAnalyzerActiveFiles | Indicates which files could be instrumented and analyzed. Multiple files are split by ",". [...]
+| receiver-sharing-server | default | Sharing server provides new gRPC and restful servers for data collection. Ana designates that servers in the core module are to be used for internal communication only. | - [...]
+| - | - | restHost | Binding IP of RESTful services. Services include GraphQL query and HTTP data report. [...]
+| - | - | restPort | Binding port of RESTful services. [...]
+| - | - | restContextPath | Web context path of RESTful services. [...]
+| - | - | restMaxThreads | Maximum thread number of RESTful services. [...]
+| - | - | restIdleTimeOut | Connector idle timeout of RESTful services (in milliseconds). [...]
+| - | - | restAcceptQueueSize | ServerSocketChannel backlog of RESTful services. [...]
+| - | - | httpMaxRequestHeaderSize | Maximum request header size accepted. [...]
+| - | - | gRPCHost | Binding IP of gRPC services. Services include gRPC data report and internal communication among OAP nodes. [...]
+| - | - | gRPCPort | Binding port of gRPC services. [...]
+| - | - | gRPCThreadPoolSize | Pool size of gRPC server. [...]
+| - | - | gRPCThreadPoolQueueSize | Queue size of gRPC server. [...]
+| - | - | gRPCSslEnabled | Activates SSL for gRPC services. [...]
+| - | - | gRPCSslKeyPath | File path of gRPC SSL key. [...]
+| - | - | gRPCSslCertChainPath | File path of gRPC SSL cert chain. [...]
+| - | - | maxConcurrentCallsPerConnection | The maximum number of concurrent calls permitted for each incoming connection. Defaults to no limit. [...]
+| - | - | authentication | The token text for authentication. Works for gRPC connection only. Once this is set, the client is required to use the same token. [...]
+| log-analyzer | default | Log Analyzer. | SW_LOG_ANALYZER [...]
+| - | - | lalFiles | The LAL configuration file names (without file extension) to be activated. Read [LAL](../../concepts-and-designs/lal.md) for more details. [...]
+| - | - | malFiles | The MAL configuration file names (without file extension) to be activated. Read [LAL](../../concepts-and-designs/lal.md) for more details. [...]
+| event-analyzer | default | Event Analyzer. | SW_EVENT_ANALYZER [...]
+| receiver-register | default | gRPC and HTTPRestful services that provide service, service instance and endpoint register. | - [...]
+| receiver-trace | default | gRPC and HTTPRestful services that accept SkyWalking format traces. | - [...]
+| receiver-jvm | default | gRPC services that accept JVM metrics data. | - [...]
+| receiver-clr | default | gRPC services that accept .Net CLR metrics data. | - [...]
+| receiver-profile | default | gRPC services that accept profile task status and snapshot reporter. | - [...]
+| receiver-zabbix | default | TCP receiver accepts Zabbix format metrics. | - [...]
+| - | - | port | Exported TCP port. Zabbix agent could connect and transport data. [...]
+| - | - | host | Binds to host. [...]
+| - | - | activeFiles | Enables config when agent request is received. [...]
+| service-mesh | default | gRPC services that accept data from inbound mesh probes. | - [...]
+| envoy-metric | default | Envoy `metrics_service` and `ALS(access log service)` are supported by this receiver. The OAL script supports all GAUGE type metrics. | - [...]
+| - | - | acceptMetricsService | Starts Envoy Metrics Service analysis. [...]
+| - | - | alsHTTPAnalysis | Starts Envoy HTTP Access Log Service analysis. Value = `k8s-mesh` means starting the analysis. [...]
+| - | - | alsTCPAnalysis | Starts Envoy TCP Access Log Service analysis. Value = `k8s-mesh` means starting the analysis. [...]
+| - | - | k8sServiceNameRule | `k8sServiceNameRule` allows you to customize the service name in ALS via Kubernetes metadata. The available variables are `pod` and `service`. E.g. you can use `${service.metadata.name}-${pod.metadata.labels.version}` to append the version number to the service name. Note that [...]
+| receiver-otel | default | A receiver for analyzing metrics data from OpenTelemetry. | - [...]
+| - | - | enabledHandlers | Enabled handlers for otel. [...]
+| - | - | enabledOcRules | Enabled metric rules for OC handler. [...]
+| receiver-zipkin | default | A receiver for Zipkin traces. | - [...]
+| - | - | restHost | Binding IP of RESTful services. [...]
+| - | - | restPort | Binding port of RESTful services. [...]
+| - | - | restContextPath | Web context path of RESTful services. [...]
+| - | - | restMaxThreads | Maximum thread number of RESTful services. [...]
+| - | - | restIdleTimeOut | Connector idle timeout of RESTful services (in milliseconds). [...]
+| - | - | restAcceptQueueSize | Maximum request header size accepted. [...]
+| - | - | instanceNameRule | Get the instance name from these tags. [...]
+| - | - | searchableTracesTags | Defines a set of span tag keys which are searchable. Multiple values are separated by commas. [...]
+| prometheus-fetcher | default | Prometheus fetcher reads metrics from Prometheus endpoint, and transfer the metrics into SkyWalking native format for the MAL engine. | - [...]
+| - | - | enabledRules | Enabled rules. [...]
+| - | - | maxConvertWorker | The maximize meter convert worker. [...]
+| kafka-fetcher | default | Read SkyWalking's native metrics/logs/traces through Kafka server. | - [...]
+| - | - | bootstrapServers | A list of host/port pairs to use for establishing the initial connection to the Kafka cluster. [...]
+| - | - | namespace | Namespace aims to isolate multi OAP cluster when using the same Kafka cluster. If you set a namespace for Kafka fetcher, OAP will add a prefix to topic name. You should also set namespace in `agent.config`. The property is named `plugin.kafka.namespace`. [...]
+| - | - | groupId | A unique string that identifies the consumer group to which this consumer belongs. [...]
+| - | - | createTopicIfNotExist | If true, this creates Kafka topic (if it does not already exist). [...]
+| - | - | partitions | The number of partitions for the topic being created. [...]
+| - | - | consumers | The number of consumers to create. [...]
+| - | - | enableNativeProtoLog | Enables fetching and handling native proto log data. [...]
+| - | - | enableNativeJsonLog | Enables fetching and handling native json log data. [...]
+| - | - | replicationFactor | The replication factor for each partition in the topic being created. [...]
+| - | - | kafkaHandlerThreadPoolSize | Pool size of Kafka message handler executor. [...]
+| - | - | kafkaHandlerThreadPoolQueueSize | Queue size of Kafka message handler executor. [...]
+| - | - | topicNameOfMeters | Kafka topic name for meter system data. [...]
+| - | - | topicNameOfMetrics | Kafka topic name for JVM metrics data. [...]
+| - | - | topicNameOfProfiling | Kafka topic name for profiling data. [...]
+| - | - | topicNameOfTracingSegments | Kafka topic name for tracing data. [...]
+| - | - | topicNameOfManagements | Kafka topic name for service instance reporting and registration. [...]
+| - | - | topicNameOfLogs | Kafka topic name for native proto log data. [...]
+| - | - | topicNameOfJsonLogs | Kafka topic name for native json log data. [...]
+| receiver-browser | default | gRPC services that accept browser performance data and error log. | - [...]
+| - | - | sampleRate | Sampling rate for receiving trace. Precise to 1/10000. 10000 means sampling rate of 100% by default. [...]
+| query | graphql | - | GraphQL query implementation. [...]
+| - | - | enableLogTestTool | Enable the log testing API to test the LAL. **NOTE**: This API evaluates untrusted code on the OAP server. A malicious script can do significant damage (steal keys and secrets, remove files and directories, install malware, etc). As such, please enable this API only when you c [...]
+| - | - | maxQueryComplexity | Maximum complexity allowed for the GraphQL query that can be used to abort a query if the total number of data fields queried exceeds the defined threshold. [...]
+| - | - | enableUpdateUITemplate | Allow user add,disable and update UI template. [...]
+| alarm | default | - | Read [alarm doc](backend-alarm.md) for more details. [...]
+| telemetry | - | - | Read [telemetry doc](backend-telemetry.md) for more details. [...]
+| - | none | - | No op implementation. [...]
+| - | prometheus | host | Binding host for Prometheus server fetching data. [...]
+| - | - | port | Binding port for Prometheus server fetching data. [...]
+| configuration | - | - | Read [dynamic configuration doc](dynamic-config.md) for more details. [...]
+| - | grpc | host | DCS server binding hostname. [...]
+| - | - | port | DCS server binding port. [...]
+| - | - | clusterName | Cluster name when reading the latest configuration from DSC server. [...]
+| - | - | period | The period of reading data from DSC server by the OAP (in seconds). [...]
+| - | apollo | apolloMeta | `apollo.meta` in Apollo. [...]
+| - | - | apolloCluster | `apollo.cluster` in Apollo. [...]
+| - | - | apolloEnv | `env` in Apollo. [...]
+| - | - | appId | `app.id` in Apollo. [...]
+| - | - | period | The period of data sync (in seconds). [...]
+| - | zookeeper | namespace | The namespace (represented by root path) that isolates the configurations in the Zookeeper. [...]
+| - | - | hostPort | Hosts and ports of Zookeeper Cluster. [...]
+| - | - | baseSleepTimeMs | The period of Zookeeper client between two retries (in milliseconds). [...]
+| - | - | maxRetries | The maximum retry time. [...]
+| - | - | period | The period of data sync (in seconds). [...]
+| - | etcd | endpoints | Hosts and ports for etcd cluster (separated by commas if multiple). [...]
+| - | - | namespace | Namespace for SkyWalking cluster. [...]
+| - | - | authentication | Indicates whether there is authentication. [...]
+| - | - | user | Etcd auth username. [...]
+| - | - | password | Etcd auth password. [...]
+| - | - | period | The period of data sync (in seconds). [...]
+| - | consul | hostPort | Hosts and ports for Consul cluster. [...]
+| - | - | aclToken | ACL Token of Consul. Empty string means `without ACL token`. [...]
+| - | - | period | The period of data sync (in seconds). [...]
+| - | k8s-configmap | namespace | Deployment namespace of the config map. [...]
+| - | - | labelSelector | Labels for locating configmap. [...]
+| - | - | period | The period of data sync (in seconds). [...]
+| - | nacos | serverAddr | Nacos Server Host. [...]
+| - | - | port | Nacos Server Port. [...]
+| - | - | group | Nacos Configuration namespace. [...]
+| - | - | period | The period of data sync (in seconds). [...]
+| - | - | username | Nacos Auth username. [...]
+| - | - | password | Nacos Auth password. [...]
+| - | - | accessKey | Nacos Auth accessKey. [...]
+| - | - | secretKey | Nacos Auth secretKey. [...]
+| exporter | grpc | targetHost | The host of target gRPC server for receiving export data. [...]
+| - | - | targetPort | The port of target gRPC server for receiving export data. [...]
+| health-checker | default | checkIntervalSeconds | The period of checking OAP internal health status (in seconds). [...]
+| configuration-discovery | default | disableMessageDigest | If true, agent receives the latest configuration every time, even without making any changes. By default, OAP uses the SHA512 message digest mechanism to detect changes in configuration. [...]
+| receiver-event | default | gRPC services that handle events data. | - [...]
## Note
¹ System Environment Variable name could be declared and changed in `application.yml`. The names listed here are simply provided in the default `application.yml` file.
diff --git a/oap-server-bom/pom.xml b/oap-server-bom/pom.xml
index 97938874ba..e5526537b8 100644
--- a/oap-server-bom/pom.xml
+++ b/oap-server-bom/pom.xml
@@ -75,8 +75,6 @@
<awaitility.version>3.0.0</awaitility.version>
<httpcore.version>4.4.13</httpcore.version>
<commons-compress.version>1.21</commons-compress.version>
- <iotdb-session.version>0.12.5</iotdb-session.version>
- <lz4-java.version>1.6.0</lz4-java.version>
</properties>
<dependencyManagement>
@@ -541,16 +539,6 @@
<artifactId>commons-compress</artifactId>
<version>${commons-compress.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.iotdb</groupId>
- <artifactId>iotdb-session</artifactId>
- <version>${iotdb-session.version}</version>
- </dependency>
- <dependency>
- <groupId>org.lz4</groupId>
- <artifactId>lz4-java</artifactId>
- <version>${lz4-java.version}</version>
- </dependency>
</dependencies>
</dependencyManagement>
</project>
diff --git a/oap-server/server-starter/pom.xml b/oap-server/server-starter/pom.xml
index 38f12172fe..9b2a6a7442 100644
--- a/oap-server/server-starter/pom.xml
+++ b/oap-server/server-starter/pom.xml
@@ -182,21 +182,11 @@
<artifactId>storage-jdbc-hikaricp-plugin</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.skywalking</groupId>
- <artifactId>storage-influxdb-plugin</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>storage-tidb-plugin</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.skywalking</groupId>
- <artifactId>storage-iotdb-plugin</artifactId>
- <version>${project.version}</version>
- </dependency>
<!-- storage module -->
<!-- queryBuild module -->
diff --git a/oap-server/server-starter/src/main/resources/application.yml b/oap-server/server-starter/src/main/resources/application.yml
index d8430650b7..b5bacbfe63 100755
--- a/oap-server/server-starter/src/main/resources/application.yml
+++ b/oap-server/server-starter/src/main/resources/application.yml
@@ -199,17 +199,6 @@ storage:
numOfSearchableValuesPerTag: ${SW_STORAGE_NUM_OF_SEARCHABLE_VALUES_PER_TAG:2}
maxSizeOfBatchSql: ${SW_STORAGE_MAX_SIZE_OF_BATCH_SQL:2000}
asyncBatchPersistentPoolSize: ${SW_STORAGE_ASYNC_BATCH_PERSISTENT_POOL_SIZE:4}
- influxdb:
- # InfluxDB configuration
- url: ${SW_STORAGE_INFLUXDB_URL:http://localhost:8086}
- user: ${SW_STORAGE_INFLUXDB_USER:root}
- password: ${SW_STORAGE_INFLUXDB_PASSWORD:}
- database: ${SW_STORAGE_INFLUXDB_DATABASE:skywalking}
- actions: ${SW_STORAGE_INFLUXDB_ACTIONS:1000} # the number of actions to collect
- duration: ${SW_STORAGE_INFLUXDB_DURATION:1000} # the time to wait at most (milliseconds)
- batchEnabled: ${SW_STORAGE_INFLUXDB_BATCH_ENABLED:true}
- fetchTaskLogMaxSize: ${SW_STORAGE_INFLUXDB_FETCH_TASK_LOG_MAX_SIZE:5000} # the max number of fetch task log in a request
- connectionResponseFormat: ${SW_STORAGE_INFLUXDB_CONNECTION_RESPONSE_FORMAT:MSGPACK} # the response format of connection to influxDB, cannot be anything but MSGPACK or JSON.
postgresql:
properties:
jdbcUrl: ${SW_JDBC_URL:"jdbc:postgresql://localhost:5432/skywalking"}
@@ -252,14 +241,6 @@ storage:
oapAnalyzer: ${SW_STORAGE_ES_OAP_ANALYZER:"{\"analyzer\":{\"oap_analyzer\":{\"type\":\"stop\"}}}"} # the oap analyzer.
oapLogAnalyzer: ${SW_STORAGE_ES_OAP_LOG_ANALYZER:"{\"analyzer\":{\"oap_log_analyzer\":{\"type\":\"standard\"}}}"} # the oap log analyzer. It could be customized by the ES analyzer configuration to support more language log formats, such as Chinese log, Japanese log and etc.
advanced: ${SW_STORAGE_ES_ADVANCED:""}
- iotdb:
- host: ${SW_STORAGE_IOTDB_HOST:127.0.0.1}
- rpcPort: ${SW_STORAGE_IOTDB_RPC_PORT:6667}
- username: ${SW_STORAGE_IOTDB_USERNAME:root}
- password: ${SW_STORAGE_IOTDB_PASSWORD:root}
- storageGroup: ${SW_STORAGE_IOTDB_STORAGE_GROUP:root.skywalking}
- sessionPoolSize: ${SW_STORAGE_IOTDB_SESSIONPOOL_SIZE:8} # If it's zero, the SessionPool size will be 2*CPU_Cores
- fetchTaskLogMaxSize: ${SW_STORAGE_IOTDB_FETCH_TASK_LOG_MAX_SIZE:1000} # the max number of fetch task log in a request
agent-analyzer:
selector: ${SW_AGENT_ANALYZER:default}
diff --git a/oap-server/server-storage-plugin/pom.xml b/oap-server/server-storage-plugin/pom.xml
index fc7f896467..3f954827cc 100644
--- a/oap-server/server-storage-plugin/pom.xml
+++ b/oap-server/server-storage-plugin/pom.xml
@@ -31,8 +31,6 @@
<module>storage-jdbc-hikaricp-plugin</module>
<module>storage-elasticsearch-plugin</module>
<module>storage-zipkin-elasticsearch-plugin</module>
- <module>storage-influxdb-plugin</module>
<module>storage-tidb-plugin</module>
- <module>storage-iotdb-plugin</module>
</modules>
</project>
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/pom.xml b/oap-server/server-storage-plugin/storage-influxdb-plugin/pom.xml
deleted file mode 100644
index a9d24afe07..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>server-storage-plugin</artifactId>
- <groupId>org.apache.skywalking</groupId>
- <version>9.1.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>storage-influxdb-plugin</artifactId>
- <packaging>jar</packaging>
-
- <properties>
- <influxdb-jave.version>2.15</influxdb-jave.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.skywalking</groupId>
- <artifactId>server-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.skywalking</groupId>
- <artifactId>library-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.influxdb</groupId>
- <artifactId>influxdb-java</artifactId>
- <version>${influxdb-jave.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxClient.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxClient.java
deleted file mode 100644
index 8506431d19..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxClient.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb;
-
-import lombok.extern.slf4j.Slf4j;
-import okhttp3.OkHttpClient;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.library.client.Client;
-import org.apache.skywalking.oap.server.library.client.healthcheck.DelegatedHealthChecker;
-import org.apache.skywalking.oap.server.library.client.healthcheck.HealthCheckable;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.library.util.HealthChecker;
-import org.influxdb.InfluxDB;
-import org.influxdb.InfluxDBFactory;
-import org.influxdb.dto.BatchPoints;
-import org.influxdb.dto.Point;
-import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.time.TimeInterval;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.ti;
-
-/**
- * InfluxDB connection maintainer, provides base data write/query API.
- */
-@Slf4j
-public class InfluxClient implements Client, HealthCheckable {
- private final DelegatedHealthChecker healthChecker = new DelegatedHealthChecker();
- private final InfluxStorageConfig config;
- private InfluxDB influx;
- /**
- * A constant, the name of time field in Time-series database.
- */
- public static final String TIME = "time";
-
- private final String database;
-
- public InfluxClient(InfluxStorageConfig config) {
- this.config = config;
- this.database = config.getDatabase();
- }
-
- public final String getDatabase() {
- return database;
- }
-
- @Override
- public void connect() {
- try {
- InfluxDB.ResponseFormat responseFormat = InfluxDB.ResponseFormat.valueOf(config.getConnectionResponseFormat());
- influx = InfluxDBFactory.connect(config.getUrl(), config.getUser(), config.getPassword(),
- new OkHttpClient.Builder().readTimeout(3, TimeUnit.MINUTES)
- .writeTimeout(3, TimeUnit.MINUTES),
- responseFormat
- );
- influx.query(new Query("CREATE DATABASE " + database));
- influx.enableGzip();
-
- if (config.isBatchEnabled()) {
- influx.enableBatch(config.getActions(), config.getDuration(), TimeUnit.MILLISECONDS);
- }
-
- influx.setDatabase(database);
- healthChecker.health();
- } catch (Throwable e) {
- healthChecker.unHealth(e);
- throw e;
- }
- }
-
- /**
- * To get a connection of InfluxDB.
- *
- * @return InfluxDB's connection
- */
- private InfluxDB getInflux() {
- return influx;
- }
-
- /**
- * Execute a query against InfluxDB and return a set of {@link QueryResult.Result}s. Normally, InfluxDB supports
- * combining multiple statements into one query, so that we do get multi-results.
- *
- * @throws IOException if there is an error on the InfluxDB server or communication error.
- */
- public List<QueryResult.Result> query(Query query) throws IOException {
- if (log.isDebugEnabled()) {
- log.debug("SQL Statement: {}", query.getCommand());
- }
- try {
- QueryResult result = getInflux().query(new Query(query.getCommand()));
- if (result.hasError()) {
- throw new IOException(result.getError());
- }
- healthChecker.health();
- return result.getResults();
- } catch (Throwable e) {
- healthChecker.unHealth(e);
- throw new IOException(e.getMessage() + System.lineSeparator() + "SQL Statement: " + query.getCommand(), e);
- }
- }
-
- /**
- * Execute a query against InfluxDB with a single statement.
- *
- * @throws IOException if there is an error on the InfluxDB server or communication error
- */
- public List<QueryResult.Series> queryForSeries(Query query) throws IOException {
- List<QueryResult.Result> results = query(query);
-
- if (CollectionUtils.isEmpty(results)) {
- return null;
- }
- return results.get(0).getSeries();
- }
-
- /**
- * Execute a query against InfluxDB with a single statement but return a single {@link QueryResult.Series}.
- *
- * @throws IOException if there is an error on the InfluxDB server or communication error
- */
- public QueryResult.Series queryForSingleSeries(Query query) throws IOException {
- List<QueryResult.Series> series = queryForSeries(query);
- if (CollectionUtils.isEmpty(series)) {
- return null;
- }
- return series.get(0);
- }
-
- /**
- * Execute a query against InfluxDB with a `select count(*)` statement and return the count only.
- *
- * @throws IOException if there is an error on the InfluxDB server or communication error
- */
- public int getCounter(Query query) throws IOException {
- QueryResult.Series series = queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), series);
- }
- if (Objects.isNull(series)) {
- return 0;
- }
- return ((Number) series.getValues().get(0).get(1)).intValue();
- }
-
- /**
- * Data management, to drop a time-series by measurement and time-series name specified. If an exception isn't
- * thrown, it means execution success. Notice, drop series don't support to drop series by range
- *
- * @throws IOException if there is an error on the InfluxDB server or communication error
- */
- public void dropSeries(String measurement, long timeBucket) throws IOException {
- Query query = new Query("DROP SERIES FROM " + measurement + " WHERE time_bucket='" + timeBucket + "'");
- this.query(query);
- }
-
- public void deleteByQuery(String measurement, long timestamp) throws IOException {
- this.query(new Query("delete from " + measurement + " where time < " + timestamp + "ms"));
- }
-
- /**
- * Write a {@link Point} into InfluxDB. Note that, the {@link Point} is written into buffer of InfluxDB Client and
- * wait for buffer flushing.
- */
- public void write(Point point) {
- try {
- getInflux().write(point);
- this.healthChecker.health();
- } catch (Throwable e) {
- healthChecker.unHealth(e);
- throw e;
- }
- }
-
- /**
- * A batch operation of write. {@link Point}s flush directly.
- */
- public void write(BatchPoints points) {
- try {
- getInflux().write(points);
- this.healthChecker.health();
- } catch (Throwable e) {
- healthChecker.unHealth(e);
- throw e;
- }
- }
-
- @Override
- public void shutdown() throws IOException {
- try {
- getInflux().close();
- this.healthChecker.health();
- } catch (Throwable e) {
- healthChecker.unHealth(e);
- throw new IOException(e);
- }
- }
-
- /**
- * Convert to InfluxDB {@link TimeInterval}.
- */
- public static TimeInterval timeIntervalTS(long timestamp) {
- return ti(timestamp, "ms");
- }
-
- /**
- * Convert to InfluxDB {@link TimeInterval}.
- */
- public static TimeInterval timeIntervalTB(long timeBucket) {
- return ti(TimeBucket.getTimestamp(timeBucket), "ms");
- }
-
- @Override
- public void registerChecker(HealthChecker healthChecker) {
- this.healthChecker.register(healthChecker);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxConstants.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxConstants.java
deleted file mode 100644
index 06896feee6..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxConstants.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb;
-
-public interface InfluxConstants {
- String ID_COLUMN = "id";
-
- String NAME = "\"name\"";
-
- String ALL_FIELDS = "*::field";
-
- String SORT_DES = "top";
-
- String SORT_ASC = "bottom";
-
- String DURATION = "\"" + "duration" + "\"";
-
- interface TagName {
-
- String ID_COLUMN = "_id";
-
- String NAME = "_name_";
-
- String ENTITY_ID = "_entity_id";
-
- String TIME_BUCKET = "_time_bucket";
-
- String LAYER = "_layer";
-
- String SERVICE_GROUP = "_service_group";
-
- String SERVICE_ID = "_service_id";
-
- String INSTANCE_ID = "_instance_id";
-
- String AGENT_ID = "_agent_id";
-
- String AUTOCOMPLETE_TAG_KEY = "_autocomplete_tag_key";
-
- String AUTOCOMPLETE_TAG_VALUE = "_autocomplete_tag_value";
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageConfig.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageConfig.java
deleted file mode 100644
index d287f8c38c..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageConfig.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.skywalking.oap.server.library.module.ModuleConfig;
-
-@Setter
-@Getter
-public class InfluxStorageConfig extends ModuleConfig {
- private String url;
- private String user;
- private String password;
- private String database;
-
- private int actions;
- private int duration;
- private boolean batchEnabled = true;
-
- private int fetchTaskLogMaxSize = 5000;
- private String connectionResponseFormat = "MSGPACK";
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageProvider.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageProvider.java
deleted file mode 100644
index 3faaf0d588..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageProvider.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.CoreModule;
-import org.apache.skywalking.oap.server.core.storage.IBatchDAO;
-import org.apache.skywalking.oap.server.core.storage.IHistoryDeleteDAO;
-import org.apache.skywalking.oap.server.core.storage.StorageBuilderFactory;
-import org.apache.skywalking.oap.server.core.storage.StorageDAO;
-import org.apache.skywalking.oap.server.core.storage.StorageException;
-import org.apache.skywalking.oap.server.core.storage.StorageModule;
-import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressAliasDAO;
-import org.apache.skywalking.oap.server.core.storage.management.UITemplateManagementDAO;
-import org.apache.skywalking.oap.server.core.storage.model.ModelCreator;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingDataDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingScheduleDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IServiceLabelDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileTaskLogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileTaskQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileThreadSnapshotQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IAggregationQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IAlarmQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IBrowserLogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingTaskDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IEventQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ILogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IMetadataQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IMetricsQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ITagAutoCompleteQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ITopNRecordsQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ITopologyQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ITraceQueryDAO;
-import org.apache.skywalking.oap.server.library.module.ModuleConfig;
-import org.apache.skywalking.oap.server.library.module.ModuleDefine;
-import org.apache.skywalking.oap.server.library.module.ModuleProvider;
-import org.apache.skywalking.oap.server.library.module.ModuleStartException;
-import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.base.BatchDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.base.HistoryDeleteDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.base.InfluxStorageDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.AggregationQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.AlarmQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.BrowserLogQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.EBPFProfilingDataQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.EBPFProfilingScheduleQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.EBPFProfilingTaskQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.EventQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.LogQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.MetadataQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.MetricsQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.NetworkAddressAliasDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.ServiceLabelQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.ProfileTaskLogQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.ProfileTaskQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.ProfileThreadSnapshotQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.TagAutoCompleteQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.TopNRecordsQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.TopologyQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.TraceQuery;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.UITemplateManagementDAOImpl;
-import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
-import org.apache.skywalking.oap.server.telemetry.api.HealthCheckMetrics;
-import org.apache.skywalking.oap.server.telemetry.api.MetricsCreator;
-import org.apache.skywalking.oap.server.telemetry.api.MetricsTag;
-
-@Slf4j
-public class InfluxStorageProvider extends ModuleProvider {
- private final InfluxStorageConfig config;
- private InfluxClient client;
-
- public InfluxStorageProvider() {
- config = new InfluxStorageConfig();
- }
-
- @Override
- public String name() {
- return "influxdb";
- }
-
- @Override
- public Class<? extends ModuleDefine> module() {
- return StorageModule.class;
- }
-
- @Override
- public ModuleConfig createConfigBeanIfAbsent() {
- return config;
- }
-
- @Override
- public void prepare() throws ServiceNotProvidedException {
- this.registerServiceImplementation(StorageBuilderFactory.class, new StorageBuilderFactory.Default());
-
- client = new InfluxClient(config);
-
- this.registerServiceImplementation(IBatchDAO.class, new BatchDAO(client));
- this.registerServiceImplementation(StorageDAO.class, new InfluxStorageDAO(client));
-
- this.registerServiceImplementation(INetworkAddressAliasDAO.class, new NetworkAddressAliasDAO(client));
- this.registerServiceImplementation(IMetadataQueryDAO.class, new MetadataQuery(client));
-
- this.registerServiceImplementation(ITopologyQueryDAO.class, new TopologyQuery(client));
- this.registerServiceImplementation(IMetricsQueryDAO.class, new MetricsQuery(client));
- this.registerServiceImplementation(ITraceQueryDAO.class, new TraceQuery(client));
- this.registerServiceImplementation(IBrowserLogQueryDAO.class, new BrowserLogQuery(client));
- this.registerServiceImplementation(IAggregationQueryDAO.class, new AggregationQuery(client));
- this.registerServiceImplementation(IAlarmQueryDAO.class, new AlarmQuery(client));
- this.registerServiceImplementation(ITopNRecordsQueryDAO.class, new TopNRecordsQuery(client));
- this.registerServiceImplementation(ILogQueryDAO.class, new LogQuery(client));
-
- this.registerServiceImplementation(IProfileTaskQueryDAO.class, new ProfileTaskQuery(client));
- this.registerServiceImplementation(
- IProfileThreadSnapshotQueryDAO.class, new ProfileThreadSnapshotQuery(client));
- this.registerServiceImplementation(
- IProfileTaskLogQueryDAO.class, new ProfileTaskLogQuery(client, config.getFetchTaskLogMaxSize()));
-
- this.registerServiceImplementation(
- IHistoryDeleteDAO.class, new HistoryDeleteDAO(client));
- this.registerServiceImplementation(UITemplateManagementDAO.class, new UITemplateManagementDAOImpl(client));
-
- this.registerServiceImplementation(IEventQueryDAO.class, new EventQueryDAO(client));
-
- this.registerServiceImplementation(IEBPFProfilingTaskDAO.class, new EBPFProfilingTaskQuery(client));
- this.registerServiceImplementation(IEBPFProfilingScheduleDAO.class, new EBPFProfilingScheduleQuery(client));
- this.registerServiceImplementation(IEBPFProfilingDataDAO.class, new EBPFProfilingDataQuery(client));
- this.registerServiceImplementation(IServiceLabelDAO.class, new ServiceLabelQuery(client));
- this.registerServiceImplementation(ITagAutoCompleteQueryDAO.class, new TagAutoCompleteQueryDAO(client));
- }
-
- @Override
- public void start() throws ServiceNotProvidedException, ModuleStartException {
- MetricsCreator metricCreator = getManager().find(TelemetryModule.NAME)
- .provider()
- .getService(MetricsCreator.class);
- HealthCheckMetrics healthChecker = metricCreator.createHealthCheckerGauge(
- "storage_influxdb", MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE);
- client.registerChecker(healthChecker);
- try {
- client.connect();
-
- InfluxTableInstaller installer = new InfluxTableInstaller(client, getManager());
- getManager().find(CoreModule.NAME).provider().getService(ModelCreator.class).addModelListener(installer);
- } catch (StorageException e) {
- throw new ModuleStartException(e.getMessage(), e);
- }
- }
-
- @Override
- public void notifyAfterCompleted() throws ServiceNotProvidedException {
-
- }
-
- @Override
- public String[] requiredModules() {
- return new String[] {CoreModule.NAME};
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxTableInstaller.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxTableInstaller.java
deleted file mode 100644
index 8642592f09..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxTableInstaller.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb;
-
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.model.ModelInstaller;
-import org.apache.skywalking.oap.server.library.client.Client;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
-
-public class InfluxTableInstaller extends ModelInstaller {
-
- public InfluxTableInstaller(Client client, ModuleManager moduleManager) {
- super(client, moduleManager);
- }
-
- @Override
- protected boolean isExists(final Model model) {
- TableMetaInfo.addModel(model);
- return true;
- }
-
- @Override
- protected void createTable(final Model model) {
- // Automatically create table
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/TableMetaInfo.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/TableMetaInfo.java
deleted file mode 100644
index ea93800319..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/TableMetaInfo.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb;
-
-import com.google.common.collect.Maps;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter;
-import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.instance.InstanceTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.TagAutocompleteData;
-import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.service.ServiceTraffic;
-import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics;
-import org.apache.skywalking.oap.server.core.analysis.record.Record;
-import org.apache.skywalking.oap.server.core.storage.model.ColumnName;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.model.ModelColumn;
-
-@Getter
-@Builder
-@AllArgsConstructor
-public class TableMetaInfo {
- private static final Map<String, TableMetaInfo> TABLES = new HashMap<>();
-
- private final Map<String, String> storageAndColumnMap;
- private final Map<String, String> storageAndTagMap;
- private final Model model;
-
- public static void addModel(Model model) {
- final List<ModelColumn> columns = model.getColumns();
- final Map<String, String> storageAndTagMap = Maps.newHashMap();
- final Map<String, String> storageAndColumnMap = Maps.newHashMap();
- columns.forEach(column -> {
- ColumnName columnName = column.getColumnName();
- storageAndColumnMap.put(columnName.getStorageName(), columnName.getName());
- });
-
- storageAndTagMap.put(InstanceTraffic.NAME, InfluxConstants.TagName.NAME);
- if (model.getName().endsWith("_traffic")) {
- switch (model.getName()) {
- // instance_traffic name, service_id
- case InstanceTraffic.INDEX_NAME: {
- storageAndTagMap.put(InstanceTraffic.NAME, InfluxConstants.TagName.NAME);
- storageAndTagMap.put(InstanceTraffic.SERVICE_ID, InfluxConstants.TagName.SERVICE_ID);
- break;
- }
- // endpoint_traffic service_id
- case EndpointTraffic.INDEX_NAME: {
- storageAndTagMap.put(EndpointTraffic.SERVICE_ID, InfluxConstants.TagName.SERVICE_ID);
- break;
- }
- // service_traffic name, group
- case ServiceTraffic.INDEX_NAME: {
- storageAndTagMap.put(ServiceTraffic.GROUP, InfluxConstants.TagName.SERVICE_GROUP);
- storageAndTagMap.put(ServiceTraffic.LAYER, InfluxConstants.TagName.LAYER);
- storageAndTagMap.put(ServiceTraffic.SERVICE_ID, InfluxConstants.TagName.SERVICE_ID);
- }
- case ProcessTraffic.INDEX_NAME: {
- storageAndTagMap.put(ProcessTraffic.SERVICE_ID, InfluxConstants.TagName.SERVICE_ID);
- storageAndTagMap.put(ProcessTraffic.INSTANCE_ID, InfluxConstants.TagName.INSTANCE_ID);
- storageAndTagMap.put(ProcessTraffic.AGENT_ID, InfluxConstants.TagName.AGENT_ID);
- }
- }
- } else {
-
- // Specifies ENTITY_ID, TIME_BUCKET, LAYER, SERVICE_ID as tag
- if (storageAndColumnMap.containsKey(Metrics.ENTITY_ID)) {
- storageAndTagMap.put(Metrics.ENTITY_ID, InfluxConstants.TagName.ENTITY_ID);
- }
- if (storageAndColumnMap.containsKey(Record.TIME_BUCKET)) {
- storageAndTagMap.put(Record.TIME_BUCKET, InfluxConstants.TagName.TIME_BUCKET);
- }
- if (storageAndColumnMap.containsKey(ServiceTraffic.LAYER)) {
- storageAndTagMap.put(ServiceTraffic.LAYER, InfluxConstants.TagName.LAYER);
- }
- if (storageAndColumnMap.containsKey(SegmentRecord.SERVICE_ID)) {
- storageAndTagMap.put(SegmentRecord.SERVICE_ID, InfluxConstants.TagName.SERVICE_ID);
- }
-
- // The field of SegmentRecord, tags, store as tag only. see SegmentRecord.DATA_BINARY
- if (SegmentRecord.INDEX_NAME.equals(model.getName())) {
- storageAndColumnMap.remove(SegmentRecord.TAGS);
- }
- }
-
- if (model.getName().equals(TagAutocompleteData.INDEX_NAME)) {
- if (storageAndColumnMap.containsKey(TagAutocompleteData.TAG_KEY)) {
- storageAndTagMap.put(TagAutocompleteData.TAG_KEY, InfluxConstants.TagName.AUTOCOMPLETE_TAG_KEY);
- }
- if (storageAndColumnMap.containsKey(TagAutocompleteData.TAG_VALUE)) {
- storageAndTagMap.put(TagAutocompleteData.TAG_VALUE, InfluxConstants.TagName.AUTOCOMPLETE_TAG_VALUE);
- }
- }
-
- final TableMetaInfo info = TableMetaInfo.builder()
- .model(model)
- .storageAndTagMap(storageAndTagMap)
- .storageAndColumnMap(storageAndColumnMap)
- .build();
- TABLES.put(model.getName(), info);
- }
-
- public static TableMetaInfo get(String moduleName) {
- return TABLES.get(moduleName);
- }
-
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/BatchDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/BatchDAO.java
deleted file mode 100644
index 00fc791f8a..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/BatchDAO.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.base;
-
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.storage.IBatchDAO;
-import org.apache.skywalking.oap.server.library.client.request.InsertRequest;
-import org.apache.skywalking.oap.server.library.client.request.PrepareRequest;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.influxdb.dto.BatchPoints;
-
-@Slf4j
-public class BatchDAO implements IBatchDAO {
- private final InfluxClient client;
-
- public BatchDAO(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public void insert(InsertRequest insertRequest) {
- client.write(((InfluxInsertRequest) insertRequest).getPoint());
- }
-
- @Override
- public CompletableFuture<Void> flush(List<PrepareRequest> prepareRequests) {
- if (CollectionUtils.isEmpty(prepareRequests)) {
- return CompletableFuture.completedFuture(null);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("batch sql statements execute, data size: {}", prepareRequests.size());
- }
-
- final BatchPoints.Builder builder = BatchPoints.builder();
- prepareRequests.forEach(e -> builder.point(((InfluxInsertRequest) e).getPoint()));
-
- client.write(builder.build());
- return CompletableFuture.completedFuture(null);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/HistoryDeleteDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/HistoryDeleteDAO.java
deleted file mode 100644
index dc17339869..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/HistoryDeleteDAO.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.base;
-
-import java.io.IOException;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.storage.IHistoryDeleteDAO;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.joda.time.DateTime;
-
-@Slf4j
-public class HistoryDeleteDAO implements IHistoryDeleteDAO {
- private final InfluxClient client;
-
- public HistoryDeleteDAO(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public void deleteHistory(Model model, String timeBucketColumnName, int ttl) throws IOException {
- if (log.isDebugEnabled()) {
- log.debug("TTL execution log, model: {}", model.getName());
- }
- try {
- long deadline = Long.parseLong(new DateTime().plusDays(-ttl).toString("yyyyMMddHHmm"));
-
- client.deleteByQuery(model.getName(), TimeBucket.getTimestamp(deadline));
- } catch (Exception e) {
- log.error("TTL execution log, model: {}, errMsg: {}", model.getName(), e.getMessage());
- }
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/InfluxInsertRequest.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/InfluxInsertRequest.java
deleted file mode 100644
index e40ab21cee..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/InfluxInsertRequest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.base;
-
-import com.google.common.collect.Maps;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import org.apache.skywalking.oap.server.core.alarm.AlarmRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.log.LogRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.model.ModelColumn;
-import org.apache.skywalking.oap.server.core.storage.type.HashMapConverter;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.core.storage.type.StorageDataComplexObject;
-import org.apache.skywalking.oap.server.library.client.request.InsertRequest;
-import org.apache.skywalking.oap.server.library.client.request.UpdateRequest;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.Point;
-
-/**
- * InfluxDB Point wrapper.
- */
-public class InfluxInsertRequest implements InsertRequest, UpdateRequest {
- private final Point.Builder builder;
- private final Map<String, Object> fields = Maps.newHashMap();
-
- public <T extends StorageData> InfluxInsertRequest(Model model, T storageData, StorageBuilder<T> storageBuilder) {
- final HashMapConverter.ToStorage toStorage = new HashMapConverter.ToStorage();
- storageBuilder.entity2Storage(storageData, toStorage);
- final Map<String, Object> objectMap = toStorage.obtain();
- if (SegmentRecord.INDEX_NAME.equals(model.getName()) || LogRecord.INDEX_NAME.equals(
- model.getName()) || AlarmRecord.INDEX_NAME.equals(model.getName())) {
- objectMap.remove(SegmentRecord.TAGS);
- }
-
- for (ModelColumn column : model.getColumns()) {
- final Object value = objectMap.get(column.getColumnName().getName());
-
- if (value instanceof StorageDataComplexObject) {
- fields.put(
- column.getColumnName().getStorageName(),
- ((StorageDataComplexObject) value).toStorageData()
- );
- } else {
- fields.put(column.getColumnName().getStorageName(), value);
- }
- }
- builder = Point.measurement(model.getName())
- .addField(InfluxConstants.ID_COLUMN, storageData.id())
- .fields(fields);
- }
-
- public InfluxInsertRequest time(long time, TimeUnit unit) {
- builder.time(time, unit);
- return this;
- }
-
- public InfluxInsertRequest addFieldAsTag(String fieldName, String tagName) {
- builder.tag(tagName, String.valueOf(fields.get(fieldName)));
- return this;
- }
-
- public InfluxInsertRequest tag(String key, String value) {
- builder.tag(key, value);
- return this;
- }
-
- public Point getPoint() {
- return builder.build();
- }
-}
\ No newline at end of file
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/InfluxStorageDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/InfluxStorageDAO.java
deleted file mode 100644
index 826212d59b..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/InfluxStorageDAO.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.base;
-
-import org.apache.skywalking.oap.server.core.analysis.config.NoneStream;
-import org.apache.skywalking.oap.server.core.analysis.management.ManagementData;
-import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics;
-import org.apache.skywalking.oap.server.core.analysis.record.Record;
-import org.apache.skywalking.oap.server.core.storage.IManagementDAO;
-import org.apache.skywalking.oap.server.core.storage.IMetricsDAO;
-import org.apache.skywalking.oap.server.core.storage.INoneStreamDAO;
-import org.apache.skywalking.oap.server.core.storage.IRecordDAO;
-import org.apache.skywalking.oap.server.core.storage.StorageDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-
-public class InfluxStorageDAO implements StorageDAO {
- private final InfluxClient influxClient;
-
- public InfluxStorageDAO(InfluxClient influxClient) {
- this.influxClient = influxClient;
- }
-
- @Override
- public IMetricsDAO newMetricsDao(StorageBuilder storageBuilder) {
- return new MetricsDAO(influxClient, (StorageBuilder<Metrics>) storageBuilder);
- }
-
- @Override
- public IRecordDAO newRecordDao(StorageBuilder storageBuilder) {
- return new RecordDAO((StorageBuilder<Record>) storageBuilder);
- }
-
- @Override
- public INoneStreamDAO newNoneStreamDao(StorageBuilder storageBuilder) {
- return new NoneStreamDAO(influxClient, (StorageBuilder<NoneStream>) storageBuilder);
- }
-
- @Override
- public IManagementDAO newManagementDao(StorageBuilder storageBuilder) {
- return new ManagementDAO(influxClient, (StorageBuilder<ManagementData>) storageBuilder);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/ManagementDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/ManagementDAO.java
deleted file mode 100644
index a755adfd60..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/ManagementDAO.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.base;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.management.ManagementData;
-import org.apache.skywalking.oap.server.core.management.ui.template.UITemplate;
-import org.apache.skywalking.oap.server.core.storage.IManagementDAO;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.type.HashMapConverter;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.Point;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.ID_COLUMN;
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.NAME;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class ManagementDAO implements IManagementDAO {
- private final InfluxClient client;
- private final StorageBuilder<ManagementData> storageBuilder;
-
- public ManagementDAO(InfluxClient client, StorageBuilder<ManagementData> storageBuilder) {
- this.client = client;
- this.storageBuilder = storageBuilder;
- }
-
- @Override
- public void insert(final Model model, final ManagementData managementData) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> query = select()
- .column(ID_COLUMN).column(NAME)
- .from(client.getDatabase(), UITemplate.INDEX_NAME)
- .where(eq(ID_COLUMN, managementData.id()));
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), series);
- }
- if (series != null && series.getValues().size() > 0) {
- return;
- }
-
- final HashMapConverter.ToStorage toStorage = new HashMapConverter.ToStorage();
- storageBuilder.entity2Storage(managementData, toStorage);
- Point point = Point.measurement(UITemplate.INDEX_NAME)
- .tag(InfluxConstants.TagName.ID_COLUMN, managementData.id())
- .time(1L, TimeUnit.NANOSECONDS)
- .fields(toStorage.obtain()).build();
- client.write(point);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/MetricsDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/MetricsDAO.java
deleted file mode 100644
index b9d7a5f6d7..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/MetricsDAO.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.base;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-
-import io.vavr.Function2;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.instance.InstanceTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.service.ServiceTraffic;
-import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics;
-import org.apache.skywalking.oap.server.core.storage.IMetricsDAO;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.type.HashMapConverter;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.core.storage.type.StorageDataComplexObject;
-import org.apache.skywalking.oap.server.library.client.request.InsertRequest;
-import org.apache.skywalking.oap.server.library.client.request.UpdateRequest;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.TagName;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.TableMetaInfo;
-import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.ALL_FIELDS;
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.ID_COLUMN;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class MetricsDAO implements IMetricsDAO {
-
- private final StorageBuilder<Metrics> storageBuilder;
- private final InfluxClient client;
-
- public MetricsDAO(InfluxClient client, StorageBuilder<Metrics> storageBuilder) {
- this.client = client;
- this.storageBuilder = storageBuilder;
- }
-
- @Override
- public List<Metrics> multiGet(Model model, List<Metrics> metrics) throws IOException {
- final TableMetaInfo metaInfo = TableMetaInfo.get(model.getName());
- final String queryStr;
- if (model.getName().endsWith("_traffic")) {
- final Function2<Metrics, WhereQueryImpl<SelectQueryImpl>, WhereQueryImpl<SelectQueryImpl>> clauseFunction;
- switch (model.getName()) {
- case EndpointTraffic.INDEX_NAME: {
- clauseFunction = (m, query) -> appendEqualsClause(query, TagName.SERVICE_ID, ((EndpointTraffic) m).getServiceId());
- break;
- }
- case ServiceTraffic.INDEX_NAME: {
- clauseFunction = (m, query) -> appendEqualsClause(query, TagName.NAME, ((ServiceTraffic) m).getName());
- break;
- }
- case InstanceTraffic.INDEX_NAME: {
- clauseFunction = (m, query) -> appendEqualsClause(query, TagName.SERVICE_ID, ((InstanceTraffic) m).getServiceId());
- break;
- }
- case ProcessTraffic.INDEX_NAME: {
- clauseFunction = (m, query) -> appendEqualsClause(query, TagName.SERVICE_ID, ((ProcessTraffic) m).getServiceId());
- break;
- }
- default:
- throw new IOException("Unknown metadata type, " + model.getName());
- }
- queryStr = metrics.stream().map(m -> clauseFunction.apply(m, select().raw(ALL_FIELDS)
- .from(client.getDatabase(), model.getName())
- .where(eq(ID_COLUMN, m.id())))
- .buildQueryString()
- ).collect(Collectors.joining(";"));
- } else {
- queryStr = metrics.stream().map(m -> select().raw(ALL_FIELDS)
- .from(client.getDatabase(), model.getName())
- .where(eq(
- TagName.TIME_BUCKET,
- String.valueOf(m.getTimeBucket())
- ))
- .and(eq(ID_COLUMN, m.id()))
- .buildQueryString()
- ).collect(Collectors.joining(";"));
- }
-
- final Query query = new Query(queryStr);
- final List<QueryResult.Result> results = client.query(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), results);
- }
-
- if (CollectionUtils.isEmpty(results)) {
- return Collections.emptyList();
- }
-
- final List<Metrics> newMetrics = Lists.newArrayList();
- final Map<String, String> storageAndColumnMap = metaInfo.getStorageAndColumnMap();
- results.stream()
- .map(QueryResult.Result::getSeries)
- .filter(Objects::nonNull)
- .flatMap(Collection::stream)
- .filter(Objects::nonNull)
- .forEach(series -> {
- final List<String> columns = series.getColumns();
- series.getValues().forEach(values -> {
- Map<String, Object> data = Maps.newHashMap();
-
- for (int i = 1; i < columns.size(); i++) {
- Object value = values.get(i);
- if (value instanceof StorageDataComplexObject) {
- value = ((StorageDataComplexObject) value).toStorageData();
- }
-
- data.put(storageAndColumnMap.get(columns.get(i)), value);
- }
- newMetrics.add(storageBuilder.storage2Entity(new HashMapConverter.ToEntity(data)));
- });
- });
-
- return newMetrics;
- }
-
- private WhereQueryImpl<SelectQueryImpl> appendEqualsClause(WhereQueryImpl<SelectQueryImpl> base, String key, String value) {
- if (StringUtil.isEmpty(value)) {
- return base;
- }
- return base.and(eq(key, value));
- }
-
- @Override
- public InsertRequest prepareBatchInsert(Model model, Metrics metrics) {
- final long timestamp = TimeBucket.getTimestamp(metrics.getTimeBucket(), model.getDownsampling());
- final TableMetaInfo tableMetaInfo = TableMetaInfo.get(model.getName());
-
- final InfluxInsertRequest request = new InfluxInsertRequest(model, metrics, storageBuilder)
- .time(timestamp, TimeUnit.MILLISECONDS);
-
- tableMetaInfo.getStorageAndTagMap().forEach(request::addFieldAsTag);
- return request;
- }
-
- @Override
- public UpdateRequest prepareBatchUpdate(Model model, Metrics metrics) {
- return (UpdateRequest) this.prepareBatchInsert(model, metrics);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/NoneStreamDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/NoneStreamDAO.java
deleted file mode 100644
index bfd024c37e..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/NoneStreamDAO.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.base;
-
-import java.util.concurrent.TimeUnit;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.config.NoneStream;
-import org.apache.skywalking.oap.server.core.storage.INoneStreamDAO;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.datacarrier.common.AtomicRangeInteger;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.TableMetaInfo;
-
-public class NoneStreamDAO implements INoneStreamDAO {
- private static final int PADDING_SIZE = 1_000_000;
- private static final AtomicRangeInteger SUFFIX = new AtomicRangeInteger(0, PADDING_SIZE);
-
- private final InfluxClient client;
- private final StorageBuilder<NoneStream> storageBuilder;
-
- public NoneStreamDAO(InfluxClient client, StorageBuilder<NoneStream> storageBuilder) {
- this.client = client;
- this.storageBuilder = storageBuilder;
- }
-
- @Override
- public void insert(final Model model, final NoneStream noneStream) {
- final long timestamp = TimeBucket.getTimestamp(noneStream.getTimeBucket(), model.getDownsampling())
- * PADDING_SIZE + SUFFIX.getAndIncrement();
-
- final InfluxInsertRequest request = new InfluxInsertRequest(model, noneStream, storageBuilder)
- .time(timestamp, TimeUnit.NANOSECONDS);
- TableMetaInfo.get(model.getName()).getStorageAndTagMap().forEach(request::addFieldAsTag);
- client.write(request.getPoint());
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/RecordDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/RecordDAO.java
deleted file mode 100644
index 009e199fe0..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/RecordDAO.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.base;
-
-import com.google.common.base.Joiner;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.datacarrier.common.AtomicRangeInteger;
-import org.apache.skywalking.oap.server.core.alarm.AlarmRecord;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.manual.log.LogRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.Tag;
-import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord;
-import org.apache.skywalking.oap.server.core.analysis.record.Record;
-import org.apache.skywalking.oap.server.core.storage.IRecordDAO;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.library.client.request.InsertRequest;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.TableMetaInfo;
-
-import static java.util.Objects.nonNull;
-
-public class RecordDAO implements IRecordDAO {
- private static final int PADDING_SIZE = 1_000_000;
- private static final AtomicRangeInteger SUFFIX = new AtomicRangeInteger(0, PADDING_SIZE);
-
- private final StorageBuilder<Record> storageBuilder;
-
- public RecordDAO(StorageBuilder<Record> storageBuilder) {
- this.storageBuilder = storageBuilder;
- }
-
- @Override
- public InsertRequest prepareBatchInsert(Model model, Record record) {
- final long timestamp = TimeBucket.getTimestamp(record.getTimeBucket(), model.getDownsampling())
- * PADDING_SIZE
- + SUFFIX.getAndIncrement();
-
- final InfluxInsertRequest request = new InfluxInsertRequest(model, record, storageBuilder)
- .time(timestamp, TimeUnit.NANOSECONDS);
-
- TableMetaInfo.get(model.getName()).getStorageAndTagMap().forEach(request::addFieldAsTag);
- List<Tag> rawTags = null;
- if (SegmentRecord.INDEX_NAME.equals(model.getName())) {
- rawTags = ((SegmentRecord) record).getTagsRawData();
- } else if (LogRecord.INDEX_NAME.equals(model.getName())) {
- rawTags = ((LogRecord) record).getTags();
- } else if (AlarmRecord.INDEX_NAME.equals(model.getName())) {
- rawTags = ((AlarmRecord) record).getTags();
- }
- if (nonNull(rawTags)) {
- Map<String, List<Tag>> collect = rawTags.stream()
- .collect(
- Collectors.groupingBy(Tag::getKey));
- collect.forEach((key, value) -> request.tag(
- key,
- "'" + Joiner.on("'").join(value.stream().map(Tag::getValue).collect(Collectors.toSet())) + "'"
- ));
- }
- return request;
- }
-
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AggregationQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AggregationQuery.java
deleted file mode 100644
index 5d04cb4f9f..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AggregationQuery.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.collect.Lists;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.query.enumeration.Order;
-import org.apache.skywalking.oap.server.core.query.input.Duration;
-import org.apache.skywalking.oap.server.core.query.input.TopNCondition;
-import org.apache.skywalking.oap.server.core.query.type.KeyValue;
-import org.apache.skywalking.oap.server.core.query.type.SelectedRecord;
-import org.apache.skywalking.oap.server.core.storage.query.IAggregationQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.SelectSubQueryImpl;
-import org.influxdb.querybuilder.WhereSubQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class AggregationQuery implements IAggregationQueryDAO {
- private static final Comparator<SelectedRecord> ASCENDING =
- Comparator.comparingLong(a -> Long.parseLong(a.getValue()));
- private static final Comparator<SelectedRecord> DESCENDING = (a, b) ->
- Long.compare(Long.parseLong(b.getValue()), Long.parseLong(a.getValue()));
- private final InfluxClient client;
-
- public AggregationQuery(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public List<SelectedRecord> sortMetrics(final TopNCondition condition,
- final String valueColumnName,
- final Duration duration,
- final List<KeyValue> additionalConditions) throws IOException {
- String measurement = condition.getName();
-
- // Have to re-sort here. Because the function, top()/bottom(), get the result ordered by the `time`.
- Comparator<SelectedRecord> comparator = DESCENDING;
- String functionName = InfluxConstants.SORT_DES;
- if (condition.getOrder().equals(Order.ASC)) {
- functionName = InfluxConstants.SORT_ASC;
- comparator = ASCENDING;
- }
-
- SelectQueryImpl query = select().function(functionName, "mean", condition.getTopN()).as("value")
- .column(InfluxConstants.TagName.ENTITY_ID)
- .from(client.getDatabase(), measurement);
-
- WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> where = select()
- .fromSubQuery(client.getDatabase())
- .mean(valueColumnName)
- .from(condition.getName())
- .where();
- if (additionalConditions != null) {
- additionalConditions.forEach(moreCondition ->
- where.and(eq(moreCondition.getKey(), moreCondition.getValue()))
- );
- }
- final SelectSubQueryImpl<SelectQueryImpl> subQuery = where
- .and(gte(InfluxClient.TIME, InfluxClient.timeIntervalTS(duration.getStartTimestamp())))
- .and(lte(InfluxClient.TIME, InfluxClient.timeIntervalTS(duration.getEndTimestamp())))
- .groupBy(InfluxConstants.TagName.ENTITY_ID);
-
- query.setSubQuery(subQuery);
-
- List<QueryResult.Series> series = client.queryForSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
- if (series == null || series.isEmpty()) {
- return Collections.emptyList();
- }
-
- List<List<Object>> dataset = series.get(0).getValues();
- List<SelectedRecord> entities = Lists.newArrayListWithCapacity(dataset.size());
- dataset.forEach(values -> {
- final SelectedRecord entity = new SelectedRecord();
- entity.setId((String) values.get(2));
- entity.setValue(((Double) values.get(1)).longValue() + "");
- entities.add(entity);
- });
-
- entities.sort(comparator); // re-sort by self, because of the result order by time.
- return entities;
- }
-
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AlarmQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AlarmQuery.java
deleted file mode 100644
index 3ab8dd3bf8..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AlarmQuery.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.base.Strings;
-import java.io.IOException;
-import java.util.List;
-import java.util.Objects;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.alarm.AlarmRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.Tag;
-import org.apache.skywalking.oap.server.core.query.enumeration.Scope;
-import org.apache.skywalking.oap.server.core.query.type.AlarmMessage;
-import org.apache.skywalking.oap.server.core.query.type.Alarms;
-import org.apache.skywalking.oap.server.core.storage.query.IAlarmQueryDAO;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereNested;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.contains;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class AlarmQuery implements IAlarmQueryDAO {
- private final InfluxClient client;
-
- public AlarmQuery(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public Alarms getAlarm(Integer scopeId, String keyword, int limit, int from, long startTB,
- long endTB, List<Tag> tags) throws IOException {
-
- WhereQueryImpl<SelectQueryImpl> recallQuery = select()
- .function("top", AlarmRecord.START_TIME, limit + from).as(AlarmRecord.START_TIME)
- .column(AlarmRecord.ID0)
- .column(AlarmRecord.ALARM_MESSAGE)
- .column(AlarmRecord.SCOPE)
- .column(AlarmRecord.TAGS_RAW_DATA)
- .from(client.getDatabase(), AlarmRecord.INDEX_NAME)
- .where();
- if (startTB > 0 && endTB > 0) {
- recallQuery.and(gte(InfluxClient.TIME, InfluxClient.timeIntervalTB(startTB)))
- .and(lte(InfluxClient.TIME, InfluxClient.timeIntervalTB(endTB)));
- }
- if (!Strings.isNullOrEmpty(keyword)) {
- recallQuery.and(contains(AlarmRecord.ALARM_MESSAGE, keyword.replaceAll("/", "\\\\/")));
- }
- if (Objects.nonNull(scopeId)) {
- recallQuery.and(eq(AlarmRecord.SCOPE, scopeId));
- }
- if (CollectionUtils.isNotEmpty(tags)) {
- WhereNested<WhereQueryImpl<SelectQueryImpl>> nested = recallQuery.andNested();
- for (final Tag tag : tags) {
- nested.and(contains(tag.getKey(), "'" + tag.getValue() + "'"));
- }
- nested.close();
- }
-
- WhereQueryImpl<SelectQueryImpl> countQuery = select().count(AlarmRecord.ID0)
- .from(client.getDatabase(), AlarmRecord.INDEX_NAME)
- .where();
- recallQuery.getClauses().forEach(countQuery::where);
-
- Query query = new Query(countQuery.getCommand() + recallQuery.getCommand());
- List<QueryResult.Result> results = client.query(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), results);
- }
- if (results.size() != 2) {
- throw new IOException("Expecting to get 2 Results, but it is " + results.size());
- }
- List<QueryResult.Series> series = results.get(1).getSeries();
- if (series == null || series.isEmpty()) {
- return new Alarms();
- }
- List<QueryResult.Series> counter = results.get(0).getSeries();
- Alarms alarms = new Alarms();
- alarms.setTotal(((Number) counter.get(0).getValues().get(0).get(1)).intValue());
-
- series.get(0).getValues()
- .stream()
- // re-sort by self, because of the result order by time.
- .sorted((a, b) -> Long.compare((long) b.get(1), (long) a.get(1)))
- .skip(from)
- .forEach(values -> {
- final int sid = ((Number) values.get(4)).intValue();
- Scope scope = Scope.Finder.valueOf(sid);
-
- AlarmMessage message = new AlarmMessage();
- message.setStartTime((long) values.get(1));
- message.setId((String) values.get(2));
- message.setMessage((String) values.get(3));
- message.setScope(scope);
- message.setScopeId(sid);
- String dataBinaryBase64 = (String) values.get(5);
- if (!com.google.common.base.Strings.isNullOrEmpty(dataBinaryBase64)) {
- parserDataBinaryBase64(dataBinaryBase64, message.getTags());
- }
- alarms.getMsgs().add(message);
- });
- return alarms;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/BrowserLogQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/BrowserLogQuery.java
deleted file mode 100644
index a5b057d055..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/BrowserLogQuery.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import java.io.IOException;
-import java.util.List;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.core.browser.manual.errorlog.BrowserErrorLogRecord;
-import org.apache.skywalking.oap.server.core.browser.source.BrowserErrorCategory;
-import org.apache.skywalking.oap.server.core.query.type.BrowserErrorLog;
-import org.apache.skywalking.oap.server.core.query.type.BrowserErrorLogs;
-import org.apache.skywalking.oap.server.core.storage.query.IBrowserLogQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static java.util.Objects.nonNull;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-@RequiredArgsConstructor
-public class BrowserLogQuery implements IBrowserLogQueryDAO {
- private final InfluxClient client;
-
- @Override
- public BrowserErrorLogs queryBrowserErrorLogs(final String serviceId,
- final String serviceVersionId,
- final String pagePathId,
- final BrowserErrorCategory category,
- final long startSecondTB,
- final long endSecondTB,
- final int limit,
- final int from) throws IOException {
-
- WhereQueryImpl<SelectQueryImpl> recallQuery = select()
- .function(InfluxConstants.SORT_DES, BrowserErrorLogRecord.TIMESTAMP, limit + from)
- .column(BrowserErrorLogRecord.DATA_BINARY)
- .from(
- client.getDatabase(),
- BrowserErrorLogRecord.INDEX_NAME
- ).where();
- if (startSecondTB != 0 && endSecondTB != 0) {
- recallQuery.and(gte(BrowserErrorLogRecord.TIME_BUCKET, startSecondTB))
- .and(lte(BrowserErrorLogRecord.TIME_BUCKET, endSecondTB));
- }
- if (StringUtil.isNotEmpty(serviceId)) {
- recallQuery.and(eq(BrowserErrorLogRecord.SERVICE_ID, serviceId));
- }
- if (StringUtil.isNotEmpty(serviceVersionId)) {
- recallQuery.and(eq(BrowserErrorLogRecord.SERVICE_VERSION_ID, serviceVersionId));
- }
- if (StringUtil.isNotEmpty(pagePathId)) {
- recallQuery.and(eq(BrowserErrorLogRecord.PAGE_PATH_ID, pagePathId));
- }
- if (nonNull(category)) {
- recallQuery.and(eq(BrowserErrorLogRecord.ERROR_CATEGORY, category.getValue()));
- }
- WhereQueryImpl<SelectQueryImpl> countQuery = select()
- .count(BrowserErrorLogRecord.SERVICE_ID)
- .from(client.getDatabase(), BrowserErrorLogRecord.INDEX_NAME)
- .where();
- recallQuery.getClauses().forEach(countQuery::where);
-
- Query query = new Query(countQuery.getCommand() + recallQuery.getCommand());
-
- List<QueryResult.Result> results = client.query(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), results);
- }
- if (results.size() != 2) {
- throw new IOException("Expecting to get 2 Results, but it is " + results.size());
- }
-
- List<QueryResult.Series> counter = results.get(0).getSeries();
- List<QueryResult.Series> result = results.get(1).getSeries();
- if (result == null || result.isEmpty()) {
- return new BrowserErrorLogs();
- }
-
- BrowserErrorLogs logs = new BrowserErrorLogs();
- logs.setTotal(((Number) counter.get(0).getValues().get(0).get(1)).intValue());
-
- result.get(0).getValues().stream().sorted((a, b) -> {
- // Have to re-sort here. Because the function, top()/bottom(), get the result ordered by the `time`.
- return Long.compare(((Number) b.get(1)).longValue(), ((Number) a.get(1)).longValue());
- }).skip(from).forEach(values -> {
- String dataBinaryBase64 = (String) values.get(2);
- if (nonNull(dataBinaryBase64)) {
- BrowserErrorLog log = parserDataBinary(dataBinaryBase64);
- logs.getLogs().add(log);
- }
- });
- return logs;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EBPFProfilingDataQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EBPFProfilingDataQuery.java
deleted file mode 100644
index 792566c33a..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EBPFProfilingDataQuery.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.base.Joiner;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingDataRecord;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingDataDAO;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Base64;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lt;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.regex;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-@RequiredArgsConstructor
-public class EBPFProfilingDataQuery implements IEBPFProfilingDataDAO {
- private final InfluxClient client;
-
- @Override
- public List<EBPFProfilingDataRecord> queryData(List<String> scheduleIdList, long beginTime, long endTime) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> query = select(
- EBPFProfilingDataRecord.SCHEDULE_ID,
- EBPFProfilingDataRecord.TASK_ID,
- EBPFProfilingDataRecord.STACK_ID_LIST,
- EBPFProfilingDataRecord.STACKS_BINARY,
- EBPFProfilingDataRecord.STACK_DUMP_COUNT,
- EBPFProfilingDataRecord.UPLOAD_TIME
- )
- .from(client.getDatabase(), EBPFProfilingDataRecord.INDEX_NAME)
- .where();
-
- query.and(regex(EBPFProfilingDataRecord.SCHEDULE_ID, "/" + Joiner.on("|").join(scheduleIdList) + "/"));
- query.and(gte(EBPFProfilingDataRecord.UPLOAD_TIME, beginTime));
- query.and(lt(EBPFProfilingDataRecord.UPLOAD_TIME, endTime));
-
- return buildDataList(query);
- }
-
- private List<EBPFProfilingDataRecord> buildDataList(WhereQueryImpl<SelectQueryImpl> query) throws IOException {
- final QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, result: {}", query.getCommand(), series);
- }
-
- if (Objects.isNull(series)) {
- return Collections.emptyList();
- }
-
- final ArrayList<EBPFProfilingDataRecord> dataList = new ArrayList<>();
- for (List<Object> values : series.getValues()) {
- final EBPFProfilingDataRecord data = new EBPFProfilingDataRecord();
- data.setScheduleId((String) values.get(1));
- data.setTaskId((String) values.get(2));
- data.setStackIdList((String) values.get(3));
- final String stackStr = (String) values.get(4);
- if (StringUtil.isNotEmpty(stackStr)) {
- data.setStacksBinary(Base64.getDecoder().decode(stackStr));
- } else {
- data.setStacksBinary(new byte[0]);
- }
- data.setStackDumpCount(((Number) values.get(5)).longValue());
- data.setUploadTime(((Number) values.get(6)).longValue());
-
- dataList.add(data);
- }
- return dataList;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EBPFProfilingScheduleQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EBPFProfilingScheduleQuery.java
deleted file mode 100644
index 4f5f68231d..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EBPFProfilingScheduleQuery.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingScheduleRecord;
-import org.apache.skywalking.oap.server.core.query.type.EBPFProfilingSchedule;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingScheduleDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-@RequiredArgsConstructor
-public class EBPFProfilingScheduleQuery implements IEBPFProfilingScheduleDAO {
- private final InfluxClient client;
-
- @Override
- public List<EBPFProfilingSchedule> querySchedules(String taskId) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> query = select(
- InfluxConstants.ID_COLUMN,
- EBPFProfilingScheduleRecord.TASK_ID,
- EBPFProfilingScheduleRecord.PROCESS_ID,
- EBPFProfilingScheduleRecord.START_TIME,
- EBPFProfilingScheduleRecord.END_TIME
- )
- .from(client.getDatabase(), EBPFProfilingScheduleRecord.INDEX_NAME)
- .where();
-
- query.and(eq(EBPFProfilingScheduleRecord.TASK_ID, taskId));
-
- return buildSchedules(query);
- }
-
- private List<EBPFProfilingSchedule> buildSchedules(WhereQueryImpl<SelectQueryImpl> query) throws IOException {
- final QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, result: {}", query.getCommand(), series);
- }
-
- if (Objects.isNull(series)) {
- return Collections.emptyList();
- }
-
- final ArrayList<EBPFProfilingSchedule> schedules = new ArrayList<>();
- for (List<Object> values : series.getValues()) {
- final EBPFProfilingSchedule schedule = new EBPFProfilingSchedule();
- schedule.setScheduleId((String) values.get(1));
- schedule.setTaskId((String) values.get(2));
- schedule.setProcessId((String) values.get(3));
- schedule.setStartTime(((Number) values.get(4)).longValue());
- schedule.setEndTime(((Number) values.get(5)).longValue());
- schedules.add(schedule);
- }
- return schedules;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EBPFProfilingTaskQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EBPFProfilingTaskQuery.java
deleted file mode 100644
index e75f6fa60a..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EBPFProfilingTaskQuery.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.base.Joiner;
-import com.google.gson.Gson;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingTargetType;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingTaskRecord;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingTriggerType;
-import org.apache.skywalking.oap.server.core.query.type.EBPFProfilingTask;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingTaskDAO;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.regex;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-@RequiredArgsConstructor
-public class EBPFProfilingTaskQuery implements IEBPFProfilingTaskDAO {
- private static final Gson GSON = new Gson();
- private final InfluxClient client;
-
- @Override
- public List<EBPFProfilingTask> queryTasks(List<String> serviceIdList, EBPFProfilingTargetType targetType, long taskStartTime, long latestUpdateTime) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> query = select(
- InfluxConstants.ID_COLUMN,
- EBPFProfilingTaskRecord.SERVICE_ID,
- EBPFProfilingTaskRecord.PROCESS_LABELS_JSON,
- EBPFProfilingTaskRecord.START_TIME,
- EBPFProfilingTaskRecord.TRIGGER_TYPE,
- EBPFProfilingTaskRecord.FIXED_TRIGGER_DURATION,
- EBPFProfilingTaskRecord.TARGET_TYPE,
- EBPFProfilingTaskRecord.CREATE_TIME,
- EBPFProfilingTaskRecord.LAST_UPDATE_TIME
- )
- .from(client.getDatabase(), EBPFProfilingTaskRecord.INDEX_NAME)
- .where();
-
- query.and(regex(EBPFProfilingTaskRecord.SERVICE_ID, "/" + Joiner.on("|").join(serviceIdList) + "/"));
- if (targetType != null) {
- query.and(eq(EBPFProfilingTaskRecord.TARGET_TYPE, targetType.value()));
- }
- if (taskStartTime > 0) {
- query.and(gte(EBPFProfilingTaskRecord.START_TIME, taskStartTime));
- }
- if (latestUpdateTime > 0) {
- query.and(eq(EBPFProfilingTaskRecord.LAST_UPDATE_TIME, latestUpdateTime));
- }
-
- return buildTasks(query);
- }
-
- private List<EBPFProfilingTask> buildTasks(WhereQueryImpl<SelectQueryImpl> query) throws IOException {
- final QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, result: {}", query.getCommand(), series);
- }
-
- if (Objects.isNull(series)) {
- return Collections.emptyList();
- }
-
- final ArrayList<EBPFProfilingTask> tasks = new ArrayList<>();
- for (List<Object> values : series.getValues()) {
- final EBPFProfilingTask task = new EBPFProfilingTask();
- task.setTaskId((String) values.get(1));
- final String serviceId = (String) values.get(2);
- task.setServiceId(serviceId);
- task.setServiceName(IDManager.ServiceID.analysisId(serviceId).getName());
- final String processLabelString = (String) values.get(3);
- if (StringUtil.isNotEmpty(processLabelString)) {
- task.setProcessLabels(GSON.<List<String>>fromJson(processLabelString, ArrayList.class));
- } else {
- task.setProcessLabels(Collections.emptyList());
- }
- task.setTaskStartTime(((Number) values.get(4)).longValue());
- task.setTriggerType(EBPFProfilingTriggerType.valueOf(((Number) values.get(5)).intValue()));
- task.setFixedTriggerDuration(((Number) values.get(6)).longValue());
- task.setTargetType(EBPFProfilingTargetType.valueOf(((Number) values.get(7)).intValue()));
- task.setCreateTime(((Number) values.get(8)).longValue());
- task.setLastUpdateTime(((Number) values.get(9)).longValue());
- tasks.add(task);
- }
-
- return tasks;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EventQueryDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EventQueryDAO.java
deleted file mode 100644
index 065b475139..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/EventQueryDAO.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.Layer;
-import org.apache.skywalking.oap.server.core.query.PaginationUtils;
-import org.apache.skywalking.oap.server.core.source.Event;
-import org.apache.skywalking.oap.server.core.query.enumeration.Order;
-import org.apache.skywalking.oap.server.core.query.input.Duration;
-import org.apache.skywalking.oap.server.core.query.type.event.EventQueryCondition;
-import org.apache.skywalking.oap.server.core.query.type.event.Events;
-import org.apache.skywalking.oap.server.core.query.type.event.Source;
-import org.apache.skywalking.oap.server.core.query.type.event.EventType;
-import org.apache.skywalking.oap.server.core.storage.query.IEventQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageDataComplexObject;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereNested;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.ALL_FIELDS;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.contains;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gt;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lt;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-@RequiredArgsConstructor
-public class EventQueryDAO implements IEventQueryDAO {
- private final InfluxClient client;
-
- @Override
- public Events queryEvents(final EventQueryCondition condition) throws Exception {
- List<WhereQueryImpl<SelectQueryImpl>> whereQueries = buildWhereQueries(condition);
-
- buildQueryByCondition(whereQueries, condition);
-
- List<QueryResult.Result> results = execute(whereQueries.get(0), whereQueries.get(1));
-
- return buildEventsByQueryResult(results);
- }
-
- @Override
- public Events queryEvents(List<EventQueryCondition> conditionList) throws Exception {
- List<WhereQueryImpl<SelectQueryImpl>> whereQueries = buildWhereQueries(conditionList.get(0));
-
- buildQueryByCondition(whereQueries, conditionList);
-
- List<QueryResult.Result> results = execute(whereQueries.get(0), whereQueries.get(1));
-
- return buildEventsByQueryResult(results);
- }
-
- protected org.apache.skywalking.oap.server.core.query.type.event.Event parseSeriesValues(final QueryResult.Series series, final List<Object> values) {
- final org.apache.skywalking.oap.server.core.query.type.event.Event event = new org.apache.skywalking.oap.server.core.query.type.event.Event();
-
- final List<String> columns = series.getColumns();
- final Map<String, Object> data = new HashMap<>();
-
- for (int i = 1; i < columns.size(); i++) {
- Object value = values.get(i);
- if (value instanceof StorageDataComplexObject) {
- value = ((StorageDataComplexObject) value).toStorageData();
- }
- data.put(columns.get(i), value);
- }
- event.setUuid((String) data.get(Event.UUID));
-
- final String service = (String) data.get(Event.SERVICE);
- final String serviceInstance = (String) data.get(Event.SERVICE_INSTANCE);
- final String endpoint = (String) data.get(Event.ENDPOINT);
-
- event.setSource(new Source(service, serviceInstance, endpoint));
- event.setName((String) data.get(Event.NAME));
- event.setType(EventType.parse((String) data.get(Event.TYPE)));
- event.setMessage((String) data.get(Event.MESSAGE));
- event.setParameters((String) data.get(Event.PARAMETERS));
- event.setStartTime(((Number) data.get(Event.START_TIME)).longValue());
- event.setEndTime(((Number) data.get(Event.END_TIME)).longValue());
- event.setLayer(Layer.valueOf(((Number) data.get(Event.LAYER)).intValue()).name());
-
- return event;
- }
-
- protected List<WhereQueryImpl<SelectQueryImpl>> buildWhereQueries(final EventQueryCondition condition) {
- List<WhereQueryImpl<SelectQueryImpl>> queries = new ArrayList<>(2);
-
- final PaginationUtils.Page page = PaginationUtils.INSTANCE.exchange(condition.getPaging());
- final String topFunc = Order.DES.equals(condition.getOrder()) ? InfluxConstants.SORT_DES : InfluxConstants.SORT_ASC;
- final WhereQueryImpl<SelectQueryImpl> recallWhereQuery =
- select().raw(ALL_FIELDS)
- .function(topFunc, Event.START_TIME, page.getLimit() + page.getFrom())
- .from(client.getDatabase(), Event.INDEX_NAME)
- .where();
- final SelectQueryImpl countQuery = select().count(Event.UUID).from(client.getDatabase(), Event.INDEX_NAME);
- final WhereQueryImpl<SelectQueryImpl> countWhereQuery = countQuery.where();
- queries.add(countWhereQuery);
- queries.add(recallWhereQuery);
- return queries;
- }
-
- protected void buildQueryByCondition(List<WhereQueryImpl<SelectQueryImpl>> queries, EventQueryCondition condition) {
- WhereQueryImpl<SelectQueryImpl> countWhereQuery = queries.get(0);
- WhereQueryImpl<SelectQueryImpl> recallWhereQuery = queries.get(1);
- if (!isNullOrEmpty(condition.getUuid())) {
- recallWhereQuery.and(eq(Event.UUID, condition.getUuid()));
- countWhereQuery.and(eq(Event.UUID, condition.getUuid()));
- }
-
- final Source source = condition.getSource();
- if (source != null) {
- if (!isNullOrEmpty(source.getService())) {
- recallWhereQuery.and(eq(Event.SERVICE, source.getService()));
- countWhereQuery.and(eq(Event.SERVICE, source.getService()));
- }
- if (!isNullOrEmpty(source.getServiceInstance())) {
- recallWhereQuery.and(eq(Event.SERVICE_INSTANCE, source.getServiceInstance()));
- countWhereQuery.and(eq(Event.SERVICE_INSTANCE, source.getServiceInstance()));
- }
- if (!isNullOrEmpty(source.getEndpoint())) {
- recallWhereQuery.and(contains(Event.ENDPOINT, source.getEndpoint().replaceAll("/", "\\\\/")));
- countWhereQuery.and(contains(Event.ENDPOINT, source.getEndpoint().replaceAll("/", "\\\\/")));
- }
- }
-
- if (!isNullOrEmpty(condition.getName())) {
- recallWhereQuery.and(eq(InfluxConstants.NAME, condition.getName()));
- countWhereQuery.and(eq(InfluxConstants.NAME, condition.getName()));
- }
-
- if (condition.getType() != null) {
- recallWhereQuery.and(eq(Event.TYPE, condition.getType().name()));
- countWhereQuery.and(eq(Event.TYPE, condition.getType().name()));
- }
-
- final Duration startTime = condition.getTime();
- if (startTime != null) {
- if (startTime.getStartTimestamp() > 0) {
- recallWhereQuery.and(gt(Event.START_TIME, startTime.getStartTimestamp()));
- countWhereQuery.and(gt(Event.START_TIME, startTime.getStartTimestamp()));
- }
- if (startTime.getEndTimestamp() > 0) {
- recallWhereQuery.and(lt(Event.END_TIME, startTime.getEndTimestamp()));
- countWhereQuery.and(lt(Event.END_TIME, startTime.getEndTimestamp()));
- }
- }
-
- if (!isNullOrEmpty(condition.getLayer())) {
- recallWhereQuery.and(eq(InfluxConstants.TagName.LAYER, condition.getLayer()));
- countWhereQuery.and(eq(InfluxConstants.TagName.LAYER, condition.getLayer()));
- }
- }
-
- protected void buildQueryByCondition(List<WhereQueryImpl<SelectQueryImpl>> queries, List<EventQueryCondition> conditions) {
- WhereQueryImpl<SelectQueryImpl> countWhereQuery = queries.get(0);
- WhereQueryImpl<SelectQueryImpl> recallWhereQuery = queries.get(1);
- conditions.stream().forEach(c -> {
- WhereNested<WhereQueryImpl<SelectQueryImpl>> recallOrNested = recallWhereQuery.orNested();
- WhereNested<WhereQueryImpl<SelectQueryImpl>> countOrNested = countWhereQuery.orNested();
- // by current condition, we should not have uuid. If one day you need to use UUIDs as the query condition, this might be applied.
- if (!isNullOrEmpty(c.getUuid())) {
- recallWhereQuery.and(eq(Event.UUID, c.getUuid()));
- countWhereQuery.and(eq(Event.UUID, c.getUuid()));
- }
-
- final Source source = c.getSource();
- if (source != null) {
- if (!isNullOrEmpty(source.getService())) {
- recallOrNested.and(eq(Event.SERVICE, source.getService()));
- countOrNested.and(eq(Event.SERVICE, source.getService()));
- }
- if (!isNullOrEmpty(source.getServiceInstance())) {
- recallOrNested.and(eq(Event.SERVICE_INSTANCE, source.getServiceInstance()));
- countOrNested.and(eq(Event.SERVICE_INSTANCE, source.getServiceInstance()));
- }
- if (!isNullOrEmpty(source.getEndpoint())) {
- recallOrNested.and(contains(Event.ENDPOINT, source.getEndpoint().replaceAll("/", "\\\\/")));
- countOrNested.and(contains(Event.ENDPOINT, source.getEndpoint().replaceAll("/", "\\\\/")));
- }
- }
-
- if (!isNullOrEmpty(c.getName())) {
- recallOrNested.and(eq(InfluxConstants.NAME, c.getName()));
- countOrNested.and(eq(InfluxConstants.NAME, c.getName()));
- }
-
- if (c.getType() != null) {
- recallOrNested.and(eq(Event.TYPE, c.getType().name()));
- countOrNested.and(eq(Event.TYPE, c.getType().name()));
- }
-
- final Duration startTime = c.getTime();
- if (startTime != null) {
- if (startTime.getStartTimestamp() > 0) {
- recallOrNested.and(gt(Event.START_TIME, startTime.getStartTimestamp()));
- countOrNested.and(gt(Event.START_TIME, startTime.getStartTimestamp()));
- }
- if (startTime.getEndTimestamp() > 0) {
- recallOrNested.and(lt(Event.END_TIME, startTime.getEndTimestamp()));
- countOrNested.and(lt(Event.END_TIME, startTime.getEndTimestamp()));
- }
- }
-
- if (!isNullOrEmpty(c.getLayer())) {
- recallOrNested.and(eq(InfluxConstants.TagName.LAYER, c.getLayer()));
- countOrNested.and(eq(InfluxConstants.TagName.LAYER, c.getLayer()));
- }
-
- recallOrNested.close();
- countOrNested.close();
- });
- }
-
- protected List<QueryResult.Result> execute(WhereQueryImpl<SelectQueryImpl> countWhereQuery, WhereQueryImpl<SelectQueryImpl> recallWhereQuery) throws IOException {
- final Query query = new Query(countWhereQuery.getCommand() + recallWhereQuery.getCommand());
- final List<QueryResult.Result> results = client.query(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}", query.getCommand());
- log.debug("Result: {}", results);
- }
- if (results.size() != 2) {
- throw new IOException("Expecting to get 2 Results, but it is " + results.size());
- }
- return results;
- }
-
- protected Events buildEventsByQueryResult(List<QueryResult.Result> results) {
- final QueryResult.Series counterSeries = results.get(0).getSeries().get(0);
- final List<QueryResult.Series> recallSeries = results.get(1).getSeries();
-
- final Events events = new Events();
- events.setTotal(((Number) counterSeries.getValues().get(0).get(1)).longValue());
-
- recallSeries.forEach(
- series -> series.getValues().forEach(
- values -> events.getEvents().add(parseSeriesValues(series, values))
- )
- );
- return events;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/LogQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/LogQuery.java
deleted file mode 100644
index c9221989f6..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/LogQuery.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Maps;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.log.LogRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.Tag;
-import org.apache.skywalking.oap.server.core.query.enumeration.Order;
-import org.apache.skywalking.oap.server.core.query.input.TraceScopeCondition;
-import org.apache.skywalking.oap.server.core.query.type.ContentType;
-import org.apache.skywalking.oap.server.core.query.type.Log;
-import org.apache.skywalking.oap.server.core.query.type.Logs;
-import org.apache.skywalking.oap.server.core.storage.query.ILogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageDataComplexObject;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereNested;
-import org.influxdb.querybuilder.WhereQueryImpl;
-import org.influxdb.querybuilder.clauses.ConjunctionClause;
-
-import static java.util.Objects.nonNull;
-import static org.apache.skywalking.oap.server.library.util.StringUtil.isNotEmpty;
-import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.ENDPOINT_ID;
-import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.SERVICE_ID;
-import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.SERVICE_INSTANCE_ID;
-import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.SPAN_ID;
-import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.TRACE_ID;
-import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.TRACE_SEGMENT_ID;
-import static org.apache.skywalking.oap.server.core.browser.manual.errorlog.BrowserErrorLogRecord.TIMESTAMP;
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.ALL_FIELDS;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.contains;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class LogQuery implements ILogQueryDAO {
- private final InfluxClient client;
-
- public LogQuery(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public Logs queryLogs(final String serviceId,
- final String serviceInstanceId,
- final String endpointId,
- final TraceScopeCondition relatedTrace,
- final Order queryOrder,
- final int from,
- final int limit,
- final long startTB,
- final long endTB,
- final List<Tag> tags,
- final List<String> keywordsOfContent,
- final List<String> excludingKeywordsOfContent) throws IOException {
- WhereQueryImpl<SelectQueryImpl> recallQuery = select().raw(ALL_FIELDS)
- .function(
- Order.DES.equals(
- queryOrder) ? InfluxConstants.SORT_DES : InfluxConstants.SORT_ASC,
- AbstractLogRecord.TIMESTAMP, limit + from
- )
- .from(client.getDatabase(), LogRecord.INDEX_NAME)
- .where();
-
- if (isNotEmpty(serviceId)) {
- recallQuery.and(eq(InfluxConstants.TagName.SERVICE_ID, serviceId));
- }
- if (isNotEmpty(serviceInstanceId)) {
- recallQuery.and(eq(SERVICE_INSTANCE_ID, serviceInstanceId));
- }
- if (isNotEmpty(endpointId)) {
- recallQuery.and(eq(ENDPOINT_ID, endpointId));
- }
- if (nonNull(relatedTrace)) {
- if (isNotEmpty(relatedTrace.getTraceId())) {
- recallQuery.and(eq(TRACE_ID, relatedTrace.getTraceId()));
- }
- if (isNotEmpty(relatedTrace.getSegmentId())) {
- recallQuery.and(eq(TRACE_SEGMENT_ID, relatedTrace.getSegmentId()));
- }
- if (nonNull(relatedTrace.getSpanId())) {
- recallQuery.and(eq(SPAN_ID, relatedTrace.getSpanId()));
- }
- }
- if (startTB != 0 && endTB != 0) {
- recallQuery.and(gte(AbstractLogRecord.TIME_BUCKET, startTB))
- .and(lte(AbstractLogRecord.TIME_BUCKET, endTB));
- }
-
- if (CollectionUtils.isNotEmpty(tags)) {
- WhereNested<WhereQueryImpl<SelectQueryImpl>> nested = recallQuery.andNested();
- for (final Tag tag : tags) {
- nested.and(contains(tag.getKey(), "'" + tag.getValue() + "'"));
- }
- nested.close();
- }
-
- SelectQueryImpl countQuery = select().count(SERVICE_ID).from(client.getDatabase(), LogRecord.INDEX_NAME);
- for (ConjunctionClause clause : recallQuery.getClauses()) {
- countQuery.where(clause);
- }
-
- Query query = new Query(countQuery.getCommand() + recallQuery.getCommand());
- List<QueryResult.Result> results = client.query(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} \nresult set: {}", query.getCommand(), results);
- }
- if (results.size() != 2) {
- throw new IOException("Expecting to get 2 Results, but it is " + results.size());
- }
-
- final Logs logs = new Logs();
- QueryResult.Result counter = results.get(0);
- QueryResult.Result seriesList = results.get(1);
-
- logs.setTotal(((Number) counter.getSeries().get(0).getValues().get(0).get(1)).intValue());
- seriesList.getSeries().forEach(series -> {
- final List<String> columns = series.getColumns();
-
- series.getValues().forEach(values -> {
- Map<String, Object> data = Maps.newHashMap();
- Log log = new Log();
-
- for (int i = 1; i < columns.size(); i++) {
- Object value = values.get(i);
- if (value instanceof StorageDataComplexObject) {
- value = ((StorageDataComplexObject) value).toStorageData();
- }
- data.put(columns.get(i), value);
- }
- log.setServiceId((String) data.get(SERVICE_ID));
- log.setServiceInstanceId((String) data.get(SERVICE_INSTANCE_ID));
- log.setEndpointId((String) data.get(ENDPOINT_ID));
- if (log.getEndpointId() != null) {
- log.setEndpointName(IDManager.EndpointID.analysisId(log.getEndpointId()).getEndpointName());
- }
- log.setTraceId((String) data.get(TRACE_ID));
- log.setTimestamp(((Number) data.get(TIMESTAMP)).longValue());
- log.setContentType(
- ContentType.instanceOf(((Number) data.get(AbstractLogRecord.CONTENT_TYPE)).intValue()));
- log.setContent((String) data.get(AbstractLogRecord.CONTENT));
- String dataBinaryBase64 = (String) data.get(AbstractLogRecord.TAGS_RAW_DATA);
- if (!Strings.isNullOrEmpty(dataBinaryBase64)) {
- parserDataBinary(dataBinaryBase64, log.getTags());
- }
- logs.getLogs().add(log);
- });
- });
-
- return logs;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java
deleted file mode 100644
index ca40eb9bb5..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetadataQuery.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.analysis.Layer;
-import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessDetectType;
-import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessTraffic;
-import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
-import org.apache.skywalking.oap.server.core.query.type.Process;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.instance.InstanceTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.service.ServiceTraffic;
-import org.apache.skywalking.oap.server.core.query.enumeration.Language;
-import org.apache.skywalking.oap.server.core.query.type.Attribute;
-import org.apache.skywalking.oap.server.core.query.type.Endpoint;
-import org.apache.skywalking.oap.server.core.query.type.Service;
-import org.apache.skywalking.oap.server.core.query.type.ServiceInstance;
-import org.apache.skywalking.oap.server.core.storage.query.IMetadataQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.SelectSubQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.ID_COLUMN;
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.NAME;
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.TagName;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.contains;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@RequiredArgsConstructor
-@Slf4j
-public class MetadataQuery implements IMetadataQueryDAO {
- private static final Gson GSON = new Gson();
- private final InfluxClient client;
-
- @Override
- public List<Service> listServices(final String layer, final String group) throws IOException {
- final SelectQueryImpl query = select(
- ServiceTraffic.SERVICE_ID, NAME, ServiceTraffic.GROUP, ServiceTraffic.SHORT_NAME, ServiceTraffic.LAYER)
- .from(client.getDatabase(), ServiceTraffic.INDEX_NAME);
- if (StringUtil.isNotEmpty(layer) && StringUtil.isNotEmpty(group)) {
- query.where(eq(TagName.LAYER, String.valueOf(Layer.valueOf(layer).value())))
- .and(eq(TagName.SERVICE_GROUP, group));
- } else if (StringUtil.isNotEmpty(layer) && !StringUtil.isNotEmpty(group)) {
- query.where(eq(TagName.LAYER, String.valueOf(Layer.valueOf(layer).value())));
- } else if (!StringUtil.isNotEmpty(layer) && StringUtil.isNotEmpty(group)) {
- query.where(eq(TagName.SERVICE_GROUP, group));
- }
-
- return buildServices(query);
- }
-
- @Override
- public List<Service> getServices(final String serviceId) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> where = select(
- ServiceTraffic.SERVICE_ID, NAME, ServiceTraffic.GROUP, ServiceTraffic.SHORT_NAME, ServiceTraffic.LAYER)
- .from(client.getDatabase(), ServiceTraffic.INDEX_NAME)
- .where(eq(TagName.SERVICE_ID, serviceId));
- return buildServices(where);
- }
-
- @Override
- public List<ServiceInstance> listInstances(final long startTimestamp,
- final long endTimestamp,
- final String serviceId) throws IOException {
- final long minuteTimeBucket = TimeBucket.getMinuteTimeBucket(startTimestamp);
-
- SelectSubQueryImpl<SelectQueryImpl> subQuery = select()
- .fromSubQuery(client.getDatabase())
- .column(ID_COLUMN).column(NAME).column(InstanceTraffic.PROPERTIES)
- .from(InstanceTraffic.INDEX_NAME)
- .where()
- .and(gte(InstanceTraffic.LAST_PING_TIME_BUCKET, minuteTimeBucket))
- .and(eq(TagName.SERVICE_ID, serviceId))
- .groupBy(TagName.NAME);
-
- SelectQueryImpl query = select().column(ID_COLUMN)
- .column(NAME)
- .column(InstanceTraffic.PROPERTIES)
- .from(client.getDatabase(), InstanceTraffic.INDEX_NAME);
- query.setSubQuery(subQuery);
- return buildInstances(query);
- }
-
- @Override
- public ServiceInstance getInstance(final String instanceId) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> where = select(
- ID_COLUMN, NAME)
- .from(client.getDatabase(), InstanceTraffic.INDEX_NAME)
- .where(eq(TagName.ID_COLUMN, instanceId));
- final List<ServiceInstance> instances = buildInstances(where);
- return instances.size() > 0 ? instances.get(0) : null;
- }
-
- @Override
- public List<Endpoint> findEndpoint(final String keyword,
- final String serviceId,
- final int limit) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> where = select()
- .column(ID_COLUMN)
- .column(NAME)
- .from(client.getDatabase(), EndpointTraffic.INDEX_NAME)
- .where(eq(TagName.SERVICE_ID, String.valueOf(serviceId)));
- if (!Strings.isNullOrEmpty(keyword)) {
- where.and(contains(NAME, keyword.replaceAll("/", "\\\\/")));
- }
- where.limit(limit);
-
- final QueryResult.Series series = client.queryForSingleSeries(where);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}.", where.getCommand(), series);
- }
-
- List<Endpoint> list = new ArrayList<>(limit);
- if (series != null) {
- series.getValues().forEach(values -> {
- Endpoint endpoint = new Endpoint();
- endpoint.setId((String) values.get(1));
- endpoint.setName((String) values.get(2));
- list.add(endpoint);
- });
- }
- return list;
- }
-
- @Override
- public List<Process> listProcesses(String serviceId, String instanceId, String agentId, final ProfilingSupportStatus profilingSupportStatus,
- final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException {
- final SelectQueryImpl query = select(
- ID_COLUMN, NAME, ProcessTraffic.SERVICE_ID, ProcessTraffic.INSTANCE_ID,
- ProcessTraffic.AGENT_ID, ProcessTraffic.DETECT_TYPE, ProcessTraffic.PROPERTIES,
- ProcessTraffic.LABELS_JSON)
- .from(client.getDatabase(), ProcessTraffic.INDEX_NAME);
- appendProcessWhereQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
- lastPingStartTimeBucket, lastPingEndTimeBucket);
- return buildProcesses(query);
- }
-
- @Override
- public long getProcessesCount(String serviceId, String instanceId, String agentId, final ProfilingSupportStatus profilingSupportStatus,
- final long lastPingStartTimeBucket, final long lastPingEndTimeBucket) throws IOException {
- final SelectQueryImpl query = select().count(ID_COLUMN).from(client.getDatabase(), ProcessTraffic.INDEX_NAME);
- appendProcessWhereQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
- lastPingStartTimeBucket, lastPingEndTimeBucket);
-
- List<QueryResult.Result> results = client.query(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), results);
- }
-
- List<QueryResult.Series> counter = results.get(0).getSeries();
- return ((Number) counter.get(0).getValues().get(0).get(1)).longValue();
- }
-
- private void appendProcessWhereQuery(SelectQueryImpl query, String serviceId, String instanceId, String agentId,
- final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
- final long lastPingEndTimeBucket) {
- final WhereQueryImpl<SelectQueryImpl> whereQuery = query.where();
- if (StringUtil.isNotEmpty(serviceId)) {
- whereQuery.and(eq(TagName.SERVICE_ID, serviceId));
- }
- if (StringUtil.isNotEmpty(instanceId)) {
- whereQuery.and(eq(TagName.INSTANCE_ID, instanceId));
- }
- if (StringUtil.isNotEmpty(agentId)) {
- whereQuery.and(eq(TagName.AGENT_ID, agentId));
- }
- if (lastPingStartTimeBucket > 0) {
- whereQuery.and(gte(ProcessTraffic.LAST_PING_TIME_BUCKET, lastPingStartTimeBucket));
- }
- if (lastPingEndTimeBucket > 0) {
- whereQuery.and(lte(ProcessTraffic.LAST_PING_TIME_BUCKET, lastPingEndTimeBucket));
- }
- if (profilingSupportStatus != null) {
- whereQuery.and(eq(ProcessTraffic.PROFILING_SUPPORT_STATUS, profilingSupportStatus.value()));
- }
- }
-
- @Override
- public Process getProcess(String processId) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> where = select(
- ID_COLUMN, NAME, ProcessTraffic.SERVICE_ID, ProcessTraffic.INSTANCE_ID,
- ProcessTraffic.AGENT_ID, ProcessTraffic.DETECT_TYPE, ProcessTraffic.PROPERTIES)
- .from(client.getDatabase(), ProcessTraffic.INDEX_NAME)
- .where(eq(ID_COLUMN, processId));
- final List<Process> processes = buildProcesses(where);
- return processes.size() > 0 ? processes.get(0) : null;
- }
-
- private List<Service> buildServices(Query query) throws IOException {
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), series);
- }
-
- if (Objects.isNull(series)) {
- return Collections.emptyList();
- }
-
- List<Service> services = new ArrayList<>();
- if (Objects.nonNull(series)) {
- for (List<Object> values : series.getValues()) {
- String serviceName = (String) values.get(1);
- Service service = new Service();
- service.setId((String) values.get(1));
- service.setName((String) values.get(2));
- service.setGroup((String) values.get(3));
- service.setShortName((String) values.get(4));
- service.getLayers().add(Layer.valueOf((int) values.get(5)).name());
- services.add(service);
- }
- }
- return services;
- }
-
- private List<ServiceInstance> buildInstances(Query query) throws IOException {
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), series);
- }
- if (Objects.isNull(series)) {
- return Collections.emptyList();
- }
-
- List<List<Object>> result = series.getValues();
- List<ServiceInstance> instances = Lists.newArrayList();
- for (List<Object> values : result) {
- ServiceInstance serviceInstance = new ServiceInstance();
-
- serviceInstance.setId((String) values.get(1));
- serviceInstance.setName((String) values.get(2));
- serviceInstance.setInstanceUUID(serviceInstance.getId());
-
- String propertiesString = (String) values.get(3);
- if (!Strings.isNullOrEmpty(propertiesString)) {
- JsonObject properties = GSON.fromJson(propertiesString, JsonObject.class);
- for (Map.Entry<String, JsonElement> property : properties.entrySet()) {
- String key = property.getKey();
- String value = property.getValue().getAsString();
- if (key.equals(InstanceTraffic.PropertyUtil.LANGUAGE)) {
- serviceInstance.setLanguage(Language.value(value));
- } else {
- serviceInstance.getAttributes().add(new Attribute(key, value));
- }
-
- }
- } else {
- serviceInstance.setLanguage(Language.UNKNOWN);
- }
- instances.add(serviceInstance);
- }
- return instances;
- }
-
- private List<Process> buildProcesses(Query query) throws IOException {
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), series);
- }
- if (Objects.isNull(series)) {
- return Collections.emptyList();
- }
-
- List<List<Object>> result = series.getValues();
- List<Process> instances = Lists.newArrayList();
- for (List<Object> values : result) {
- Process process = new Process();
-
- process.setId((String) values.get(1));
- process.setName((String) values.get(2));
- String serviceId = (String) values.get(3);
- process.setServiceId(serviceId);
- process.setServiceName(IDManager.ServiceID.analysisId(serviceId).getName());
- String instanceId = (String) values.get(4);
- process.setInstanceId(instanceId);
- process.setInstanceName(IDManager.ServiceInstanceID.analysisId(instanceId).getName());
- process.setAgentId((String) values.get(5));
- process.setDetectType(ProcessDetectType.valueOf((Integer) values.get(6)).name());
-
- String propertiesString = (String) values.get(7);
- if (!Strings.isNullOrEmpty(propertiesString)) {
- JsonObject properties = GSON.fromJson(propertiesString, JsonObject.class);
- for (Map.Entry<String, JsonElement> property : properties.entrySet()) {
- String key = property.getKey();
- String value = property.getValue().getAsString();
- process.getAttributes().add(new Attribute(key, value));
- }
- }
- String labelJson = (String) values.get(8);
- if (!Strings.isNullOrEmpty(labelJson)) {
- List<String> labels = GSON.<List<String>>fromJson(labelJson, ArrayList.class);
- process.getLabels().addAll(labels);
- }
- instances.add(process);
- }
- return instances;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetricsQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetricsQuery.java
deleted file mode 100644
index 70de0113a5..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/MetricsQuery.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.base.Joiner;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.metrics.DataTable;
-import org.apache.skywalking.oap.server.core.query.PointOfTime;
-import org.apache.skywalking.oap.server.core.query.input.Duration;
-import org.apache.skywalking.oap.server.core.query.input.MetricsCondition;
-import org.apache.skywalking.oap.server.core.query.sql.Function;
-import org.apache.skywalking.oap.server.core.query.type.HeatMap;
-import org.apache.skywalking.oap.server.core.query.type.IntValues;
-import org.apache.skywalking.oap.server.core.query.type.KVInt;
-import org.apache.skywalking.oap.server.core.query.type.MetricsValues;
-import org.apache.skywalking.oap.server.core.storage.annotation.ValueColumnMetadata;
-import org.apache.skywalking.oap.server.core.storage.query.IMetricsQueryDAO;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.SelectionQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants.ID_COLUMN;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.contains;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class MetricsQuery implements IMetricsQueryDAO {
- private final InfluxClient client;
-
- public MetricsQuery(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public long readMetricsValue(final MetricsCondition condition,
- final String valueColumnName,
- final Duration duration) throws IOException {
- final int defaultValue = ValueColumnMetadata.INSTANCE.getDefaultValue(condition.getName());
- final Function function = ValueColumnMetadata.INSTANCE.getValueFunction(condition.getName());
- if (function == Function.Latest) {
- return readMetricsValues(condition, valueColumnName, duration).getValues().latestValue(defaultValue);
- }
- final String measurement = condition.getName();
-
- final SelectionQueryImpl query = select();
- if (function == Function.Avg) {
- query.mean(valueColumnName);
- } else {
- query.sum(valueColumnName);
- }
- final WhereQueryImpl<SelectQueryImpl> queryWhereQuery = query.from(client.getDatabase(), measurement).where();
-
- final String entityId = condition.getEntity().buildId();
- if (entityId != null) {
- queryWhereQuery.and(eq(InfluxConstants.TagName.ENTITY_ID, entityId));
- }
-
- queryWhereQuery
- .and(gte(InfluxClient.TIME, InfluxClient.timeIntervalTS(duration.getStartTimestamp())))
- .and(lte(InfluxClient.TIME, InfluxClient.timeIntervalTS(duration.getEndTimestamp())))
- .groupBy(InfluxConstants.TagName.ENTITY_ID);
-
- final List<QueryResult.Series> seriesList = client.queryForSeries(queryWhereQuery);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", queryWhereQuery.getCommand(), seriesList);
- }
- if (CollectionUtils.isNotEmpty(seriesList)) {
- for (QueryResult.Series series : seriesList) {
- Number value = (Number) series.getValues().get(0).get(1);
- return value.longValue();
- }
- }
-
- return defaultValue;
- }
-
- @Override
- public MetricsValues readMetricsValues(final MetricsCondition condition,
- final String valueColumnName,
- final Duration duration) throws IOException {
- final List<PointOfTime> pointOfTimes = duration.assembleDurationPoints();
- final List<String> ids = new ArrayList<>(pointOfTimes.size());
- pointOfTimes.forEach(pointOfTime -> ids.add(pointOfTime.id(condition.getEntity().buildId())));
-
- final WhereQueryImpl<SelectQueryImpl> query = select()
- .column(ID_COLUMN)
- .column(valueColumnName)
- .from(client.getDatabase(), condition.getName())
- .where();
-
- if (CollectionUtils.isNotEmpty(ids)) {
- if (ids.size() == 1) {
- query.where(eq(ID_COLUMN, ids.get(0)));
- } else {
- query.where(contains(ID_COLUMN, Joiner.on("|").join(ids)));
- }
- }
- List<QueryResult.Series> seriesList = client.queryForSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), seriesList);
- }
-
- MetricsValues metricsValues = new MetricsValues();
- // Label is null, because in readMetricsValues, no label parameter.
- final IntValues intValues = metricsValues.getValues();
-
- if (CollectionUtils.isNotEmpty(seriesList)) {
- seriesList.get(0).getValues().forEach(values -> {
- KVInt kv = new KVInt();
- kv.setValue(((Number) values.get(2)).longValue());
- kv.setId((String) values.get(1));
- intValues.addKVInt(kv);
- });
- }
- metricsValues.setValues(
- Util.sortValues(intValues, ids, ValueColumnMetadata.INSTANCE.getDefaultValue(condition.getName()))
- );
- return metricsValues;
- }
-
- @Override
- public List<MetricsValues> readLabeledMetricsValues(final MetricsCondition condition,
- final String valueColumnName,
- final List<String> labels,
- final Duration duration) throws IOException {
- final List<PointOfTime> pointOfTimes = duration.assembleDurationPoints();
- final List<String> ids = new ArrayList<>(pointOfTimes.size());
- pointOfTimes.forEach(pointOfTime -> ids.add(pointOfTime.id(condition.getEntity().buildId())));
-
- final WhereQueryImpl<SelectQueryImpl> query = select()
- .column(ID_COLUMN)
- .column(valueColumnName)
- .from(client.getDatabase(), condition.getName())
- .where();
-
- if (CollectionUtils.isNotEmpty(ids)) {
- if (ids.size() == 1) {
- query.where(eq(ID_COLUMN, ids.get(0)));
- } else {
- query.where(contains(ID_COLUMN, Joiner.on("|").join(ids)));
- }
- }
- final List<QueryResult.Series> series = client.queryForSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
-
- final Map<String, DataTable> idMap = new HashMap<>();
- if (!CollectionUtils.isEmpty(series)) {
- series.get(0).getValues().forEach(values -> {
- final String id = (String) values.get(1);
- DataTable multipleValues = new DataTable(5);
- multipleValues.toObject((String) values.get(2));
- idMap.put(id, multipleValues);
- });
- }
- return Util.composeLabelValue(condition, labels, ids, idMap);
- }
-
- @Override
- public HeatMap readHeatMap(final MetricsCondition condition,
- final String valueColumnName,
- final Duration duration) throws IOException {
- final List<PointOfTime> pointOfTimes = duration.assembleDurationPoints();
- final List<String> ids = new ArrayList<>(pointOfTimes.size());
- pointOfTimes.forEach(pointOfTime -> ids.add(pointOfTime.id(condition.getEntity().buildId())));
-
- final WhereQueryImpl<SelectQueryImpl> query = select()
- .column(ID_COLUMN)
- .column(valueColumnName)
- .from(client.getDatabase(), condition.getName())
- .where(contains(ID_COLUMN, Joiner.on("|").join(ids)));
-
- final QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
-
- final int defaultValue = ValueColumnMetadata.INSTANCE.getDefaultValue(condition.getName());
-
- final HeatMap heatMap = new HeatMap();
- if (series != null) {
- for (List<Object> values : series.getValues()) {
- heatMap.buildColumn(values.get(1).toString(), values.get(2).toString(), defaultValue);
- }
- }
-
- heatMap.fixMissingColumns(ids, defaultValue);
- return heatMap;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/NetworkAddressAliasDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/NetworkAddressAliasDAO.java
deleted file mode 100644
index d26d8c8249..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/NetworkAddressAliasDAO.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.collect.Maps;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.manual.networkalias.NetworkAddressAlias;
-import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressAliasDAO;
-import org.apache.skywalking.oap.server.core.storage.type.HashMapConverter;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.TableMetaInfo;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class NetworkAddressAliasDAO implements INetworkAddressAliasDAO {
- private final NetworkAddressAlias.Builder builder = new NetworkAddressAlias.Builder();
- private final InfluxClient client;
-
- public NetworkAddressAliasDAO(final InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public List<NetworkAddressAlias> loadLastUpdate(final long timeBucket) {
- List<NetworkAddressAlias> networkAddressAliases = new ArrayList<>();
-
- WhereQueryImpl<SelectQueryImpl> query = select().raw(InfluxConstants.ALL_FIELDS)
- .from(client.getDatabase(), NetworkAddressAlias.INDEX_NAME)
- .where(gte(
- NetworkAddressAlias.LAST_UPDATE_TIME_BUCKET,
- timeBucket
- ));
- try {
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), series);
- }
- if (Objects.isNull(series)) {
- return networkAddressAliases;
- }
-
- List<List<Object>> result = series.getValues();
- List<String> columns = series.getColumns();
-
- Map<String, String> columnAndFieldMap = TableMetaInfo.get(NetworkAddressAlias.INDEX_NAME)
- .getStorageAndColumnMap();
- for (List<Object> values : result) {
- Map<String, Object> map = Maps.newHashMap();
- for (int i = 1; i < columns.size(); i++) {
- map.put(columnAndFieldMap.get(columns.get(i)), values.get(i));
- }
- networkAddressAliases.add(builder.storage2Entity(new HashMapConverter.ToEntity(map)));
- }
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- }
-
- return networkAddressAliases;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ProfileTaskLogQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ProfileTaskLogQuery.java
deleted file mode 100644
index 239406d600..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ProfileTaskLogQuery.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.collect.Lists;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.profiling.trace.ProfileTaskLogRecord;
-import org.apache.skywalking.oap.server.core.query.type.ProfileTaskLog;
-import org.apache.skywalking.oap.server.core.query.type.ProfileTaskLogOperationType;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileTaskLogQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class ProfileTaskLogQuery implements IProfileTaskLogQueryDAO {
- private final InfluxClient client;
- private final int fetchTaskLogMaxSize;
-
- public ProfileTaskLogQuery(InfluxClient client, int fetchTaskLogMaxSize) {
- this.client = client;
- this.fetchTaskLogMaxSize = fetchTaskLogMaxSize;
- }
-
- @Override
- public List<ProfileTaskLog> getTaskLogList() throws IOException {
- WhereQueryImpl<SelectQueryImpl> query = select()
- .function(InfluxConstants.SORT_DES, ProfileTaskLogRecord.OPERATION_TIME, fetchTaskLogMaxSize)
- .column(InfluxConstants.ID_COLUMN)
- .column(ProfileTaskLogRecord.TASK_ID)
- .column(ProfileTaskLogRecord.INSTANCE_ID)
- .column(ProfileTaskLogRecord.OPERATION_TIME)
- .column(ProfileTaskLogRecord.OPERATION_TYPE)
- .from(client.getDatabase(), ProfileTaskLogRecord.INDEX_NAME)
- .where();
-
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
- if (series == null) {
- return Collections.emptyList();
- }
- final List<ProfileTaskLog> taskLogs = Lists.newArrayList();
- series.getValues().stream()
- // re-sort by self, because of the result order by time.
- .sorted((a, b) -> Long.compare(((Number) b.get(1)).longValue(), ((Number) a.get(1)).longValue()))
- .forEach(values -> taskLogs.add(ProfileTaskLog.builder()
- .id((String) values.get(2))
- .taskId((String) values.get(3))
- .instanceId((String) values.get(4))
- .operationTime(((Number) values.get(5)).longValue())
- .operationType(ProfileTaskLogOperationType.parse(
- ((Number) values.get(6)).intValue()))
- .build()));
- return taskLogs;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ProfileTaskQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ProfileTaskQuery.java
deleted file mode 100644
index faafdae7e2..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ProfileTaskQuery.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.collect.Lists;
-import java.io.IOException;
-import java.util.List;
-import java.util.Objects;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.core.profiling.trace.ProfileTaskRecord;
-import org.apache.skywalking.oap.server.core.query.type.ProfileTask;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileTaskQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class ProfileTaskQuery implements IProfileTaskQueryDAO {
- private final InfluxClient client;
-
- public ProfileTaskQuery(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public List<ProfileTask> getTaskList(final String serviceId,
- final String endpointName,
- final Long startTimeBucket,
- final Long endTimeBucket,
- final Integer limit) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> query =
- select(
- InfluxConstants.ID_COLUMN,
- ProfileTaskRecord.SERVICE_ID,
- ProfileTaskRecord.ENDPOINT_NAME,
- ProfileTaskRecord.START_TIME,
- ProfileTaskRecord.CREATE_TIME,
- InfluxConstants.DURATION,
- ProfileTaskRecord.MIN_DURATION_THRESHOLD,
- ProfileTaskRecord.DUMP_PERIOD,
- ProfileTaskRecord.MAX_SAMPLING_COUNT
- )
- .from(client.getDatabase(), ProfileTaskRecord.INDEX_NAME)
- .where();
-
- if (StringUtil.isNotEmpty(serviceId)) {
- query.and(eq(InfluxConstants.TagName.SERVICE_ID, serviceId));
- }
- if (StringUtil.isNotEmpty(endpointName)) {
- query.and(eq(ProfileTaskRecord.ENDPOINT_NAME, endpointName));
- }
- if (Objects.nonNull(startTimeBucket)) {
- query.and(gte(ProfileTaskRecord.TIME_BUCKET, startTimeBucket));
- }
- if (Objects.nonNull(endTimeBucket)) {
- query.and(lte(ProfileTaskRecord.TIME_BUCKET, endTimeBucket));
- }
- if (Objects.nonNull(limit)) {
- query.limit(limit);
- }
-
- final List<ProfileTask> tasks = Lists.newArrayList();
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), series);
- }
- if (series != null) {
- series.getValues().forEach(values -> tasks.add(profileTaskBuilder(values)));
- }
- return tasks;
- }
-
- @Override
- public ProfileTask getById(final String id) throws IOException {
- if (StringUtil.isEmpty(id)) {
- return null;
- }
- final SelectQueryImpl query = select(
- InfluxConstants.ID_COLUMN,
- ProfileTaskRecord.SERVICE_ID,
- ProfileTaskRecord.ENDPOINT_NAME,
- ProfileTaskRecord.START_TIME,
- ProfileTaskRecord.CREATE_TIME,
- InfluxConstants.DURATION,
- ProfileTaskRecord.MIN_DURATION_THRESHOLD,
- ProfileTaskRecord.DUMP_PERIOD,
- ProfileTaskRecord.MAX_SAMPLING_COUNT
- )
- .from(client.getDatabase(), ProfileTaskRecord.INDEX_NAME)
- .where()
- .and(eq(InfluxConstants.ID_COLUMN, id))
- .limit(1);
-
- final QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), series);
- }
- if (Objects.nonNull(series)) {
- return profileTaskBuilder(series.getValues().get(0));
- }
- return null;
- }
-
- private static ProfileTask profileTaskBuilder(List<Object> values) {
- return ProfileTask.builder()
- .id((String) values.get(1))
- .serviceId((String) values.get(2))
- .endpointName((String) values.get(3))
- .startTime(((Number) values.get(4)).longValue())
- .createTime(((Number) values.get(5)).longValue())
- .duration(((Number) values.get(6)).intValue())
- .minDurationThreshold(((Number) values.get(7)).intValue())
- .dumpPeriod(((Number) values.get(8)).intValue())
- .maxSamplingCount(((Number) values.get(9)).intValue())
- .build();
- }
-
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ProfileThreadSnapshotQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ProfileThreadSnapshotQuery.java
deleted file mode 100644
index 866e9aca14..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ProfileThreadSnapshotQuery.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Base64;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord;
-import org.apache.skywalking.oap.server.core.profiling.trace.ProfileThreadSnapshotRecord;
-import org.apache.skywalking.oap.server.core.query.type.BasicTrace;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileThreadSnapshotQueryDAO;
-import org.apache.skywalking.oap.server.library.util.BooleanUtils;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.contains;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class ProfileThreadSnapshotQuery implements IProfileThreadSnapshotQueryDAO {
- private final InfluxClient client;
-
- public ProfileThreadSnapshotQuery(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public List<BasicTrace> queryProfiledSegments(String taskId) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> countQuery = select(ProfileThreadSnapshotRecord.SEGMENT_ID)
- .from(client.getDatabase(), ProfileThreadSnapshotRecord.INDEX_NAME)
- .where();
-
- countQuery.and(eq(ProfileThreadSnapshotRecord.TASK_ID, taskId))
- .and(eq(ProfileThreadSnapshotRecord.SEQUENCE, 0));
-
- final List<String> segments = new ArrayList<>();
- QueryResult.Series series = client.queryForSingleSeries(countQuery);
- if (Objects.isNull(series)) {
- return Collections.emptyList();
- }
- series.getValues().forEach(values -> segments.add((String) values.get(1)));
-
- if (segments.isEmpty()) {
- return Collections.emptyList();
- }
-
- final WhereQueryImpl<SelectQueryImpl> whereQuery = select()
- .function(InfluxConstants.SORT_DES, SegmentRecord.START_TIME, segments.size())
- .column(SegmentRecord.SEGMENT_ID)
- .column(SegmentRecord.START_TIME)
- .column(SegmentRecord.ENDPOINT_ID)
- .column(SegmentRecord.LATENCY)
- .column(SegmentRecord.IS_ERROR)
- .column(SegmentRecord.TRACE_ID)
- .from(client.getDatabase(), SegmentRecord.INDEX_NAME)
- .where();
- whereQuery.and(contains(SegmentRecord.SEGMENT_ID, Joiner.on("|").join(segments)));
-
- ArrayList<BasicTrace> result = Lists.newArrayListWithCapacity(segments.size());
- client.queryForSingleSeries(whereQuery)
- .getValues()
- .stream()
- .sorted((a, b) -> Long.compare(((Number) b.get(1)).longValue(), ((Number) a.get(1)).longValue()))
- .forEach(values -> {
- final BasicTrace basicTrace = new BasicTrace();
-
- basicTrace.setSegmentId((String) values.get(2));
- basicTrace.setStart(String.valueOf(((Number) values.get(3)).longValue()));
- basicTrace.getEndpointNames().add(
- IDManager.EndpointID.analysisId((String) values.get(4)).getEndpointName());
- basicTrace.setDuration(((Number) values.get(5)).intValue());
- basicTrace.setError(BooleanUtils.valueToBoolean(((Number) values.get(6)).intValue()));
- String traceIds = (String) values.get(7);
- basicTrace.getTraceIds().add(traceIds);
-
- result.add(basicTrace);
- });
-
- return result;
- }
-
- @Override
- public int queryMinSequence(String segmentId, long start, long end) throws IOException {
- return querySequenceWithAgg("min", segmentId, start, end);
- }
-
- @Override
- public int queryMaxSequence(String segmentId, long start, long end) throws IOException {
- return querySequenceWithAgg("max", segmentId, start, end);
- }
-
- @Override
- public List<ProfileThreadSnapshotRecord> queryRecords(String segmentId, int minSequence,
- int maxSequence) throws IOException {
- WhereQueryImpl<SelectQueryImpl> whereQuery = select(
- ProfileThreadSnapshotRecord.TASK_ID,
- ProfileThreadSnapshotRecord.SEGMENT_ID,
- ProfileThreadSnapshotRecord.DUMP_TIME,
- ProfileThreadSnapshotRecord.SEQUENCE,
- ProfileThreadSnapshotRecord.STACK_BINARY
- )
- .from(client.getDatabase(), ProfileThreadSnapshotRecord.INDEX_NAME)
- .where(eq(ProfileThreadSnapshotRecord.SEGMENT_ID, segmentId));
-
- whereQuery.and(gte(ProfileThreadSnapshotRecord.SEQUENCE, minSequence))
- .and(lte(ProfileThreadSnapshotRecord.SEQUENCE, maxSequence));
-
- final QueryResult.Series series = client.queryForSingleSeries(whereQuery);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", whereQuery.getCommand(), series);
- }
- if (Objects.isNull(series)) {
- return Collections.emptyList();
- }
- final ArrayList<ProfileThreadSnapshotRecord> result = new ArrayList<>(maxSequence - minSequence);
- series.getValues().forEach(values -> {
- ProfileThreadSnapshotRecord record = new ProfileThreadSnapshotRecord();
-
- record.setTaskId((String) values.get(1));
- record.setSegmentId((String) values.get(2));
- record.setDumpTime(((Number) values.get(3)).longValue());
- record.setSequence(((Number) values.get(4)).intValue());
- String dataBinaryBase64 = String.valueOf(values.get(5));
- if (StringUtil.isNotEmpty(dataBinaryBase64)) {
- record.setStackBinary(Base64.getDecoder().decode(dataBinaryBase64));
- }
-
- result.add(record);
- });
-
- return result;
- }
-
- @Override
- public SegmentRecord getProfiledSegment(String segmentId) throws IOException {
- WhereQueryImpl<SelectQueryImpl> whereQuery = select()
- .column(SegmentRecord.SEGMENT_ID)
- .column(SegmentRecord.TRACE_ID)
- .column(SegmentRecord.SERVICE_ID)
- .column(SegmentRecord.START_TIME)
- .column(SegmentRecord.LATENCY)
- .column(SegmentRecord.IS_ERROR)
- .column(SegmentRecord.DATA_BINARY)
- .from(client.getDatabase(), SegmentRecord.INDEX_NAME)
- .where();
-
- whereQuery.and(eq(SegmentRecord.SEGMENT_ID, segmentId));
- List<QueryResult.Series> series = client.queryForSeries(whereQuery);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", whereQuery.getCommand(), series);
- }
- if (Objects.isNull(series) || series.isEmpty()) {
- return null;
- }
-
- final List<Object> values = series.get(0).getValues().get(0);
- final SegmentRecord segmentRecord = new SegmentRecord();
-
- segmentRecord.setSegmentId((String) values.get(1));
- segmentRecord.setTraceId((String) values.get(2));
- segmentRecord.setServiceId((String) values.get(3));
- segmentRecord.setStartTime(((Number) values.get(4)).longValue());
- segmentRecord.setLatency(((Number) values.get(5)).intValue());
- segmentRecord.setIsError(((Number) values.get(6)).intValue());
-
- final String base64 = (String) values.get(7);
- if (!Strings.isNullOrEmpty(base64)) {
- segmentRecord.setDataBinary(Base64.getDecoder().decode(base64));
- }
-
- return segmentRecord;
- }
-
- private int querySequenceWithAgg(String function, String segmentId, long start, long end) throws IOException {
- WhereQueryImpl<SelectQueryImpl> query = select()
- .function(function, ProfileThreadSnapshotRecord.SEQUENCE)
- .from(client.getDatabase(), ProfileThreadSnapshotRecord.INDEX_NAME)
- .where();
-
- query.and(eq(ProfileThreadSnapshotRecord.SEGMENT_ID, segmentId))
- .and(gte(ProfileThreadSnapshotRecord.DUMP_TIME, start))
- .and(lte(ProfileThreadSnapshotRecord.DUMP_TIME, end));
- return client.getCounter(query);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ServiceLabelQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ServiceLabelQuery.java
deleted file mode 100644
index db0164ef8a..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/ServiceLabelQuery.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.manual.process.ServiceLabelRecord;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IServiceLabelDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-@RequiredArgsConstructor
-public class ServiceLabelQuery implements IServiceLabelDAO {
- private final InfluxClient client;
-
- @Override
- public List<String> queryAllLabels(String serviceId) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> query = select(
- ServiceLabelRecord.LABEL
- )
- .from(client.getDatabase(), ServiceLabelRecord.INDEX_NAME)
- .where();
-
- query.and(eq(ServiceLabelRecord.SERVICE_ID, serviceId));
-
- return parseLabels(query);
- }
-
- private List<String> parseLabels(WhereQueryImpl<SelectQueryImpl> query) throws IOException {
- final QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, result: {}", query.getCommand(), series);
- }
-
- if (Objects.isNull(series)) {
- return Collections.emptyList();
- }
-
- return series.getValues().stream().map(v -> (String) v.get(1)).collect(Collectors.toList());
- }
-}
\ No newline at end of file
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TagAutoCompleteQueryDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TagAutoCompleteQueryDAO.java
deleted file mode 100644
index 96101f3cc3..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TagAutoCompleteQueryDAO.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.TagAutocompleteData;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.TagType;
-import org.apache.skywalking.oap.server.core.storage.query.ITagAutoCompleteQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-@RequiredArgsConstructor
-public class TagAutoCompleteQueryDAO implements ITagAutoCompleteQueryDAO {
- private final InfluxClient client;
-
- @Override
- public Set<String> queryTagAutocompleteKeys(final TagType tagType,
- final long startSecondTB,
- final long endSecondTB) throws IOException {
- WhereQueryImpl<SelectQueryImpl> query = select()
- .function("distinct", TagAutocompleteData.TAG_KEY)
- .from(client.getDatabase(), TagAutocompleteData.INDEX_NAME)
- .where();
- appendTagAutocompleteCondition(tagType, startSecondTB, endSecondTB, query);
-
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
- if (series == null) {
- return Collections.emptySet();
- }
- Set<String> tagKeys = new HashSet<>();
- for (List<Object> values : series.getValues()) {
- String tagKey = (String) values.get(1);
- tagKeys.add(tagKey);
- }
-
- return tagKeys;
- }
-
- @Override
- public Set<String> queryTagAutocompleteValues(final TagType tagType,
- final String tagKey,
- final int limit,
- final long startSecondTB,
- final long endSecondTB) throws IOException {
- WhereQueryImpl<SelectQueryImpl> query = select()
- .column(TagAutocompleteData.TAG_VALUE)
- .from(client.getDatabase(), TagAutocompleteData.INDEX_NAME)
- .where();
- query.limit(limit);
- query.and(eq(TagAutocompleteData.TAG_KEY, tagKey));
- appendTagAutocompleteCondition(tagType, startSecondTB, endSecondTB, query);
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
- if (series == null) {
- return Collections.emptySet();
- }
- Set<String> tagValues = new HashSet<>();
- for (List<Object> values : series.getValues()) {
- String tagValue = (String) values.get(1);
- tagValues.add(tagValue);
- }
-
- return tagValues;
- }
-
- private void appendTagAutocompleteCondition(final TagType tagType,
- final long startSecondTB,
- final long endSecondTB,
- final WhereQueryImpl<SelectQueryImpl> query) {
- query.and(eq(TagAutocompleteData.TAG_TYPE, tagType.name()));
-
- long startTB = startSecondTB / 1000000 * 10000;
- long endTB = endSecondTB / 1000000 * 10000 + 9999;
- if (startTB > 0) {
- query.and(gte(TagAutocompleteData.TIME_BUCKET, startTB));
- }
- if (endTB > 0) {
- query.and(lte(TagAutocompleteData.TIME_BUCKET, endTB));
- }
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopNRecordsQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopNRecordsQuery.java
deleted file mode 100644
index 5767d4ef27..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopNRecordsQuery.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.analysis.topn.TopN;
-import org.apache.skywalking.oap.server.core.query.enumeration.Order;
-import org.apache.skywalking.oap.server.core.query.input.Duration;
-import org.apache.skywalking.oap.server.core.query.input.TopNCondition;
-import org.apache.skywalking.oap.server.core.query.type.SelectedRecord;
-import org.apache.skywalking.oap.server.core.storage.query.ITopNRecordsQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class TopNRecordsQuery implements ITopNRecordsQueryDAO {
- private final InfluxClient client;
-
- public TopNRecordsQuery(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public List<SelectedRecord> readSampledRecords(final TopNCondition condition,
- final String valueColumnName,
- final Duration duration) throws IOException {
- String function = InfluxConstants.SORT_ASC;
- // Have to re-sort here. Because the function, top()/bottom(), get the result ordered by the `time`.
- Comparator<SelectedRecord> comparator = ASCENDING;
- if (condition.getOrder().equals(Order.DES)) {
- function = InfluxConstants.SORT_DES;
- comparator = DESCENDING;
- }
-
- final WhereQueryImpl<SelectQueryImpl> query = select()
- .function(function, valueColumnName, condition.getTopN())
- .column(TopN.STATEMENT)
- .column(TopN.TRACE_ID)
- .from(client.getDatabase(), condition.getName())
- .where();
-
- query.and(gte(TopN.TIME_BUCKET, duration.getStartTimeBucketInSec()))
- .and(lte(TopN.TIME_BUCKET, duration.getEndTimeBucketInSec()));
-
- if (StringUtil.isNotEmpty(condition.getParentService())) {
- final String serviceId = IDManager.ServiceID.buildId(condition.getParentService(), condition.isNormal());
- query.and(eq(InfluxConstants.TagName.SERVICE_ID, serviceId));
- }
-
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
- if (series == null) {
- return Collections.emptyList();
- }
-
- final List<SelectedRecord> records = new ArrayList<>();
- series.getValues().forEach(values -> {
- SelectedRecord record = new SelectedRecord();
- record.setValue(String.valueOf(values.get(1)));
- record.setRefId((String) values.get(3));
- record.setId(record.getRefId());
- record.setName((String) values.get(2));
- records.add(record);
- });
-
- records.sort(comparator); // re-sort by self, because of the result order by time.
- return records;
- }
-
- private static final Comparator<SelectedRecord> ASCENDING = Comparator.comparingLong(
- a -> ((Number) Double.parseDouble(a.getValue())).longValue());
-
- private static final Comparator<SelectedRecord> DESCENDING = (a, b) -> Long.compare(
- ((Number) Double.parseDouble(b.getValue())).longValue(), ((Number) Double.parseDouble(a.getValue())).longValue());
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopologyQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopologyQuery.java
deleted file mode 100644
index fd855da4a3..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopologyQuery.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.endpoint.EndpointRelationServerSideMetrics;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationClientSideMetrics;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationServerSideMetrics;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.service.ServiceRelationClientSideMetrics;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.service.ServiceRelationServerSideMetrics;
-import org.apache.skywalking.oap.server.core.query.type.Call;
-import org.apache.skywalking.oap.server.core.source.DetectPoint;
-import org.apache.skywalking.oap.server.core.storage.query.ITopologyQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.SelectSubQueryImpl;
-import org.influxdb.querybuilder.WhereNested;
-import org.influxdb.querybuilder.WhereSubQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class TopologyQuery implements ITopologyQueryDAO {
- private final InfluxClient client;
-
- public TopologyQuery(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public List<Call.CallDetail> loadServiceRelationsDetectedAtServerSide(final long startTB,
- final long endTB,
- final List<String> serviceIds) throws IOException {
- final String measurement = ServiceRelationServerSideMetrics.INDEX_NAME;
- final WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery = buildServiceCallsQuery(
- measurement,
- startTB,
- endTB,
- ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID,
- ServiceRelationServerSideMetrics.DEST_SERVICE_ID,
- serviceIds
- );
-
- return buildServiceCalls(buildQuery(subQuery), DetectPoint.SERVER);
- }
-
- @Override
- public List<Call.CallDetail> loadServiceRelationDetectedAtClientSide(final long startTB,
- final long endTB,
- List<String> serviceIds) throws IOException {
- final WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery = buildServiceCallsQuery(
- ServiceRelationClientSideMetrics.INDEX_NAME,
- startTB,
- endTB,
- ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID,
- ServiceRelationServerSideMetrics.DEST_SERVICE_ID,
- serviceIds
- );
- return buildServiceCalls(buildQuery(subQuery), DetectPoint.CLIENT);
- }
-
- @Override
- public List<Call.CallDetail> loadServiceRelationsDetectedAtServerSide(final long startTB,
- final long endTB) throws IOException {
- final WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery = buildServiceCallsQuery(
- ServiceRelationServerSideMetrics.INDEX_NAME,
- startTB,
- endTB,
- ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID,
- ServiceRelationServerSideMetrics.DEST_SERVICE_ID,
- new ArrayList<>(0)
- );
- return buildServiceCalls(buildQuery(subQuery), DetectPoint.SERVER);
- }
-
- @Override
- public List<Call.CallDetail> loadServiceRelationDetectedAtClientSide(final long startTB,
- final long endTB) throws IOException {
- WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery = buildServiceCallsQuery(
- ServiceRelationClientSideMetrics.INDEX_NAME,
- startTB,
- endTB,
- ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID,
- ServiceRelationServerSideMetrics.DEST_SERVICE_ID,
- new ArrayList<>(0)
- );
- return buildServiceCalls(buildQuery(subQuery), DetectPoint.CLIENT);
- }
-
- @Override
- public List<Call.CallDetail> loadInstanceRelationDetectedAtServerSide(final String clientServiceId,
- final String serverServiceId,
- final long startTB,
- final long endTB) throws IOException {
- WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery = buildServiceInstanceCallsQuery(
- ServiceInstanceRelationServerSideMetrics.INDEX_NAME,
- startTB,
- endTB,
- ServiceInstanceRelationServerSideMetrics.SOURCE_SERVICE_ID,
- ServiceInstanceRelationServerSideMetrics.DEST_SERVICE_ID,
- clientServiceId, serverServiceId
- );
- return buildInstanceCalls(buildQuery(subQuery), DetectPoint.SERVER);
- }
-
- @Override
- public List<Call.CallDetail> loadInstanceRelationDetectedAtClientSide(final String clientServiceId,
- final String serverServiceId,
- final long startTB,
- final long endTB) throws IOException {
- WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery = buildServiceInstanceCallsQuery(
- ServiceInstanceRelationClientSideMetrics.INDEX_NAME,
- startTB,
- endTB,
- ServiceInstanceRelationClientSideMetrics.SOURCE_SERVICE_ID,
- ServiceInstanceRelationClientSideMetrics.DEST_SERVICE_ID,
- clientServiceId, serverServiceId
- );
- return buildInstanceCalls(buildQuery(subQuery), DetectPoint.CLIENT);
- }
-
- @Override
- public List<Call.CallDetail> loadEndpointRelation(final long startTB,
- final long endTB,
- final String destEndpointId) throws IOException {
- final WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery = buildServiceCallsQuery(
- EndpointRelationServerSideMetrics.INDEX_NAME,
- startTB,
- endTB,
- EndpointRelationServerSideMetrics.SOURCE_ENDPOINT,
- EndpointRelationServerSideMetrics.DEST_ENDPOINT,
- Collections.emptyList()
- );
- subQuery.and(eq(EndpointRelationServerSideMetrics.DEST_ENDPOINT, destEndpointId));
-
- final WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery2 = buildServiceCallsQuery(
- EndpointRelationServerSideMetrics.INDEX_NAME,
- startTB,
- endTB,
- EndpointRelationServerSideMetrics.SOURCE_ENDPOINT,
- EndpointRelationServerSideMetrics.DEST_ENDPOINT,
- Collections.emptyList()
- );
- subQuery2.and(eq(EndpointRelationServerSideMetrics.SOURCE_ENDPOINT, destEndpointId));
-
- return buildEndpointCalls(buildQuery(subQuery), DetectPoint.SERVER);
- }
-
- private WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> buildServiceCallsQuery(
- final String measurement,
- final long startTB,
- final long endTB,
- final String sourceCName,
- final String destCName,
- final List<String> serviceIds) {
-
- final WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery = select()
- .fromSubQuery(client.getDatabase())
- .function("distinct", ServiceInstanceRelationServerSideMetrics.COMPONENT_ID)
- .as(ServiceInstanceRelationClientSideMetrics.COMPONENT_ID)
- .from(measurement)
- .where()
- .and(gte(InfluxClient.TIME, InfluxClient.timeIntervalTB(startTB)))
- .and(lte(InfluxClient.TIME, InfluxClient.timeIntervalTB(endTB)));
-
- if (!serviceIds.isEmpty()) {
- WhereNested<WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl>> whereNested = subQuery
- .andNested();
- for (String id : serviceIds) {
- whereNested.or(eq(sourceCName, id))
- .or(eq(destCName, id));
- }
- whereNested.close();
- }
- return subQuery;
- }
-
- private WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> buildServiceInstanceCallsQuery(
- final String measurement,
- final long startTB,
- final long endTB,
- final String sourceCName,
- final String destCName,
- final String sourceServiceId,
- final String destServiceId) {
-
- final WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery = select()
- .fromSubQuery(client.getDatabase())
- .function("distinct", ServiceInstanceRelationServerSideMetrics.COMPONENT_ID)
- .as(ServiceInstanceRelationClientSideMetrics.COMPONENT_ID)
- .from(measurement)
- .where();
-
- subQuery.and(gte(InfluxClient.TIME, InfluxClient.timeIntervalTB(startTB)))
- .and(lte(InfluxClient.TIME, InfluxClient.timeIntervalTB(endTB)));
-
- final StringBuilder builder = new StringBuilder("((");
- builder.append(sourceCName).append("='").append(sourceServiceId)
- .append("' and ")
- .append(destCName).append("='").append(destServiceId)
- .append("') or (")
- .append(sourceCName).append("='").append(destServiceId)
- .append("') and (")
- .append(destCName).append("='").append(sourceServiceId)
- .append("'))");
- subQuery.where(builder.toString());
- subQuery.groupBy(InfluxConstants.TagName.ENTITY_ID);
- return subQuery;
- }
-
- private List<Call.CallDetail> buildServiceCalls(Query query,
- DetectPoint detectPoint) throws IOException {
- final QueryResult.Series series = client.queryForSingleSeries(query);
-
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
- if (series == null) {
- return Collections.emptyList();
- }
-
- final List<Call.CallDetail> calls = new ArrayList<>();
- series.getValues().forEach(values -> {
- Call.CallDetail call = new Call.CallDetail();
- String entityId = String.valueOf(values.get(1));
- int componentId = ((Number) values.get(2)).intValue();
- call.buildFromServiceRelation(entityId, componentId, detectPoint);
- calls.add(call);
- });
- return calls;
- }
-
- private Query buildQuery(WhereSubQueryImpl<SelectSubQueryImpl<SelectQueryImpl>, SelectQueryImpl> subQuery) {
- SelectQueryImpl query = select().column(InfluxConstants.TagName.ENTITY_ID)
- .column(ServiceInstanceRelationClientSideMetrics.COMPONENT_ID)
- .from(client.getDatabase());
- query.setSubQuery(subQuery.groupBy(InfluxConstants.TagName.ENTITY_ID));
- return query;
- }
-
- private List<Call.CallDetail> buildInstanceCalls(Query query, DetectPoint detectPoint) throws IOException {
- QueryResult.Series series = client.queryForSingleSeries(query);
-
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
- if (series == null) {
- return Collections.emptyList();
- }
-
- List<Call.CallDetail> calls = new ArrayList<>();
- series.getValues().forEach(values -> {
- Call.CallDetail call = new Call.CallDetail();
- String entityId = (String) values.get(1);
- int componentId = ((Number) values.get(2)).intValue();
- call.buildFromInstanceRelation(entityId, componentId, detectPoint);
- calls.add(call);
- });
- return calls;
- }
-
- private List<Call.CallDetail> buildEndpointCalls(Query query,
- DetectPoint detectPoint) throws IOException {
- QueryResult.Series series = client.queryForSingleSeries(query);
-
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), series);
- }
- if (series == null) {
- return Collections.emptyList();
- }
-
- List<Call.CallDetail> calls = new ArrayList<>();
- series.getValues().forEach(values -> {
- Call.CallDetail call = new Call.CallDetail();
- String entityId = (String) values.get(1);
- call.buildFromEndpointRelation(entityId, detectPoint);
- calls.add(call);
- });
- return calls;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TraceQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TraceQuery.java
deleted file mode 100644
index 8b9c490703..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TraceQuery.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import java.io.IOException;
-import java.util.Base64;
-import java.util.Collections;
-import java.util.List;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.Tag;
-import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord;
-import org.apache.skywalking.oap.server.core.query.type.BasicTrace;
-import org.apache.skywalking.oap.server.core.query.type.QueryOrder;
-import org.apache.skywalking.oap.server.core.query.type.Span;
-import org.apache.skywalking.oap.server.core.query.type.TraceBrief;
-import org.apache.skywalking.oap.server.core.query.type.TraceState;
-import org.apache.skywalking.oap.server.core.storage.query.ITraceQueryDAO;
-import org.apache.skywalking.oap.server.library.util.BooleanUtils;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereNested;
-import org.influxdb.querybuilder.WhereQueryImpl;
-import org.influxdb.querybuilder.clauses.Clause;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.contains;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@Slf4j
-public class TraceQuery implements ITraceQueryDAO {
- private final InfluxClient client;
-
- public TraceQuery(InfluxClient client) {
- this.client = client;
- }
-
- @Override
- public TraceBrief queryBasicTraces(long startSecondTB,
- long endSecondTB,
- long minDuration,
- long maxDuration,
- String serviceId,
- String serviceInstanceId,
- String endpointId,
- String traceId,
- int limit,
- int from,
- TraceState traceState,
- QueryOrder queryOrder,
- final List<Tag> tags)
- throws IOException {
-
- String orderBy = SegmentRecord.START_TIME;
- if (queryOrder == QueryOrder.BY_DURATION) {
- orderBy = SegmentRecord.LATENCY;
- }
-
- WhereQueryImpl<SelectQueryImpl> recallQuery = select()
- .function(InfluxConstants.SORT_DES, orderBy, limit + from)
- .column(SegmentRecord.SEGMENT_ID)
- .column(SegmentRecord.START_TIME)
- .column(SegmentRecord.ENDPOINT_ID)
- .column(SegmentRecord.LATENCY)
- .column(SegmentRecord.IS_ERROR)
- .column(SegmentRecord.TRACE_ID)
- .from(client.getDatabase(), SegmentRecord.INDEX_NAME)
- .where();
-
- if (startSecondTB != 0 && endSecondTB != 0) {
- recallQuery.and(gte(SegmentRecord.TIME_BUCKET, startSecondTB))
- .and(lte(SegmentRecord.TIME_BUCKET, endSecondTB));
- }
- if (minDuration != 0) {
- recallQuery.and(gte(SegmentRecord.LATENCY, minDuration));
- }
- if (maxDuration != 0) {
- recallQuery.and(lte(SegmentRecord.LATENCY, maxDuration));
- }
- if (StringUtil.isNotEmpty(serviceId)) {
- recallQuery.and(eq(InfluxConstants.TagName.SERVICE_ID, serviceId));
- }
- if (StringUtil.isNotEmpty(serviceInstanceId)) {
- recallQuery.and(eq(SegmentRecord.SERVICE_INSTANCE_ID, serviceInstanceId));
- }
- if (!com.google.common.base.Strings.isNullOrEmpty(endpointId)) {
- recallQuery.and(eq(SegmentRecord.ENDPOINT_ID, endpointId));
- }
- if (!Strings.isNullOrEmpty(traceId)) {
- recallQuery.and(eq(SegmentRecord.TRACE_ID, traceId));
- }
- switch (traceState) {
- case ERROR:
- recallQuery.and(eq(SegmentRecord.IS_ERROR, BooleanUtils.TRUE));
- break;
- case SUCCESS:
- recallQuery.and(eq(SegmentRecord.IS_ERROR, BooleanUtils.FALSE));
- break;
- default:
- }
- if (CollectionUtils.isNotEmpty(tags)) {
- WhereNested<WhereQueryImpl<SelectQueryImpl>> nested = recallQuery.andNested();
- for (final Tag tag : tags) {
- nested.and(contains(tag.getKey(), "'" + tag.getValue() + "'"));
- }
- nested.close();
- }
-
- WhereQueryImpl<SelectQueryImpl> countQuery = select()
- .count(SegmentRecord.ENDPOINT_ID)
- .from(client.getDatabase(), SegmentRecord.INDEX_NAME)
- .where();
- for (Clause clause : recallQuery.getClauses()) {
- countQuery.where(clause);
- }
- Query query = new Query(countQuery.getCommand() + recallQuery.getCommand());
-
- List<QueryResult.Result> results = client.query(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", query.getCommand(), results);
- }
- if (results.size() != 2) {
- throw new IOException("Expecting to get 2 Results, but it is " + results.size());
- }
- List<QueryResult.Series> counter = results.get(0).getSeries();
- List<QueryResult.Series> result = results.get(1).getSeries();
- if (result == null || result.isEmpty()) {
- return new TraceBrief();
- }
-
- TraceBrief traceBrief = new TraceBrief();
- traceBrief.setTotal(((Number) counter.get(0).getValues().get(0).get(1)).intValue());
-
- result.get(0).getValues().stream().sorted((a, b) -> {
- // Have to re-sort here. Because the function, top()/bottom(), get the result ordered by the `time`.
- return Long.compare(((Number) b.get(1)).longValue(), ((Number) a.get(1)).longValue());
- }).skip(from).forEach(values -> {
- BasicTrace basicTrace = new BasicTrace();
-
- basicTrace.setSegmentId((String) values.get(2));
- basicTrace.setStart(String.valueOf(((Number) values.get(3)).longValue()));
- basicTrace.getEndpointNames()
- .add(IDManager.EndpointID.analysisId((String) values.get(4)).getEndpointName());
- basicTrace.setDuration(((Number) values.get(5)).intValue());
- basicTrace.setError(BooleanUtils.valueToBoolean(((Number) values.get(6)).intValue()));
- basicTrace.getTraceIds().add((String) values.get(7));
-
- traceBrief.getTraces().add(basicTrace);
- });
- return traceBrief;
- }
-
- @Override
- public List<SegmentRecord> queryByTraceId(String traceId) throws IOException {
- WhereQueryImpl<SelectQueryImpl> whereQuery = select().column(SegmentRecord.SEGMENT_ID)
- .column(SegmentRecord.TRACE_ID)
- .column(SegmentRecord.SERVICE_ID)
- .column(SegmentRecord.SERVICE_INSTANCE_ID)
- .column(SegmentRecord.START_TIME)
- .column(SegmentRecord.LATENCY)
- .column(SegmentRecord.IS_ERROR)
- .column(SegmentRecord.DATA_BINARY)
- .from(client.getDatabase(), SegmentRecord.INDEX_NAME)
- .where();
-
- whereQuery.and(eq(SegmentRecord.TRACE_ID, traceId));
- List<QueryResult.Series> series = client.queryForSeries(whereQuery);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result set: {}", whereQuery.getCommand(), series);
- }
- if (series == null || series.isEmpty()) {
- return Collections.emptyList();
- }
- List<SegmentRecord> segmentRecords = Lists.newArrayList();
- series.get(0).getValues().forEach(values -> {
- SegmentRecord segmentRecord = new SegmentRecord();
-
- segmentRecord.setSegmentId((String) values.get(1));
- segmentRecord.setTraceId((String) values.get(2));
- segmentRecord.setServiceId((String) values.get(3));
- segmentRecord.setServiceInstanceId((String) values.get(4));
- segmentRecord.setStartTime(((Number) values.get(5)).longValue());
- segmentRecord.setLatency(((Number) values.get(6)).intValue());
- segmentRecord.setIsError(((Number) values.get(7)).intValue());
-
- String base64 = (String) values.get(8);
- if (!Strings.isNullOrEmpty(base64)) {
- segmentRecord.setDataBinary(Base64.getDecoder().decode(base64));
- }
-
- segmentRecords.add(segmentRecord);
- });
-
- return segmentRecords;
- }
-
- @Override
- public List<Span> doFlexibleTraceQuery(String traceId) {
- return Collections.emptyList();
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/UITemplateManagementDAOImpl.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/UITemplateManagementDAOImpl.java
deleted file mode 100644
index fac060cb74..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/UITemplateManagementDAOImpl.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.influxdb.query;
-
-import com.google.common.collect.Maps;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.management.ui.template.UITemplate;
-import org.apache.skywalking.oap.server.core.query.input.DashboardSetting;
-import org.apache.skywalking.oap.server.core.query.type.DashboardConfiguration;
-import org.apache.skywalking.oap.server.core.query.type.TemplateChangeStatus;
-import org.apache.skywalking.oap.server.core.storage.management.UITemplateManagementDAO;
-import org.apache.skywalking.oap.server.core.storage.type.HashMapConverter;
-import org.apache.skywalking.oap.server.library.util.BooleanUtils;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient;
-import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxConstants;
-import org.influxdb.dto.Point;
-import org.influxdb.dto.QueryResult;
-import org.influxdb.querybuilder.SelectQueryImpl;
-import org.influxdb.querybuilder.WhereQueryImpl;
-
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
-import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select;
-
-@RequiredArgsConstructor
-@Slf4j
-public class UITemplateManagementDAOImpl implements UITemplateManagementDAO {
- private final InfluxClient client;
-
- @Override
- public DashboardConfiguration getTemplate(final String id) throws IOException {
- if (StringUtil.isEmpty(id)) {
- return null;
- }
-
- final SelectQueryImpl query = select().all()
- .from(client.getDatabase(), UITemplate.INDEX_NAME)
- .where(eq(InfluxConstants.TagName.ID_COLUMN, id))
- .limit(1);
-
- final QueryResult.Series series = client.queryForSingleSeries(query);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {} result: {}", query.getCommand(), series);
- }
- final UITemplate.Builder builder = new UITemplate.Builder();
-
- if (Objects.nonNull(series)) {
- List<String> columnNames = series.getColumns();
- List<Object> columnValues = series.getValues().get(0);
-
- Map<String, Object> data = Maps.newHashMap();
- for (int i = 1; i < columnNames.size(); i++) {
- data.put(columnNames.get(i), columnValues.get(i));
- }
- UITemplate uiTemplate = builder.storage2Entity(new HashMapConverter.ToEntity(data));
- return new DashboardConfiguration().fromEntity(uiTemplate);
-
- }
- return null;
- }
-
- @Override
- public List<DashboardConfiguration> getAllTemplates(Boolean includingDisabled) throws IOException {
- final WhereQueryImpl<SelectQueryImpl> where = select().raw("*::field")
- .from(client.getDatabase(), UITemplate.INDEX_NAME)
- .where();
- if (!includingDisabled) {
- where.and(eq(UITemplate.DISABLED, BooleanUtils.booleanToValue(includingDisabled)));
- }
- final QueryResult.Series series = client.queryForSingleSeries(where);
- final List<DashboardConfiguration> configs = new ArrayList<>();
- final UITemplate.Builder builder = new UITemplate.Builder();
- if (Objects.nonNull(series)) {
- List<String> columnNames = series.getColumns();
-
- final int size = series.getValues().size();
- for (int offset = 0; offset < size; offset++) {
- List<Object> columnValues = series.getValues().get(offset);
-
- Map<String, Object> data = Maps.newHashMap();
- for (int i = 1; i < columnNames.size(); i++) {
- data.put(columnNames.get(i), columnValues.get(i));
- }
- UITemplate uiTemplate = builder.storage2Entity(new HashMapConverter.ToEntity(data));
- configs.add(new DashboardConfiguration().fromEntity(uiTemplate));
- }
- }
- return configs;
- }
-
- @Override
- public TemplateChangeStatus addTemplate(final DashboardSetting setting) {
- final UITemplate.Builder builder = new UITemplate.Builder();
- final UITemplate uiTemplate = setting.toEntity();
-
- final HashMapConverter.ToStorage toStorage = new HashMapConverter.ToStorage();
- builder.entity2Storage(uiTemplate, toStorage);
- final Point point = Point.measurement(UITemplate.INDEX_NAME)
- .tag(InfluxConstants.TagName.ID_COLUMN, uiTemplate.id())
- .fields(toStorage.obtain())
- .time(1L, TimeUnit.NANOSECONDS)
- .build();
- client.write(point);
- return TemplateChangeStatus.builder().status(true).id(setting.getId()).build();
- }
-
- @Override
- public TemplateChangeStatus changeTemplate(final DashboardSetting setting) throws IOException {
- final UITemplate.Builder builder = new UITemplate.Builder();
- final UITemplate uiTemplate = setting.toEntity();
-
- WhereQueryImpl<SelectQueryImpl> query = select().all()
- .from(client.getDatabase(), UITemplate.INDEX_NAME)
- .where(eq(InfluxConstants.TagName.ID_COLUMN, uiTemplate.id()));
-
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (Objects.nonNull(series)) {
- final HashMapConverter.ToStorage toStorage = new HashMapConverter.ToStorage();
- builder.entity2Storage(uiTemplate, toStorage);
- final Point point = Point.measurement(UITemplate.INDEX_NAME)
- .fields(toStorage.obtain())
- .tag(InfluxConstants.TagName.ID_COLUMN, uiTemplate.id())
- .time(1L, TimeUnit.NANOSECONDS)
- .build();
- client.write(point);
- return TemplateChangeStatus.builder().status(true).id(setting.getId()).build();
- } else {
- return TemplateChangeStatus.builder()
- .status(false)
- .id(setting.getId())
- .message("Can't find the template")
- .build();
- }
- }
-
- @Override
- public TemplateChangeStatus disableTemplate(final String id) throws IOException {
- WhereQueryImpl<SelectQueryImpl> query = select().all()
- .from(client.getDatabase(), UITemplate.INDEX_NAME)
- .where(eq(InfluxConstants.TagName.ID_COLUMN, id));
- QueryResult.Series series = client.queryForSingleSeries(query);
- if (Objects.nonNull(series)) {
- final Point point = Point.measurement(UITemplate.INDEX_NAME)
- .tag(InfluxConstants.TagName.ID_COLUMN, id)
- .addField(UITemplate.DISABLED, BooleanUtils.TRUE)
- .time(1L, TimeUnit.NANOSECONDS)
- .build();
- client.write(point);
- return TemplateChangeStatus.builder().status(true).id(id).build();
- } else {
- return TemplateChangeStatus.builder().status(false).id(id).message("Can't find the template").build();
- }
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
deleted file mode 100644
index b53b0b0e93..0000000000
--- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/resources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#
-
-org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxStorageProvider
\ No newline at end of file
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/pom.xml b/oap-server/server-storage-plugin/storage-iotdb-plugin/pom.xml
deleted file mode 100644
index 2c79dde94b..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>server-storage-plugin</artifactId>
- <groupId>org.apache.skywalking</groupId>
- <version>9.1.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>storage-iotdb-plugin</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.skywalking</groupId>
- <artifactId>server-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.skywalking</groupId>
- <artifactId>library-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.iotdb</groupId>
- <artifactId>iotdb-session</artifactId>
- <exclusions>
- <exclusion>
- <groupId>net.jpountz.lz4</groupId>
- <artifactId>lz4</artifactId>
- </exclusion>
- <!-- When logback + log4j2 + slf4j co-existed in OAP server classpath at the runtime, -->
- <!-- SkyWalking so11y reported a runtime negative impact about performance. -->
- <!-- Disable this, and use slf4j-log4j instead of. -->
- <!-- Ref original discussion, https://github.com/apache/skywalking/pull/8194 -->
- <exclusion>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.lz4</groupId>
- <artifactId>lz4-java</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBClient.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBClient.java
deleted file mode 100644
index 1c2a0496fb..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBClient.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.iotdb.rpc.IoTDBConnectionException;
-import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.iotdb.rpc.TSStatusCode;
-import org.apache.iotdb.session.pool.SessionDataSetWrapper;
-import org.apache.iotdb.session.pool.SessionPool;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.Field;
-import org.apache.iotdb.tsfile.read.common.RowRecord;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.type.Convert2Entity;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.client.Client;
-import org.apache.skywalking.oap.server.library.client.healthcheck.DelegatedHealthChecker;
-import org.apache.skywalking.oap.server.library.client.healthcheck.HealthCheckable;
-import org.apache.skywalking.oap.server.library.util.HealthChecker;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.base.IoTDBInsertRequest;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBDataConverter;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-public class IoTDBClient implements Client, HealthCheckable {
- private final DelegatedHealthChecker healthChecker = new DelegatedHealthChecker();
- private final IoTDBStorageConfig config;
-
- private SessionPool sessionPool;
- private final String storageGroup;
-
- public static final String DOT = ".";
- public static final String ALIGN_BY_DEVICE = " align by device";
-
- public static final String TIME_BUCKET = "time_bucket";
- public static final String TIME = "Time";
- public static final String TIMESTAMP = "timestamp";
-
- public IoTDBClient(IoTDBStorageConfig config) {
- this.config = config;
- storageGroup = config.getStorageGroup();
- }
-
- @Override
- public void connect() throws IoTDBConnectionException, StatementExecutionException {
- try {
- final int sessionPoolSize = config.getSessionPoolSize() == 0 ?
- Runtime.getRuntime().availableProcessors() * 2 : config.getSessionPoolSize();
- log.info("SessionPool Size: {}", sessionPoolSize);
- sessionPool = new SessionPool(config.getHost(), config.getRpcPort(),
- config.getUsername(), config.getPassword(),
- sessionPoolSize, false, false);
- sessionPool.setStorageGroup(storageGroup);
-
- healthChecker.health();
- } catch (StatementExecutionException e) {
- if (e.getStatusCode() != TSStatusCode.PATH_ALREADY_EXIST_ERROR.getStatusCode()) {
- healthChecker.unHealth(e);
- throw e;
- }
- }
- }
-
- @Override
- public void shutdown() {
- sessionPool.close();
- this.healthChecker.health();
- }
-
- @Override
- public void registerChecker(HealthChecker healthChecker) {
- this.healthChecker.register(healthChecker);
- }
-
- public SessionPool getSessionPool() {
- return sessionPool;
- }
-
- public IoTDBStorageConfig getConfig() {
- return config;
- }
-
- /**
- * Write data to IoTDB
- *
- * @param request an IoTDBInsertRequest
- * @throws IOException IoTDBConnectionException or StatementExecutionException
- */
- public void write(IoTDBInsertRequest request) throws IOException {
- if (log.isDebugEnabled()) {
- log.debug("Writing data to IoTDB: {}", request);
- }
-
- StringBuilder devicePath = new StringBuilder();
- devicePath.append(storageGroup).append(IoTDBClient.DOT).append(request.getModelName());
- try {
- // make an index value as a layer name of the storage path
- // every storage path has a fix order which has been set in IoTDBTableMetaInfo
- if (!request.getIndexes().isEmpty()) {
- request.getIndexValues().forEach(
- value -> devicePath.append(IoTDBClient.DOT)
- .append(IoTDBUtils.indexValue2LayerName(value)));
- }
- sessionPool.insertRecord(devicePath.toString(), request.getTime(),
- request.getMeasurements(), request.getMeasurementTypes(),
- request.getMeasurementValues()
- );
- healthChecker.health();
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- healthChecker.unHealth(e);
- throw new IOException(e);
- }
- }
-
- /**
- * Write a list of data into IoTDB
- *
- * @param requestList a list of IoTDBInsertRequest
- * @throws IOException IoTDBConnectionException or StatementExecutionException
- */
- public void write(List<IoTDBInsertRequest> requestList) throws IOException {
- if (log.isDebugEnabled()) {
- for (IoTDBInsertRequest request : requestList) {
- log.debug("Writing data to IoTDB: {}", request);
- }
- }
-
- List<String> devicePathList = new ArrayList<>();
- List<Long> timeList = new ArrayList<>();
- List<List<String>> timeseriesListList = new ArrayList<>();
- List<List<TSDataType>> typesList = new ArrayList<>();
- List<List<Object>> valuesList = new ArrayList<>();
-
- requestList.forEach(request -> {
- StringBuilder devicePath = new StringBuilder();
- devicePath.append(storageGroup).append(IoTDBClient.DOT).append(request.getModelName());
- // make an index value as a layer name of the storage path
- if (!request.getIndexes().isEmpty()) {
- request.getIndexValues().forEach(
- value -> devicePath.append(IoTDBClient.DOT)
- .append(IoTDBUtils.indexValue2LayerName(value)));
- }
- devicePathList.add(devicePath.toString());
- timeList.add(request.getTime());
- timeseriesListList.add(request.getMeasurements());
- typesList.add(request.getMeasurementTypes());
- valuesList.add(request.getMeasurementValues());
- });
-
- try {
- sessionPool.insertRecords(devicePathList, timeList, timeseriesListList, typesList, valuesList);
- healthChecker.health();
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- healthChecker.unHealth(e);
- throw new IOException(e);
- }
- }
-
- /**
- * Normal filter query for a list of data. querySQL must contain "align by device"
- *
- * @param modelName model name
- * @param querySQL the SQL for query which must contain "align by device"
- * @param storageBuilder storage builder for transforming storage result map to entity
- * @return a list of result data
- * @throws IOException IoTDBConnectionException or StatementExecutionException
- */
- public List<? super StorageData> filterQuery(String modelName, String querySQL,
- StorageBuilder<? extends StorageData> storageBuilder)
- throws IOException {
- if (!querySQL.contains("align by device")) {
- throw new IOException("querySQL must contain \"align by device\"");
- }
- SessionDataSetWrapper wrapper = null;
- List<? super StorageData> storageDataList = new ArrayList<>();
- try {
- wrapper = sessionPool.executeQueryStatement(querySQL);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, columnNames: {}", querySQL, wrapper.getColumnNames());
- }
-
- IoTDBTableMetaInfo tableMetaInfo = IoTDBTableMetaInfo.get(modelName);
- List<String> indexes = tableMetaInfo.getIndexes();
- List<String> columnNames = wrapper.getColumnNames();
- while (wrapper.hasNext()) {
- RowRecord rowRecord = wrapper.next();
- Convert2Entity convert2Entity =
- new IoTDBDataConverter.ToEntity(tableMetaInfo, indexes, columnNames, rowRecord);
- storageDataList.add(storageBuilder.storage2Entity(convert2Entity));
- }
- healthChecker.health();
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- healthChecker.unHealth(e);
- throw new IOException(e.getMessage() + System.lineSeparator() + "SQL Statement: " + querySQL, e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
- return storageDataList;
- }
-
- /**
- * Query with aggregation function: count, sum, avg, last_value, first_value, min_time, max_time, min_value,
- * max_value
- *
- * @param querySQL the SQL for query which should contain aggregation function
- * @return the result of aggregation function
- * @throws IOException IoTDBConnectionException or StatementExecutionException
- */
- public List<Double> queryWithAgg(String querySQL) throws IOException {
- SessionDataSetWrapper wrapper = null;
- List<Double> results = new ArrayList<>();
- try {
- wrapper = sessionPool.executeQueryStatement(querySQL);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, columnNames: {}", querySQL, wrapper.getColumnNames());
- }
-
- if (wrapper.hasNext()) {
- RowRecord rowRecord = wrapper.next();
- List<Field> fields = rowRecord.getFields();
- for (Field field : fields) {
- String stringValue = field.getStringValue();
- if (!stringValue.equals("null")) {
- results.add(Double.parseDouble(stringValue));
- }
- }
- }
- healthChecker.health();
- return results;
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- healthChecker.unHealth(e);
- throw new IOException(e.getMessage() + System.lineSeparator() + "SQL Statement: " + querySQL, e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
- }
-
- /**
- * Delete data <= deleteTime in one timeseries
- *
- * @param device device name
- * @param deleteTime deleteTime
- * @throws IOException IoTDBConnectionException or StatementExecutionException
- */
- public void deleteData(String device, long deleteTime) throws IOException {
- try {
- sessionPool.deleteData(storageGroup + IoTDBClient.DOT + device, deleteTime);
- healthChecker.health();
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- healthChecker.unHealth(e);
- throw new IOException(e);
- }
- }
-
- public String getStorageGroup() {
- return storageGroup;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBIndexes.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBIndexes.java
deleted file mode 100644
index 73e182432b..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBIndexes.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb;
-
-public interface IoTDBIndexes {
- // Here is the indexes we choose and their order in storage path.
- String ID_IDX = "id";
- String ENTITY_ID_IDX = "entity_id";
- String LAYER_IDX = "layer";
- String SERVICE_ID_IDX = "service_id";
- String GROUP_IDX = "service_group";
- String TRACE_ID_IDX = "trace_id";
- String INSTANCE_ID_INX = "instance_id";
- String PROCESS_ID_INX = "process_id";
- String AGENT_ID_INX = "agent_id";
- String AUTOCOMPLETE_TAG_KEY = "tag_key";
- String AUTOCOMPLETE_TAG_TYPE = "tag_type";
-
- static boolean isIndex(String key) {
- return key.equals(ID_IDX) || key.equals(ENTITY_ID_IDX) || key.equals(LAYER_IDX) ||
- key.equals(SERVICE_ID_IDX) || key.equals(GROUP_IDX) || key.equals(TRACE_ID_IDX) ||
- key.equals(INSTANCE_ID_INX) || key.equals(AGENT_ID_INX) || key.equals(PROCESS_ID_INX) ||
- key.equals(AUTOCOMPLETE_TAG_KEY) || key.equals(AUTOCOMPLETE_TAG_TYPE);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBStorageConfig.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBStorageConfig.java
deleted file mode 100644
index 8e34445af5..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBStorageConfig.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.skywalking.oap.server.library.module.ModuleConfig;
-
-@Getter
-@Setter
-public class IoTDBStorageConfig extends ModuleConfig {
- private String host;
- private int rpcPort;
- private String username;
- private String password;
- private String storageGroup;
- private int sessionPoolSize;
-
- private int fetchTaskLogMaxSize;
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBStorageProvider.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBStorageProvider.java
deleted file mode 100644
index 4e1c87a9aa..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBStorageProvider.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.iotdb.rpc.IoTDBConnectionException;
-import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.skywalking.oap.server.core.CoreModule;
-import org.apache.skywalking.oap.server.core.storage.IBatchDAO;
-import org.apache.skywalking.oap.server.core.storage.IHistoryDeleteDAO;
-import org.apache.skywalking.oap.server.core.storage.StorageBuilderFactory;
-import org.apache.skywalking.oap.server.core.storage.StorageDAO;
-import org.apache.skywalking.oap.server.core.storage.StorageException;
-import org.apache.skywalking.oap.server.core.storage.StorageModule;
-import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressAliasDAO;
-import org.apache.skywalking.oap.server.core.storage.management.UITemplateManagementDAO;
-import org.apache.skywalking.oap.server.core.storage.model.ModelCreator;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IServiceLabelDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileTaskLogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileTaskQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileThreadSnapshotQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IAggregationQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IAlarmQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IBrowserLogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingDataDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingScheduleDAO;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingTaskDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IEventQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ILogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IMetadataQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.IMetricsQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ITagAutoCompleteQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ITopNRecordsQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ITopologyQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.query.ITraceQueryDAO;
-import org.apache.skywalking.oap.server.library.module.ModuleConfig;
-import org.apache.skywalking.oap.server.library.module.ModuleDefine;
-import org.apache.skywalking.oap.server.library.module.ModuleProvider;
-import org.apache.skywalking.oap.server.library.module.ModuleStartException;
-import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.base.IoTDBBatchDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.base.IoTDBHistoryDeleteDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.base.IoTDBStorageDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.cache.IoTDBNetworkAddressAliasDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.management.IoTDBUITemplateManagementDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.profile.IoTDBProfileTaskLogQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.profile.IoTDBProfileTaskQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.profile.IoTDBProfileThreadSnapshotQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBAggregationQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBAlarmQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBBrowserLogQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBEBPFProfilingDataDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBEBPFProfilingScheduleDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBEBPFProfilingTaskDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBEventQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBLogQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBMetadataQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBMetricsQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBServiceLabelQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBTagAutoCompleteQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBTopNRecordsQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBTopologyQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.query.IoTDBTraceQueryDAO;
-import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
-import org.apache.skywalking.oap.server.telemetry.api.HealthCheckMetrics;
-import org.apache.skywalking.oap.server.telemetry.api.MetricsCreator;
-import org.apache.skywalking.oap.server.telemetry.api.MetricsTag;
-
-@Slf4j
-public class IoTDBStorageProvider extends ModuleProvider {
- private final IoTDBStorageConfig config;
- private IoTDBClient client;
-
- public IoTDBStorageProvider() {
- config = new IoTDBStorageConfig();
- }
-
- @Override
- public String name() {
- return "iotdb";
- }
-
- @Override
- public Class<? extends ModuleDefine> module() {
- return StorageModule.class;
- }
-
- @Override
- public ModuleConfig createConfigBeanIfAbsent() {
- return config;
- }
-
- @Override
- public void prepare() throws ServiceNotProvidedException {
- this.registerServiceImplementation(StorageBuilderFactory.class, new StorageBuilderFactory.Default());
-
- client = new IoTDBClient(config);
-
- this.registerServiceImplementation(IBatchDAO.class, new IoTDBBatchDAO(client));
- this.registerServiceImplementation(IHistoryDeleteDAO.class, new IoTDBHistoryDeleteDAO(client));
- this.registerServiceImplementation(StorageDAO.class, new IoTDBStorageDAO(client));
-
- this.registerServiceImplementation(INetworkAddressAliasDAO.class, new IoTDBNetworkAddressAliasDAO(client));
-
- this.registerServiceImplementation(UITemplateManagementDAO.class, new IoTDBUITemplateManagementDAO(client));
-
- this.registerServiceImplementation(IProfileTaskLogQueryDAO.class,
- new IoTDBProfileTaskLogQueryDAO(client, config.getFetchTaskLogMaxSize()));
- this.registerServiceImplementation(IProfileTaskQueryDAO.class, new IoTDBProfileTaskQueryDAO(client));
- this.registerServiceImplementation(IProfileThreadSnapshotQueryDAO.class,
- new IoTDBProfileThreadSnapshotQueryDAO(client));
-
- this.registerServiceImplementation(IAggregationQueryDAO.class, new IoTDBAggregationQueryDAO(client));
- this.registerServiceImplementation(IAlarmQueryDAO.class, new IoTDBAlarmQueryDAO(client));
- this.registerServiceImplementation(IBrowserLogQueryDAO.class, new IoTDBBrowserLogQueryDAO(client));
- this.registerServiceImplementation(IEventQueryDAO.class, new IoTDBEventQueryDAO(client));
- this.registerServiceImplementation(ILogQueryDAO.class, new IoTDBLogQueryDAO(client));
- this.registerServiceImplementation(IMetadataQueryDAO.class, new IoTDBMetadataQueryDAO(client));
- this.registerServiceImplementation(IMetricsQueryDAO.class, new IoTDBMetricsQueryDAO(client));
- this.registerServiceImplementation(ITopNRecordsQueryDAO.class, new IoTDBTopNRecordsQueryDAO(client));
- this.registerServiceImplementation(ITopologyQueryDAO.class, new IoTDBTopologyQueryDAO(client));
- this.registerServiceImplementation(ITraceQueryDAO.class, new IoTDBTraceQueryDAO(client));
-
- this.registerServiceImplementation(IEBPFProfilingTaskDAO.class, new IoTDBEBPFProfilingTaskDAO(client));
- this.registerServiceImplementation(IEBPFProfilingScheduleDAO.class, new IoTDBEBPFProfilingScheduleDAO(client));
- this.registerServiceImplementation(IEBPFProfilingDataDAO.class, new IoTDBEBPFProfilingDataDAO(client));
- this.registerServiceImplementation(IServiceLabelDAO.class, new IoTDBServiceLabelQueryDAO(client));
- this.registerServiceImplementation(ITagAutoCompleteQueryDAO.class, new IoTDBTagAutoCompleteQueryDAO(client));
- }
-
- @Override
- public void start() throws ServiceNotProvidedException, ModuleStartException {
- MetricsCreator metricCreator = getManager().find(TelemetryModule.NAME)
- .provider()
- .getService(MetricsCreator.class);
- HealthCheckMetrics healthChecker = metricCreator.createHealthCheckerGauge(
- "storage_iotdb", MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE);
- client.registerChecker(healthChecker);
- try {
- client.connect();
-
- IoTDBTableInstaller installer = new IoTDBTableInstaller(client, getManager());
- getManager().find(CoreModule.NAME).provider().getService(ModelCreator.class).addModelListener(installer);
- } catch (StorageException | IoTDBConnectionException | StatementExecutionException e) {
- throw new ModuleStartException(e.getMessage(), e);
- }
- }
-
- @Override
- public void notifyAfterCompleted() throws ServiceNotProvidedException {
-
- }
-
- @Override
- public String[] requiredModules() {
- return new String[]{CoreModule.NAME};
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBTableInstaller.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBTableInstaller.java
deleted file mode 100644
index 3e26ff580d..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBTableInstaller.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb;
-
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.model.ModelInstaller;
-import org.apache.skywalking.oap.server.library.client.Client;
-import org.apache.skywalking.oap.server.library.module.ModuleManager;
-
-/**
- * The Design of Apache IoTDB Storage Option
- * https://skywalking.apache.org/blog/2021-11-23-design-of-iotdb-storage-option/
- */
-public class IoTDBTableInstaller extends ModelInstaller {
- public IoTDBTableInstaller(Client client, ModuleManager moduleManager) {
- super(client, moduleManager);
- }
-
- @Override
- protected boolean isExists(Model model) {
- IoTDBTableMetaInfo.addModel(model);
- return true;
- }
-
- @Override
- protected void createTable(Model model) {
- // Automatically create table when insert data
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBTableMetaInfo.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBTableMetaInfo.java
deleted file mode 100644
index 2d79c3b865..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/IoTDBTableMetaInfo.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb;
-
-import com.google.gson.JsonObject;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Getter;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.skywalking.oap.server.core.analysis.Layer;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.model.ModelColumn;
-import org.apache.skywalking.oap.server.core.storage.type.StorageDataComplexObject;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Getter
-@Builder
-@AllArgsConstructor
-public class IoTDBTableMetaInfo {
- private static final Map<String, IoTDBTableMetaInfo> TABLE_META_INFOS = new HashMap<>();
-
- private final Model model;
- private final Map<String, TSDataType> columnAndTypeMap;
- private final List<String> indexes;
-
- public static void addModel(Model model) {
- final List<ModelColumn> columns = model.getColumns();
- final Map<String, String> storageAndIndexMap = new HashMap<>();
- final Map<String, TSDataType> columnAndTypeMap = new HashMap<>();
- final List<String> indexes = new ArrayList<>();
-
- storageAndIndexMap.put(model.getName(), IoTDBIndexes.ID_IDX);
- columns.forEach(column -> {
- String columnName = column.getColumnName().getName();
- if (IoTDBIndexes.isIndex(columnName)) {
- storageAndIndexMap.put(column.getColumnName().getStorageName(), columnName);
- } else {
- columnAndTypeMap.put(columnName, typeToTSDataType(column.getType()));
- }
- });
-
- // index order: id, entity_id, node_type, service_id, service_group, trace_id
- indexes.add(IoTDBIndexes.ID_IDX);
- if (storageAndIndexMap.containsValue(IoTDBIndexes.ENTITY_ID_IDX)) {
- indexes.add(IoTDBIndexes.ENTITY_ID_IDX);
- }
- if (storageAndIndexMap.containsValue(IoTDBIndexes.LAYER_IDX)) {
- indexes.add(IoTDBIndexes.LAYER_IDX);
- }
- if (storageAndIndexMap.containsValue(IoTDBIndexes.SERVICE_ID_IDX)) {
- indexes.add(IoTDBIndexes.SERVICE_ID_IDX);
- }
- if (storageAndIndexMap.containsValue(IoTDBIndexes.GROUP_IDX)) {
- indexes.add(IoTDBIndexes.GROUP_IDX);
- }
- if (storageAndIndexMap.containsValue(IoTDBIndexes.TRACE_ID_IDX)) {
- indexes.add(IoTDBIndexes.TRACE_ID_IDX);
- }
- if (storageAndIndexMap.containsValue(IoTDBIndexes.INSTANCE_ID_INX)) {
- indexes.add(IoTDBIndexes.INSTANCE_ID_INX);
- }
- if (storageAndIndexMap.containsValue(IoTDBIndexes.PROCESS_ID_INX)) {
- indexes.add(IoTDBIndexes.PROCESS_ID_INX);
- }
- if (storageAndIndexMap.containsValue(IoTDBIndexes.AGENT_ID_INX)) {
- indexes.add(IoTDBIndexes.AGENT_ID_INX);
- }
- if (storageAndIndexMap.containsValue(IoTDBIndexes.AUTOCOMPLETE_TAG_KEY)) {
- indexes.add(IoTDBIndexes.AUTOCOMPLETE_TAG_KEY);
- }
-
- if (storageAndIndexMap.containsValue(IoTDBIndexes.AUTOCOMPLETE_TAG_TYPE)) {
- indexes.add(IoTDBIndexes.AUTOCOMPLETE_TAG_TYPE);
- }
-
- final IoTDBTableMetaInfo tableMetaInfo = IoTDBTableMetaInfo.builder()
- .model(model)
- .columnAndTypeMap(columnAndTypeMap)
- .indexes(indexes)
- .build();
- TABLE_META_INFOS.put(model.getName(), tableMetaInfo);
- }
-
- public static IoTDBTableMetaInfo get(String moduleName) {
- return TABLE_META_INFOS.get(moduleName);
- }
-
- private static TSDataType typeToTSDataType(Class<?> type) {
- if (Integer.class.equals(type) || int.class.equals(type) || Layer.class.equals(type)) {
- return TSDataType.INT32;
- } else if (Long.class.equals(type) || long.class.equals(type)) {
- return TSDataType.INT64;
- } else if (Float.class.equals(type) || float.class.equals(type)) {
- return TSDataType.FLOAT;
- } else if (Double.class.equals(type) || double.class.equals(type)) {
- return TSDataType.DOUBLE;
- } else if (Boolean.class.equals(type) || boolean.class.equals(type)) {
- return TSDataType.BOOLEAN;
- } else if (String.class.equals(type)) {
- return TSDataType.TEXT;
- } else if (StorageDataComplexObject.class.isAssignableFrom(type)) {
- return TSDataType.TEXT;
- } else if (byte[].class.equals(type)) {
- return TSDataType.TEXT;
- } else if (JsonObject.class.equals(type)) {
- return TSDataType.TEXT;
- } else if (List.class.isAssignableFrom(type)) {
- return TSDataType.TEXT;
- } else {
- throw new IllegalArgumentException("Unsupported data type: " + type.getName());
- }
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBBatchDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBBatchDAO.java
deleted file mode 100644
index fba54c2917..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBBatchDAO.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.base;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.storage.IBatchDAO;
-import org.apache.skywalking.oap.server.library.client.request.InsertRequest;
-import org.apache.skywalking.oap.server.library.client.request.PrepareRequest;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBBatchDAO implements IBatchDAO {
- private final IoTDBClient client;
-
- @Override
- public void insert(InsertRequest insertRequest) {
- try {
- client.write((IoTDBInsertRequest) insertRequest);
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- }
- }
-
- @Override
- public CompletableFuture<Void> flush(List<PrepareRequest> prepareRequests) {
- if (CollectionUtils.isEmpty(prepareRequests)) {
- return CompletableFuture.completedFuture(null);
- }
- if (log.isDebugEnabled()) {
- log.debug("batch sql statements execute, data size: {}", prepareRequests.size());
- }
- List<IoTDBInsertRequest> tempPrepareRequests = new ArrayList<>(prepareRequests.size());
- prepareRequests.forEach(prepareRequest -> tempPrepareRequests.add((IoTDBInsertRequest) prepareRequest));
- try {
- client.write(tempPrepareRequests);
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- }
- return CompletableFuture.completedFuture(null);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBHistoryDeleteDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBHistoryDeleteDAO.java
deleted file mode 100644
index 5d71b167db..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBHistoryDeleteDAO.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.base;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.storage.IHistoryDeleteDAO;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.joda.time.DateTime;
-
-import java.io.IOException;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBHistoryDeleteDAO implements IHistoryDeleteDAO {
- private final IoTDBClient client;
-
- @Override
- public void deleteHistory(Model model, String timeBucketColumnName, int ttl) throws IOException {
- if (log.isDebugEnabled()) {
- log.debug("TTL execution log, model: {}, TTL: {}", model.getName(), ttl);
- }
- long deadline = Long.parseLong(new DateTime().plusDays(-ttl).toString("yyyyMMddHHmm"));
- client.deleteData(model.getName(), TimeBucket.getTimestamp(deadline));
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBInsertRequest.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBInsertRequest.java
deleted file mode 100644
index 7f8f7e1e98..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBInsertRequest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.base;
-
-import java.util.ArrayList;
-import java.util.List;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.skywalking.oap.server.core.Const;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.client.request.InsertRequest;
-import org.apache.skywalking.oap.server.library.client.request.UpdateRequest;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBTableMetaInfo;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBDataConverter;
-
-@Getter
-@Setter
-@ToString
-@Slf4j
-public class IoTDBInsertRequest implements InsertRequest, UpdateRequest {
- private String modelName;
- private long time;
- private List<String> indexes;
- private List<String> indexValues;
- private List<String> measurements;
- private List<TSDataType> measurementTypes;
- private List<Object> measurementValues;
-
- public IoTDBInsertRequest(String modelName, long time) {
- this.modelName = modelName;
- this.time = time;
- this.indexes = IoTDBTableMetaInfo.get(modelName).getIndexes();
- this.indexValues = new ArrayList<>(indexes.size());
- this.indexes.forEach(index -> this.indexValues.add(Const.EMPTY_STRING));
-
- int measurementsSize = IoTDBTableMetaInfo.get(modelName).getColumnAndTypeMap().size();
- this.measurements = new ArrayList<>(measurementsSize);
- this.measurementTypes = new ArrayList<>(measurementsSize);
- this.measurementValues = new ArrayList<>(measurementsSize);
- }
-
- public static <T extends StorageData> IoTDBInsertRequest buildRequest(String modelName, long time, T storageData,
- StorageBuilder<T> storageBuilder) {
- String id = storageData.id();
- IoTDBDataConverter.ToStorage toStorage = new IoTDBDataConverter.ToStorage(modelName, time, id);
- storageBuilder.entity2Storage(storageData, toStorage);
- return toStorage.obtain();
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBManagementDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBManagementDAO.java
deleted file mode 100644
index 7033e911d5..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBManagementDAO.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.base;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.management.ManagementData;
-import org.apache.skywalking.oap.server.core.storage.IManagementDAO;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-
-import java.io.IOException;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBManagementDAO implements IManagementDAO {
- private final IoTDBClient client;
- private final StorageBuilder<ManagementData> storageBuilder;
-
- @Override
- public void insert(Model model, ManagementData storageData) throws IOException {
- IoTDBInsertRequest request =
- IoTDBInsertRequest.buildRequest(model.getName(), 1L, storageData, storageBuilder);
- client.write(request);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBMetricsDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBMetricsDAO.java
deleted file mode 100644
index 9dba2d7221..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBMetricsDAO.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.base;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics;
-import org.apache.skywalking.oap.server.core.storage.IMetricsDAO;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.client.request.InsertRequest;
-import org.apache.skywalking.oap.server.library.client.request.UpdateRequest;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBMetricsDAO implements IMetricsDAO {
- private final IoTDBClient client;
- private final StorageBuilder<Metrics> storageBuilder;
-
- @Override
- public List<Metrics> multiGet(Model model, List<Metrics> metrics) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- for (Metrics metric : metrics) {
- query.append(", ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, model.getName());
- query.append(IoTDBClient.DOT).append(IoTDBUtils.indexValue2LayerName(metric.id()));
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
- String queryString = query.toString().replaceFirst(", ", "");
- List<? super StorageData> storageDataList = client.filterQuery(model.getName(), queryString, storageBuilder);
- List<Metrics> newMetrics = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData -> newMetrics.add((Metrics) storageData));
- return newMetrics;
- }
-
- @Override
- public InsertRequest prepareBatchInsert(Model model, Metrics metrics) {
- final long timestamp = TimeBucket.getTimestamp(metrics.getTimeBucket(), model.getDownsampling());
- return IoTDBInsertRequest.buildRequest(model.getName(), timestamp, metrics, storageBuilder);
- }
-
- @Override
- public UpdateRequest prepareBatchUpdate(Model model, Metrics metrics) {
- return (UpdateRequest) prepareBatchInsert(model, metrics);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBNoneStreamDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBNoneStreamDAO.java
deleted file mode 100644
index 1885adb1ec..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBNoneStreamDAO.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.base;
-
-import java.io.IOException;
-import lombok.RequiredArgsConstructor;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.config.NoneStream;
-import org.apache.skywalking.oap.server.core.storage.INoneStreamDAO;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-
-@RequiredArgsConstructor
-public class IoTDBNoneStreamDAO implements INoneStreamDAO {
- private final IoTDBClient client;
- private final StorageBuilder<NoneStream> storageBuilder;
-
- @Override
- public void insert(Model model, NoneStream noneStream) throws IOException {
- final long timestamp = TimeBucket.getTimestamp(noneStream.getTimeBucket(), model.getDownsampling());
- final IoTDBInsertRequest request =
- IoTDBInsertRequest.buildRequest(model.getName(), timestamp, noneStream, storageBuilder);
- client.write(request);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBRecordDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBRecordDAO.java
deleted file mode 100644
index b856e9ab2f..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBRecordDAO.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.base;
-
-import java.util.List;
-import java.util.Objects;
-import lombok.RequiredArgsConstructor;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.skywalking.oap.server.core.alarm.AlarmRecord;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.manual.log.LogRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.Tag;
-import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord;
-import org.apache.skywalking.oap.server.core.analysis.record.Record;
-import org.apache.skywalking.oap.server.core.storage.IRecordDAO;
-import org.apache.skywalking.oap.server.core.storage.model.Model;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.client.request.InsertRequest;
-
-@RequiredArgsConstructor
-public class IoTDBRecordDAO implements IRecordDAO {
- private final StorageBuilder<Record> storageBuilder;
-
- @Override
- public InsertRequest prepareBatchInsert(Model model, Record record) {
- final long timestamp = TimeBucket.getTimestamp(record.getTimeBucket(), model.getDownsampling());
- IoTDBInsertRequest request =
- IoTDBInsertRequest.buildRequest(model.getName(), timestamp, record, storageBuilder);
-
- // transform tags of SegmentRecord, LogRecord, AlarmRecord to tag1, tag2, ...
- List<String> measurements = request.getMeasurements();
- List<TSDataType> measurementTypes = request.getMeasurementTypes();
- List<Object> measurementValues = request.getMeasurementValues();
- List<Tag> rawTags = null;
- if (SegmentRecord.INDEX_NAME.equals(model.getName())) {
- rawTags = ((SegmentRecord) record).getTagsRawData();
- measurementTypes.remove(measurements.indexOf(SegmentRecord.TAGS));
- measurementValues.remove(measurements.indexOf(SegmentRecord.TAGS));
- measurements.remove(SegmentRecord.TAGS);
- } else if (LogRecord.INDEX_NAME.equals(model.getName())) {
- rawTags = ((LogRecord) record).getTags();
- measurementTypes.remove(measurements.indexOf(LogRecord.TAGS));
- measurementValues.remove(measurements.indexOf(LogRecord.TAGS));
- measurements.remove(LogRecord.TAGS);
- } else if (AlarmRecord.INDEX_NAME.equals(model.getName())) {
- rawTags = ((AlarmRecord) record).getTags();
- measurementTypes.remove(measurements.indexOf(AlarmRecord.TAGS));
- measurementValues.remove(measurements.indexOf(AlarmRecord.TAGS));
- measurements.remove(AlarmRecord.TAGS);
- }
- if (Objects.nonNull(rawTags)) {
- rawTags.forEach(rawTag -> {
- if (rawTag.getKey().contains(".")) {
- measurements.add("\"" + rawTag.getKey() + "\"");
- } else {
- measurements.add(rawTag.getKey());
- }
- measurementTypes.add(TSDataType.TEXT);
- measurementValues.add(rawTag.getValue());
- });
- }
- return request;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBStorageDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBStorageDAO.java
deleted file mode 100644
index 54c3435a5a..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/base/IoTDBStorageDAO.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.base;
-
-import lombok.RequiredArgsConstructor;
-import org.apache.skywalking.oap.server.core.storage.IManagementDAO;
-import org.apache.skywalking.oap.server.core.storage.IMetricsDAO;
-import org.apache.skywalking.oap.server.core.storage.INoneStreamDAO;
-import org.apache.skywalking.oap.server.core.storage.IRecordDAO;
-import org.apache.skywalking.oap.server.core.storage.StorageDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-
-@RequiredArgsConstructor
-public class IoTDBStorageDAO implements StorageDAO {
- private final IoTDBClient ioTDBClient;
-
- @Override
- public IMetricsDAO newMetricsDao(StorageBuilder storageBuilder) {
- return new IoTDBMetricsDAO(ioTDBClient, storageBuilder);
- }
-
- @Override
- public IRecordDAO newRecordDao(StorageBuilder storageBuilder) {
- return new IoTDBRecordDAO(storageBuilder);
- }
-
- @Override
- public INoneStreamDAO newNoneStreamDao(StorageBuilder storageBuilder) {
- return new IoTDBNoneStreamDAO(ioTDBClient, storageBuilder);
- }
-
- @Override
- public IManagementDAO newManagementDao(StorageBuilder storageBuilder) {
- return new IoTDBManagementDAO(ioTDBClient, storageBuilder);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/cache/IoTDBNetworkAddressAliasDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/cache/IoTDBNetworkAddressAliasDAO.java
deleted file mode 100644
index eecfcf5010..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/cache/IoTDBNetworkAddressAliasDAO.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.cache;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.manual.networkalias.NetworkAddressAlias;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressAliasDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBNetworkAddressAliasDAO implements INetworkAddressAliasDAO {
- private final NetworkAddressAlias.Builder storageBuilder = new NetworkAddressAlias.Builder();
- private final IoTDBClient client;
-
- @Override
- public List<NetworkAddressAlias> loadLastUpdate(long timeBucket) {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, NetworkAddressAlias.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(NetworkAddressAlias.INDEX_NAME, query);
- query.append(" where ").append(NetworkAddressAlias.LAST_UPDATE_TIME_BUCKET).append(" >= ").append(timeBucket)
- .append(IoTDBClient.ALIGN_BY_DEVICE);
-
- try {
- List<? super StorageData> storageDataList = client.filterQuery(NetworkAddressAlias.INDEX_NAME,
- query.toString(), storageBuilder);
- List<NetworkAddressAlias> networkAddressAliases = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData -> networkAddressAliases.add((NetworkAddressAlias) storageData));
- return networkAddressAliases;
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- }
- return new ArrayList<>();
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/management/IoTDBUITemplateManagementDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/management/IoTDBUITemplateManagementDAO.java
deleted file mode 100644
index 9839074db1..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/management/IoTDBUITemplateManagementDAO.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.management;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.management.ui.template.UITemplate;
-import org.apache.skywalking.oap.server.core.query.input.DashboardSetting;
-import org.apache.skywalking.oap.server.core.query.type.DashboardConfiguration;
-import org.apache.skywalking.oap.server.core.query.type.TemplateChangeStatus;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.management.UITemplateManagementDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.util.BooleanUtils;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.base.IoTDBInsertRequest;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBUITemplateManagementDAO implements UITemplateManagementDAO {
- private final IoTDBClient client;
- private final StorageBuilder<UITemplate> storageBuilder = new UITemplate.Builder();
- private static final long UI_TEMPLATE_TIMESTAMP = 1L;
-
- @Override
- public DashboardConfiguration getTemplate(final String id) throws IOException {
- if (StringUtil.isEmpty(id)) {
- return null;
- }
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, UITemplate.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.ID_IDX, id);
- IoTDBUtils.addQueryIndexValue(UITemplate.INDEX_NAME, query, indexAndValueMap);
- query.append(" limit 1").append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList =
- client.filterQuery(UITemplate.INDEX_NAME, query.toString(), storageBuilder);
- if (storageDataList.size() > 0) {
- return new DashboardConfiguration().fromEntity((UITemplate) storageDataList.get(0));
- }
- return null;
- }
-
- @Override
- public List<DashboardConfiguration> getAllTemplates(Boolean includingDisabled) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, UITemplate.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(UITemplate.INDEX_NAME, query);
- if (!includingDisabled) {
- query.append(" where ").append(UITemplate.DISABLED).append(" = ").append(BooleanUtils.FALSE);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(UITemplate.INDEX_NAME, query.toString(),
- storageBuilder);
- List<DashboardConfiguration> dashboardConfigurationList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(
- storageData -> dashboardConfigurationList.add(
- new DashboardConfiguration().fromEntity((UITemplate) storageData)));
- return dashboardConfigurationList;
- }
-
- @Override
- public TemplateChangeStatus addTemplate(DashboardSetting setting) throws IOException {
- final UITemplate uiTemplate = setting.toEntity();
-
- IoTDBInsertRequest request =
- IoTDBInsertRequest.buildRequest(UITemplate.INDEX_NAME, UI_TEMPLATE_TIMESTAMP,
- uiTemplate, storageBuilder);
- client.write(request);
- return TemplateChangeStatus.builder().status(true).id(setting.getId()).build();
- }
-
- @Override
- public TemplateChangeStatus changeTemplate(DashboardSetting setting) throws IOException {
- final UITemplate uiTemplate = setting.toEntity();
-
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, UITemplate.INDEX_NAME);
- query.append(IoTDBClient.DOT).append(IoTDBUtils.indexValue2LayerName(uiTemplate.id()))
- .append(IoTDBClient.ALIGN_BY_DEVICE);
- List<? super StorageData> queryResult = client.filterQuery(
- UITemplate.INDEX_NAME, query.toString(), storageBuilder);
- if (queryResult.size() == 0) {
- return TemplateChangeStatus.builder()
- .status(false)
- .id(setting.getId())
- .message("Can't find the template")
- .build();
- } else {
- IoTDBInsertRequest request =
- IoTDBInsertRequest.buildRequest(UITemplate.INDEX_NAME, UI_TEMPLATE_TIMESTAMP,
- uiTemplate, storageBuilder);
- client.write(request);
- return TemplateChangeStatus.builder().status(true).id(setting.getId()).build();
- }
- }
-
- @Override
- public TemplateChangeStatus disableTemplate(String id) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, UITemplate.INDEX_NAME);
- query.append(IoTDBClient.DOT).append(IoTDBUtils.indexValue2LayerName(id))
- .append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> queryResult = client.filterQuery(
- UITemplate.INDEX_NAME, query.toString(), storageBuilder);
- if (queryResult.size() == 0) {
- return TemplateChangeStatus.builder().status(false).id(id).message("Can't find the template").build();
- } else {
- final UITemplate uiTemplate = (UITemplate) queryResult.get(0);
- uiTemplate.setDisabled(BooleanUtils.TRUE);
- IoTDBInsertRequest request =
- IoTDBInsertRequest.buildRequest(UITemplate.INDEX_NAME, UI_TEMPLATE_TIMESTAMP,
- uiTemplate, storageBuilder);
- client.write(request);
- return TemplateChangeStatus.builder().status(true).id(id).build();
- }
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/profile/IoTDBProfileTaskLogQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/profile/IoTDBProfileTaskLogQueryDAO.java
deleted file mode 100644
index a3dfbc1c4e..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/profile/IoTDBProfileTaskLogQueryDAO.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.profile;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.profiling.trace.ProfileTaskLogRecord;
-import org.apache.skywalking.oap.server.core.query.type.ProfileTaskLog;
-import org.apache.skywalking.oap.server.core.query.type.ProfileTaskLogOperationType;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileTaskLogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBProfileTaskLogQueryDAO implements IProfileTaskLogQueryDAO {
- private final IoTDBClient client;
- private final StorageBuilder<ProfileTaskLogRecord> storageBuilder = new ProfileTaskLogRecord.Builder();
- private final int fetchTaskLogMaxSize;
-
- @Override
- public List<ProfileTaskLog> getTaskLogList() throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ProfileTaskLogRecord.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(ProfileTaskLogRecord.INDEX_NAME, query);
- query.append(" limit ").append(fetchTaskLogMaxSize).append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ProfileTaskLogRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- List<ProfileTaskLogRecord> profileTaskLogRecordList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData ->
- profileTaskLogRecordList.add((ProfileTaskLogRecord) storageData));
- // resort by self, because of the query result order by time.
- profileTaskLogRecordList.sort((ProfileTaskLogRecord r1, ProfileTaskLogRecord r2) ->
- Long.compare(r2.getOperationTime(), r1.getOperationTime()));
- List<ProfileTaskLog> profileTaskLogList = new ArrayList<>(profileTaskLogRecordList.size());
- profileTaskLogRecordList.forEach(profileTaskLogRecord ->
- profileTaskLogList.add(parseLog(profileTaskLogRecord)));
- return profileTaskLogList;
- }
-
- private ProfileTaskLog parseLog(ProfileTaskLogRecord record) {
- return ProfileTaskLog.builder()
- .id(record.id())
- .taskId(record.getTaskId())
- .instanceId(record.getInstanceId())
- .operationType(ProfileTaskLogOperationType.parse(record.getOperationType()))
- .operationTime(record.getOperationTime())
- .build();
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/profile/IoTDBProfileTaskQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/profile/IoTDBProfileTaskQueryDAO.java
deleted file mode 100644
index d094d207ff..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/profile/IoTDBProfileTaskQueryDAO.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.profile;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.profiling.trace.ProfileTaskRecord;
-import org.apache.skywalking.oap.server.core.query.type.ProfileTask;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileTaskQueryDAO;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBProfileTaskQueryDAO implements IProfileTaskQueryDAO {
- private final IoTDBClient client;
- private final ProfileTaskRecord.Builder storageBuilder = new ProfileTaskRecord.Builder();
-
- @Override
- public List<ProfileTask> getTaskList(String serviceId, String endpointName, Long startTimeBucket,
- Long endTimeBucket, Integer limit) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ProfileTaskRecord.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- if (StringUtil.isNotEmpty(serviceId)) {
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceId);
- }
- IoTDBUtils.addQueryIndexValue(ProfileTaskRecord.INDEX_NAME, query, indexAndValueMap);
-
- StringBuilder where = new StringBuilder(" where ");
- if (StringUtil.isNotEmpty(endpointName)) {
- where.append(ProfileTaskRecord.ENDPOINT_NAME).append(" = \"")
- .append(endpointName).append("\"")
- .append(" and ");
- }
- if (Objects.nonNull(startTimeBucket)) {
- where.append(IoTDBClient.TIME).append(" >= ")
- .append(TimeBucket.getTimestamp(startTimeBucket))
- .append(" and ");
- }
- if (Objects.nonNull(endTimeBucket)) {
- where.append(IoTDBClient.TIME).append(" <= ")
- .append(TimeBucket.getTimestamp(endTimeBucket))
- .append(" and ");
- }
- if (where.length() > 7) {
- int length = where.length();
- where.delete(length - 5, length);
- query.append(where);
- }
- if (Objects.nonNull(limit)) {
- query.append(" limit ").append(limit);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ProfileTaskRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- List<ProfileTask> profileTaskList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData ->
- profileTaskList.add(record2ProfileTask((ProfileTaskRecord) storageData)));
- return profileTaskList;
- }
-
- @Override
- public ProfileTask getById(String id) throws IOException {
- if (StringUtil.isEmpty(id)) {
- return null;
- }
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ProfileTaskRecord.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.ID_IDX, id);
- IoTDBUtils.addQueryIndexValue(ProfileTaskRecord.INDEX_NAME, query, indexAndValueMap);
- query.append(" limit 1").append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ProfileTaskRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- return record2ProfileTask((ProfileTaskRecord) storageDataList.get(0));
- }
-
- private static ProfileTask record2ProfileTask(ProfileTaskRecord record) {
- return ProfileTask.builder()
- .id(record.id())
- .serviceId(record.getServiceId())
- .endpointName(record.getEndpointName())
- .startTime(record.getStartTime())
- .createTime(record.getCreateTime())
- .duration(record.getDuration())
- .minDurationThreshold(record.getMinDurationThreshold())
- .dumpPeriod(record.getDumpPeriod())
- .maxSamplingCount(record.getMaxSamplingCount())
- .build();
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/profile/IoTDBProfileThreadSnapshotQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/profile/IoTDBProfileThreadSnapshotQueryDAO.java
deleted file mode 100644
index 36bea97277..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/profile/IoTDBProfileThreadSnapshotQueryDAO.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.profile;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import lombok.RequiredArgsConstructor;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord;
-import org.apache.skywalking.oap.server.core.profiling.trace.ProfileThreadSnapshotRecord;
-import org.apache.skywalking.oap.server.core.query.type.BasicTrace;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.profiling.trace.IProfileThreadSnapshotQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.util.BooleanUtils;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@RequiredArgsConstructor
-public class IoTDBProfileThreadSnapshotQueryDAO implements IProfileThreadSnapshotQueryDAO {
- private final IoTDBClient client;
- private final StorageBuilder<ProfileThreadSnapshotRecord> profileThreadSnapshotRecordBuilder =
- new ProfileThreadSnapshotRecord.Builder();
- private final StorageBuilder<SegmentRecord> segmentRecordBuilder = new SegmentRecord.Builder();
-
- @Override
- public List<BasicTrace> queryProfiledSegments(String taskId) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ProfileThreadSnapshotRecord.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(ProfileThreadSnapshotRecord.INDEX_NAME, query);
- query.append(" where ").append(ProfileThreadSnapshotRecord.TASK_ID).append(" = \"").append(taskId).append("\"")
- .append(" and ").append(ProfileThreadSnapshotRecord.SEQUENCE).append(" = 0")
- .append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ProfileThreadSnapshotRecord.INDEX_NAME,
- query.toString(),
- profileThreadSnapshotRecordBuilder);
- // We can insure the size of List, so use ArrayList to improve visit speed. (Other storage plugin use LinkedList)
- final List<String> segmentIds = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(
- storageData -> segmentIds.add(((ProfileThreadSnapshotRecord) storageData).getSegmentId()));
- if (segmentIds.isEmpty()) {
- return Collections.emptyList();
- }
-
- // This method maybe have poor efficiency. It queries all data which meets a condition without select function.
- // https://github.com/apache/iotdb/discussions/3888
- query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, SegmentRecord.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(SegmentRecord.INDEX_NAME, query);
- query.append(" where ").append(SegmentRecord.SEGMENT_ID).append(" in (");
- for (String segmentId : segmentIds) {
- query.append("\"").append(segmentId).append("\"").append(", ");
- }
- query.delete(query.length() - 2, query.length()).append(")").append(IoTDBClient.ALIGN_BY_DEVICE);
-
- storageDataList = client.filterQuery(SegmentRecord.INDEX_NAME, query.toString(), segmentRecordBuilder);
- List<SegmentRecord> segmentRecordList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData -> segmentRecordList.add((SegmentRecord) storageData));
- // resort by self, because of the select query result order by time.
- segmentRecordList.sort((SegmentRecord r1, SegmentRecord r2) ->
- Long.compare(r2.getStartTime(), r1.getStartTime()));
-
- List<BasicTrace> result = new ArrayList<>(segmentRecordList.size());
- segmentRecordList.forEach(segmentRecord -> {
- BasicTrace basicTrace = new BasicTrace();
- basicTrace.setSegmentId(segmentRecord.getSegmentId());
- basicTrace.setStart(String.valueOf(segmentRecord.getStartTime()));
- basicTrace.getEndpointNames().add(IDManager.EndpointID.analysisId(segmentRecord.getEndpointId())
- .getEndpointName());
- basicTrace.setDuration(segmentRecord.getLatency());
- basicTrace.setError(BooleanUtils.valueToBoolean(segmentRecord.getIsError()));
- basicTrace.getTraceIds().add(segmentRecord.getTraceId());
- result.add(basicTrace);
- });
- return result;
- }
-
- @Override
- public int queryMinSequence(String segmentId, long start, long end) throws IOException {
- return querySequenceWithAgg("min_value", segmentId, start, end);
- }
-
- @Override
- public int queryMaxSequence(String segmentId, long start, long end) throws IOException {
- return querySequenceWithAgg("max_value", segmentId, start, end);
- }
-
- @Override
- public List<ProfileThreadSnapshotRecord> queryRecords(String segmentId, int minSequence, int maxSequence)
- throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ProfileThreadSnapshotRecord.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(ProfileThreadSnapshotRecord.INDEX_NAME, query);
- query.append(" where ").append(ProfileThreadSnapshotRecord.SEGMENT_ID).append(" = \"").append(segmentId).append("\"")
- .append(" and ").append(ProfileThreadSnapshotRecord.SEQUENCE).append(" >= ").append(minSequence)
- .append(" and ").append(ProfileThreadSnapshotRecord.SEQUENCE).append(" <= ").append(maxSequence)
- .append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ProfileThreadSnapshotRecord.INDEX_NAME,
- query.toString(),
- profileThreadSnapshotRecordBuilder);
- List<ProfileThreadSnapshotRecord> profileThreadSnapshotRecordList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(
- storageData -> profileThreadSnapshotRecordList.add((ProfileThreadSnapshotRecord) storageData));
- return profileThreadSnapshotRecordList;
- }
-
- @Override
- public SegmentRecord getProfiledSegment(String segmentId) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, SegmentRecord.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(SegmentRecord.INDEX_NAME, query);
- query.append(" where ").append(SegmentRecord.SEGMENT_ID).append(" = \"").append(segmentId).append("\"")
- .append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(SegmentRecord.INDEX_NAME,
- query.toString(), segmentRecordBuilder);
- if (storageDataList.isEmpty()) {
- return null;
- }
- return (SegmentRecord) storageDataList.get(0);
- }
-
- private int querySequenceWithAgg(String aggType, String segmentId, long start, long end) throws IOException {
- // This method has poor efficiency. It queries all data which meets a condition without aggregation function
- // See https://github.com/apache/iotdb/discussions/3907
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ProfileThreadSnapshotRecord.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(ProfileThreadSnapshotRecord.INDEX_NAME, query);
- query.append(" where ").append(ProfileThreadSnapshotRecord.SEGMENT_ID).append(" = \"").append(segmentId).append("\"")
- .append(" and ").append(ProfileThreadSnapshotRecord.DUMP_TIME).append(" >= ").append(start)
- .append(" and ").append(ProfileThreadSnapshotRecord.DUMP_TIME).append(" <= ").append(end)
- .append(IoTDBClient.ALIGN_BY_DEVICE);
- List<? super StorageData> storageDataList = client.filterQuery(ProfileThreadSnapshotRecord.INDEX_NAME,
- query.toString(),
- profileThreadSnapshotRecordBuilder);
- if (aggType.equals("min_value")) {
- int minValue = Integer.MAX_VALUE;
- for (Object storageData : storageDataList) {
- ProfileThreadSnapshotRecord profileThreadSnapshotRecord = (ProfileThreadSnapshotRecord) storageData;
- int sequence = profileThreadSnapshotRecord.getSequence();
- minValue = Math.min(minValue, sequence);
- }
- return minValue;
- } else if (aggType.equals("max_value")) {
- int maxValue = Integer.MIN_VALUE;
- for (Object storageData : storageDataList) {
- ProfileThreadSnapshotRecord profileThreadSnapshotRecord = (ProfileThreadSnapshotRecord) storageData;
- int sequence = profileThreadSnapshotRecord.getSequence();
- maxValue = Math.max(maxValue, sequence);
- }
- return maxValue;
- } else {
- throw new IOException("Wrong aggregation function");
- }
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBAggregationQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBAggregationQueryDAO.java
deleted file mode 100644
index 5cf12a16f1..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBAggregationQueryDAO.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.common.base.Splitter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.iotdb.rpc.IoTDBConnectionException;
-import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.iotdb.session.pool.SessionDataSetWrapper;
-import org.apache.iotdb.session.pool.SessionPool;
-import org.apache.iotdb.tsfile.read.common.Field;
-import org.apache.iotdb.tsfile.read.common.RowRecord;
-import org.apache.skywalking.oap.server.core.query.enumeration.Order;
-import org.apache.skywalking.oap.server.core.query.input.Duration;
-import org.apache.skywalking.oap.server.core.query.input.TopNCondition;
-import org.apache.skywalking.oap.server.core.query.type.KeyValue;
-import org.apache.skywalking.oap.server.core.query.type.SelectedRecord;
-import org.apache.skywalking.oap.server.core.storage.query.IAggregationQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBAggregationQueryDAO implements IAggregationQueryDAO {
- private final IoTDBClient client;
-
- @Override
- public List<SelectedRecord> sortMetrics(TopNCondition condition, String valueColumnName, Duration duration,
- List<KeyValue> additionalConditions) throws IOException {
- // This method maybe have poor efficiency.
- // It queries all data which meets a condition without aggregation function.
- // https://github.com/apache/iotdb/issues/4006
- StringBuilder query = new StringBuilder();
- query.append(String.format("select %s from ", valueColumnName));
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, condition.getName());
-
- Map<String, String> indexAndValueMap = new HashMap<>();
- List<KeyValue> measurementConditions = new ArrayList<>();
- if (additionalConditions != null) {
- for (KeyValue additionalCondition : additionalConditions) {
- String key = additionalCondition.getKey();
- if (IoTDBIndexes.isIndex(key)) {
- indexAndValueMap.put(key, additionalCondition.getValue());
- } else {
- measurementConditions.add(additionalCondition);
- }
- }
- }
- if (!indexAndValueMap.isEmpty()) {
- IoTDBUtils.addQueryIndexValue(condition.getName(), query, indexAndValueMap);
- } else {
- IoTDBUtils.addQueryAsterisk(condition.getName(), query);
- }
-
- query.append(" where ").append(IoTDBClient.TIME).append(" >= ").append(duration.getStartTimestamp())
- .append(" and ").append(IoTDBClient.TIME).append(" <= ").append(duration.getEndTimestamp());
- if (!measurementConditions.isEmpty()) {
- for (KeyValue measurementCondition : measurementConditions) {
- query.append(" and ").append(measurementCondition.getKey()).append(" = \"")
- .append(measurementCondition.getValue()).append("\"");
- }
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- SessionPool sessionPool = client.getSessionPool();
- SessionDataSetWrapper wrapper = null;
- List<SelectedRecord> topEntities = new ArrayList<>();
- try {
- wrapper = sessionPool.executeQueryStatement(query.toString());
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, columnNames: {}", query, wrapper.getColumnNames());
- }
-
- Map<String, Double> entityIdAndSumMap = new HashMap<>();
- Map<String, Integer> entityIdAndCountMap = new HashMap<>();
- while (wrapper.hasNext()) {
- RowRecord rowRecord = wrapper.next();
- List<Field> fields = rowRecord.getFields();
- List<String> layerNames = Splitter.on(IoTDBClient.DOT + "\"").splitToList(fields.get(0).getStringValue());
- String entityId = IoTDBUtils.layerName2IndexValue(layerNames.get(2));
- double value = Double.parseDouble(fields.get(1).getStringValue());
- entityIdAndSumMap.merge(entityId, value, Double::sum);
- entityIdAndCountMap.merge(entityId, 1, Integer::sum);
- }
-
- entityIdAndSumMap.forEach((String entityId, Double sum) -> {
- double count = entityIdAndCountMap.get(entityId);
- double avg = sum / count;
- SelectedRecord topNEntity = new SelectedRecord();
- topNEntity.setId(entityId);
- topNEntity.setValue(String.valueOf((long) avg));
- topEntities.add(topNEntity);
- });
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- throw new IOException(e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
-
- if (condition.getOrder().equals(Order.DES)) {
- topEntities.sort((SelectedRecord t1, SelectedRecord t2) ->
- Double.compare(Double.parseDouble(t2.getValue()),
- Double.parseDouble(t1.getValue())));
- } else {
- topEntities.sort(Comparator.comparingDouble((SelectedRecord t) -> Double.parseDouble(t.getValue())));
- }
- int limit = condition.getTopN();
- return limit > topEntities.size() ? topEntities : topEntities.subList(0, limit);
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBAlarmQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBAlarmQueryDAO.java
deleted file mode 100644
index 084731cc15..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBAlarmQueryDAO.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.common.base.Strings;
-import java.io.IOException;
-import java.util.List;
-import java.util.Objects;
-import lombok.RequiredArgsConstructor;
-import org.apache.skywalking.oap.server.core.alarm.AlarmRecord;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.Tag;
-import org.apache.skywalking.oap.server.core.query.enumeration.Scope;
-import org.apache.skywalking.oap.server.core.query.type.AlarmMessage;
-import org.apache.skywalking.oap.server.core.query.type.Alarms;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.query.IAlarmQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@RequiredArgsConstructor
-public class IoTDBAlarmQueryDAO implements IAlarmQueryDAO {
- private final IoTDBClient client;
- private final StorageBuilder<AlarmRecord> storageBuilder = new AlarmRecord.Builder();
-
- @Override
- public Alarms getAlarm(Integer scopeId, String keyword, int limit, int from,
- long startTB, long endTB, List<Tag> tags)
- throws IOException {
- StringBuilder query = new StringBuilder();
- // This method maybe have poor efficiency. It queries all data which meets a condition without select function.
- // https://github.com/apache/iotdb/discussions/3888
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, AlarmRecord.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(AlarmRecord.INDEX_NAME, query);
-
- StringBuilder where = new StringBuilder(" where ");
- if (Objects.nonNull(scopeId)) {
- where.append(AlarmRecord.SCOPE).append(" = ").append(scopeId).append(" and ");
- }
- if (startTB != 0 && endTB != 0) {
- where.append(IoTDBClient.TIME).append(" >= ").append(TimeBucket.getTimestamp(startTB)).append(" and ");
- where.append(IoTDBClient.TIME).append(" <= ").append(TimeBucket.getTimestamp(endTB)).append(" and ");
- }
- if (!Strings.isNullOrEmpty(keyword)) {
- where.append(AlarmRecord.ALARM_MESSAGE).append(" like '%").append(keyword).append("%'").append(" and ");
- }
- if (CollectionUtils.isNotEmpty(tags)) {
- for (final Tag tag : tags) {
- where.append(tag.getKey()).append(" = \"").append(tag.getValue()).append("\"").append(" and ");
- }
- }
- if (where.length() > 7) {
- int length = where.length();
- where.delete(length - 5, length);
- query.append(where);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- Alarms alarms = new Alarms();
- List<? super StorageData> storageDataList = client.filterQuery(AlarmRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- int limitCount = 0;
- for (int i = from; i < storageDataList.size(); i++) {
- if (limitCount < limit) {
- limitCount++;
- AlarmRecord alarmRecord = (AlarmRecord) storageDataList.get(i);
- alarms.getMsgs().add(parseMessage(alarmRecord));
- }
- }
- alarms.setTotal(storageDataList.size());
- // resort by self, because of the select query result order by time.
- alarms.getMsgs().sort((AlarmMessage m1, AlarmMessage m2) ->
- Long.compare(m2.getStartTime(), m1.getStartTime()));
- return alarms;
- }
-
- private AlarmMessage parseMessage(AlarmRecord alarmRecord) {
- AlarmMessage message = new AlarmMessage();
- message.setId(alarmRecord.getId0());
- message.setId1(alarmRecord.getId1());
- message.setMessage(alarmRecord.getAlarmMessage());
- message.setStartTime(alarmRecord.getStartTime());
- message.setScope(Scope.Finder.valueOf(alarmRecord.getScope()));
- message.setScopeId(alarmRecord.getScope());
- if (!CollectionUtils.isEmpty(alarmRecord.getTagsRawData())) {
- parserDataBinary(alarmRecord.getTagsRawData(), message.getTags());
- }
- return message;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBBrowserLogQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBBrowserLogQueryDAO.java
deleted file mode 100644
index 4d0cada97f..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBBrowserLogQueryDAO.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.protobuf.InvalidProtocolBufferException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.browser.manual.errorlog.BrowserErrorLogRecord;
-import org.apache.skywalking.oap.server.core.browser.source.BrowserErrorCategory;
-import org.apache.skywalking.oap.server.core.query.type.BrowserErrorLog;
-import org.apache.skywalking.oap.server.core.query.type.BrowserErrorLogs;
-import org.apache.skywalking.oap.server.core.query.type.ErrorCategory;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.query.IBrowserLogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBBrowserLogQueryDAO implements IBrowserLogQueryDAO {
- private final IoTDBClient client;
- private final StorageBuilder<BrowserErrorLogRecord> storageBuilder = new BrowserErrorLogRecord.Builder();
-
- @Override
- public BrowserErrorLogs queryBrowserErrorLogs(String serviceId, String serviceVersionId, String pagePathId,
- BrowserErrorCategory category, long startSecondTB,
- long endSecondTB, int limit, int from)
- throws IOException {
- StringBuilder query = new StringBuilder();
- // This method maybe have poor efficiency. It queries all data which meets a condition without select function.
- // https://github.com/apache/iotdb/discussions/3888
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, BrowserErrorLogRecord.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- if (StringUtil.isNotEmpty(serviceId)) {
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceId);
- }
- IoTDBUtils.addQueryIndexValue(BrowserErrorLogRecord.INDEX_NAME, query, indexAndValueMap);
-
- StringBuilder where = new StringBuilder(" where ");
- if (startSecondTB != 0 && endSecondTB != 0) {
- where.append(IoTDBClient.TIME).append(" >= ")
- .append(TimeBucket.getTimestamp(startSecondTB))
- .append(" and ");
- where.append(IoTDBClient.TIME).append(" <= ")
- .append(TimeBucket.getTimestamp(endSecondTB))
- .append(" and ");
- }
- if (StringUtil.isNotEmpty(serviceVersionId)) {
- where.append(BrowserErrorLogRecord.SERVICE_VERSION_ID)
- .append(" = \"").append(serviceVersionId).append("\"")
- .append(" and ");
- }
- if (StringUtil.isNotEmpty(pagePathId)) {
- where.append(BrowserErrorLogRecord.PAGE_PATH_ID)
- .append(" = \"").append(pagePathId).append("\"")
- .append(" and ");
- }
- if (Objects.nonNull(category)) {
- where.append(BrowserErrorLogRecord.ERROR_CATEGORY)
- .append(" = ").append(category.getValue())
- .append(" and ");
- }
- if (where.length() > 7) {
- int length = where.length();
- where.delete(length - 5, length);
- query.append(where);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(BrowserErrorLogRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- List<BrowserErrorLogRecord> browserErrorLogRecordList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData -> browserErrorLogRecordList.add((BrowserErrorLogRecord) storageData));
- // resort by self, because of the select query result order by time.
- browserErrorLogRecordList.sort((BrowserErrorLogRecord b1, BrowserErrorLogRecord b2) ->
- Long.compare(b2.getTimestamp(), b1.getTimestamp()));
- BrowserErrorLogs logs = new BrowserErrorLogs();
- int limitCount = 0;
- for (int i = from; i < browserErrorLogRecordList.size(); i++) {
- if (limitCount < limit) {
- limitCount++;
- BrowserErrorLogRecord record = browserErrorLogRecordList.get(i);
- if (CollectionUtils.isNotEmpty(record.getDataBinary())) {
- BrowserErrorLog log = iotdbParserDataBinary(record.getDataBinary());
- logs.getLogs().add(log);
- }
- }
- }
- logs.setTotal(storageDataList.size());
- return logs;
- }
-
- private BrowserErrorLog iotdbParserDataBinary(byte[] dataBinaryBase64) {
- try {
- BrowserErrorLog log = new BrowserErrorLog();
- org.apache.skywalking.apm.network.language.agent.v3.BrowserErrorLog browserErrorLog = org.apache.skywalking.apm.network.language.agent.v3.BrowserErrorLog
- .parseFrom(dataBinaryBase64);
- log.setService(browserErrorLog.getService());
- log.setServiceVersion(browserErrorLog.getServiceVersion());
- log.setTime(browserErrorLog.getTime());
- log.setPagePath(browserErrorLog.getPagePath());
- log.setCategory(ErrorCategory.valueOf(browserErrorLog.getCategory().name().toUpperCase()));
- log.setGrade(browserErrorLog.getGrade());
- log.setMessage(browserErrorLog.getMessage());
- log.setLine(browserErrorLog.getLine());
- log.setCol(browserErrorLog.getCol());
- log.setStack(browserErrorLog.getStack());
- log.setErrorUrl(browserErrorLog.getErrorUrl());
- log.setFirstReportedError(browserErrorLog.getFirstReportedError());
-
- return log;
- } catch (InvalidProtocolBufferException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEBPFProfilingDataDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEBPFProfilingDataDAO.java
deleted file mode 100644
index ef13debe4d..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEBPFProfilingDataDAO.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingDataRecord;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingDataDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBEBPFProfilingDataDAO implements IEBPFProfilingDataDAO {
- private final IoTDBClient client;
- private final StorageBuilder<EBPFProfilingDataRecord> storageBuilder = new EBPFProfilingDataRecord.Builder();
-
- @Override
- public List<EBPFProfilingDataRecord> queryData(List<String> scheduleIdList, long beginTime, long endTime)
- throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, EBPFProfilingDataRecord.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- IoTDBUtils.addQueryIndexValue(EBPFProfilingDataRecord.INDEX_NAME, query, indexAndValueMap);
-
- StringBuilder where = new StringBuilder(" where ");
- where.append(EBPFProfilingDataRecord.SCHEDULE_ID).append(" in (").append(
- scheduleIdList.stream().map(s -> "\"" + s + "\"").collect(Collectors.joining(","))).append(") and ");
- where.append(EBPFProfilingDataRecord.UPLOAD_TIME).append(" >= ").append(beginTime).append(" and ");
- where.append(EBPFProfilingDataRecord.UPLOAD_TIME).append(" <= ").append(endTime).append(" and ");
- if (where.length() > 7) {
- int length = where.length();
- where.delete(length - 5, length);
- query.append(where);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(EBPFProfilingDataRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- List<EBPFProfilingDataRecord> dataList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData -> dataList.add((EBPFProfilingDataRecord) storageData));
- return dataList;
- }
-}
\ No newline at end of file
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEBPFProfilingScheduleDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEBPFProfilingScheduleDAO.java
deleted file mode 100644
index bd36f3171b..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEBPFProfilingScheduleDAO.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingScheduleRecord;
-import org.apache.skywalking.oap.server.core.query.type.EBPFProfilingSchedule;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingScheduleDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBEBPFProfilingScheduleDAO implements IEBPFProfilingScheduleDAO {
- private final IoTDBClient client;
- private final StorageBuilder<EBPFProfilingScheduleRecord> storageBuilder = new EBPFProfilingScheduleRecord.Builder();
-
- @Override
- public List<EBPFProfilingSchedule> querySchedules(String taskId) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, EBPFProfilingScheduleRecord.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(EBPFProfilingScheduleRecord.INDEX_NAME, query);
-
- StringBuilder where = new StringBuilder(" where ");
- where.append(EBPFProfilingScheduleRecord.TASK_ID).append(" = \"").append(taskId);
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(EBPFProfilingScheduleRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- List<EBPFProfilingSchedule> scheduleList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData -> scheduleList.add(parseSchedule((EBPFProfilingScheduleRecord) storageData)));
- return scheduleList;
- }
-
- public EBPFProfilingSchedule parseSchedule(EBPFProfilingScheduleRecord traffic) {
- final EBPFProfilingSchedule schedule = new EBPFProfilingSchedule();
- schedule.setTaskId(traffic.getTaskId());
- schedule.setScheduleId(traffic.id());
- schedule.setProcessId(traffic.getProcessId());
- schedule.setStartTime(traffic.getStartTime());
- schedule.setEndTime(traffic.getEndTime());
- return schedule;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEBPFProfilingTaskDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEBPFProfilingTaskDAO.java
deleted file mode 100644
index cbdf8b4853..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEBPFProfilingTaskDAO.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.gson.Gson;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingTargetType;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingTaskRecord;
-import org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingTriggerType;
-import org.apache.skywalking.oap.server.core.query.type.EBPFProfilingTask;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IEBPFProfilingTaskDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBEBPFProfilingTaskDAO implements IEBPFProfilingTaskDAO {
- private static final Gson GSON = new Gson();
-
- private final IoTDBClient client;
- private final StorageBuilder<EBPFProfilingTaskRecord> storageBuilder = new EBPFProfilingTaskRecord.Builder();
-
- @Override
- public List<EBPFProfilingTask> queryTasks(List<String> serviceIdList,
- EBPFProfilingTargetType targetType,
- long taskStartTime, long latestUpdateTime)
- throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, EBPFProfilingTaskRecord.INDEX_NAME);
- for (int i = 0; i < serviceIdList.size(); i++) {
- if (i > 0) {
- query.append(", ");
- }
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceIdList.get(i));
- IoTDBUtils.addQueryIndexValue(EBPFProfilingTaskRecord.INDEX_NAME, query, indexAndValueMap);
- }
-
- StringBuilder where = new StringBuilder(" where ");
- if (taskStartTime > 0) {
- where.append(EBPFProfilingTaskRecord.START_TIME)
- .append(" >= ").append(taskStartTime)
- .append(" and ");
- }
- if (latestUpdateTime > 0) {
- where.append(EBPFProfilingTaskRecord.LAST_UPDATE_TIME)
- .append(" > ").append(latestUpdateTime)
- .append(" and ");
- }
- if (where.length() > 7) {
- int length = where.length();
- where.delete(length - 5, length);
- query.append(where);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(EBPFProfilingTaskRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- List<EBPFProfilingTask> taskList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData -> taskList.add(parseTask((EBPFProfilingTaskRecord) storageData)));
- return taskList;
- }
-
- private EBPFProfilingTask parseTask(EBPFProfilingTaskRecord record) {
- final EBPFProfilingTask task = new EBPFProfilingTask();
- task.setTaskId(record.id());
- task.setServiceId(record.getServiceId());
- task.setServiceName(IDManager.ServiceID.analysisId(record.getServiceId()).getName());
- final String processLabelsJson = record.getProcessLabelsJson();
- if (StringUtil.isNotEmpty(processLabelsJson)) {
- task.setProcessLabels(GSON.<List<String>>fromJson(processLabelsJson, ArrayList.class));
- } else {
- task.setProcessLabels(Collections.emptyList());
- }
- task.setTaskStartTime(record.getStartTime());
- task.setTriggerType(EBPFProfilingTriggerType.valueOf(record.getTriggerType()));
- task.setFixedTriggerDuration(record.getFixedTriggerDuration());
- task.setTargetType(EBPFProfilingTargetType.valueOf(record.getTargetType()));
- task.setCreateTime(record.getCreateTime());
- task.setLastUpdateTime(record.getLastUpdateTime());
- return task;
- }
-}
\ No newline at end of file
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEventQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEventQueryDAO.java
deleted file mode 100644
index 681730b56e..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBEventQueryDAO.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.common.base.Strings;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Objects;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.query.PaginationUtils;
-import org.apache.skywalking.oap.server.core.query.enumeration.Order;
-import org.apache.skywalking.oap.server.core.query.input.Duration;
-import org.apache.skywalking.oap.server.core.query.type.event.EventQueryCondition;
-import org.apache.skywalking.oap.server.core.query.type.event.EventType;
-import org.apache.skywalking.oap.server.core.query.type.event.Events;
-import org.apache.skywalking.oap.server.core.query.type.event.Source;
-import org.apache.skywalking.oap.server.core.source.Event;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.query.IEventQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBEventQueryDAO implements IEventQueryDAO {
- private final IoTDBClient client;
- private final StorageBuilder<Event> storageBuilder = new Event.Builder();
-
- @Override
- public Events queryEvents(EventQueryCondition condition) throws Exception {
- // This method maybe have poor efficiency. It queries all data which meets a condition without select function.
- // https://github.com/apache/iotdb/discussions/3888
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, Event.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(Event.INDEX_NAME, query);
- StringBuilder where = whereSQL(condition);
- if (where.length() > 0) {
- query.append(" where ").append(where);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(Event.INDEX_NAME,
- query.toString(), storageBuilder);
- final Events events = new Events();
- int limitCount = 0;
- PaginationUtils.Page page = PaginationUtils.INSTANCE.exchange(condition.getPaging());
- for (int i = page.getFrom(); i < storageDataList.size(); i++) {
- if (limitCount < page.getLimit()) {
- limitCount++;
- Event event = (Event) storageDataList.get(i);
- events.getEvents().add(parseEvent(event));
- }
- }
- events.setTotal(storageDataList.size());
- // resort by self, because of the select query result order by time.
- final Order order = Objects.isNull(condition.getOrder()) ? Order.DES : condition.getOrder();
- if (Order.DES.equals(order)) {
- events.getEvents().sort(
- (org.apache.skywalking.oap.server.core.query.type.event.Event e1,
- org.apache.skywalking.oap.server.core.query.type.event.Event e2)
- -> Long.compare(e2.getStartTime(), e1.getStartTime()));
- } else {
- events.getEvents().sort(
- Comparator.comparingLong(org.apache.skywalking.oap.server.core.query.type.event.Event::getStartTime));
- }
- return events;
- }
-
- @Override
- public Events queryEvents(List<EventQueryCondition> conditionList) throws Exception {
- // This method maybe have poor efficiency. It queries all data which meets a condition without select function.
- // https://github.com/apache/iotdb/discussions/3888
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, Event.INDEX_NAME);
- IoTDBUtils.addQueryAsterisk(Event.INDEX_NAME, query);
- StringBuilder where = whereSQL(conditionList);
- if (where.length() > 0) {
- query.append(" where ").append(where);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(Event.INDEX_NAME, query.toString(), storageBuilder);
- final Events events = new Events();
- EventQueryCondition condition = conditionList.get(0);
- int limitCount = 0;
- PaginationUtils.Page page = PaginationUtils.INSTANCE.exchange(condition.getPaging());
- for (int i = page.getFrom(); i < storageDataList.size(); i++) {
- if (limitCount < page.getLimit()) {
- limitCount++;
- Event event = (Event) storageDataList.get(i);
- events.getEvents().add(parseEvent(event));
- }
- }
- events.setTotal(storageDataList.size());
- // resort by self, because of the select query result order by time.
- final Order order = Objects.isNull(condition.getOrder()) ? Order.DES : condition.getOrder();
- if (Order.DES.equals(order)) {
- events.getEvents().sort(
- (org.apache.skywalking.oap.server.core.query.type.event.Event e1,
- org.apache.skywalking.oap.server.core.query.type.event.Event e2)
- -> Long.compare(e2.getStartTime(), e1.getStartTime()));
- } else {
- events.getEvents().sort(
- Comparator.comparingLong(org.apache.skywalking.oap.server.core.query.type.event.Event::getStartTime));
- }
- return events;
- }
-
- private StringBuilder whereSQL(final EventQueryCondition condition) {
- StringBuilder where = new StringBuilder();
- if (!Strings.isNullOrEmpty(condition.getUuid())) {
- where.append(Event.UUID).append(" = \"").append(condition.getUuid()).append("\"").append(" and ");
- }
- final Source source = condition.getSource();
- if (source != null) {
- if (!Strings.isNullOrEmpty(source.getService())) {
- where.append(Event.SERVICE).append(" = \"")
- .append(source.getService()).append("\"")
- .append(" and ");
- }
- if (!Strings.isNullOrEmpty(source.getServiceInstance())) {
- where.append(Event.SERVICE_INSTANCE).append(" = \"")
- .append(source.getServiceInstance()).append("\"")
- .append(" and ");
- }
- if (!Strings.isNullOrEmpty(source.getEndpoint())) {
- where.append(Event.ENDPOINT).append(" = \"")
- .append(source.getEndpoint()).append("\"")
- .append(" and ");
- }
- }
- if (!Strings.isNullOrEmpty(condition.getName())) {
- where.append(Event.NAME).append(" = \"")
- .append(condition.getName()).append("\"")
- .append(" and ");
- }
- if (condition.getType() != null) {
- where.append(Event.TYPE).append(" = \"")
- .append(condition.getType().name()).append("\"")
- .append(" and ");
- }
- final Duration time = condition.getTime();
- if (time != null) {
- if (time.getStartTimestamp() > 0) {
- where.append(Event.START_TIME).append(" > ")
- .append(time.getStartTimestamp())
- .append(" and ");
- }
- if (time.getEndTimestamp() > 0) {
- where.append(Event.END_TIME).append(" < ")
- .append(time.getEndTimestamp())
- .append(" and ");
- }
- }
- if (!Strings.isNullOrEmpty(condition.getLayer())) {
- where.append(Event.LAYER).append(" = \"").append(condition.getLayer()).append("\"").append(" and ");
- }
- if (where.length() > 0) {
- int length = where.length();
- where.delete(length - 5, length);
- return where;
- }
- return new StringBuilder();
- }
-
- private StringBuilder whereSQL(final List<EventQueryCondition> conditions) {
- StringBuilder where = new StringBuilder();
- boolean isFirstCondition = true;
- for (EventQueryCondition condition : conditions) {
- StringBuilder subWhere = whereSQL(condition);
- if (subWhere.length() > 0) {
- if (isFirstCondition) {
- where.append("(").append(subWhere).append(")");
- isFirstCondition = false;
- } else {
- where.append(" or (").append(subWhere).append(")");
-
- }
- }
- }
- return where;
- }
-
- private org.apache.skywalking.oap.server.core.query.type.event.Event parseEvent(final Event event) {
- final org.apache.skywalking.oap.server.core.query.type.event.Event resultEvent =
- new org.apache.skywalking.oap.server.core.query.type.event.Event();
- resultEvent.setUuid(event.getUuid());
- resultEvent.setSource(new Source(event.getService(), event.getServiceInstance(), event.getEndpoint()));
- resultEvent.setName(event.getName());
- resultEvent.setType(EventType.parse(event.getType()));
- resultEvent.setMessage(event.getMessage());
- resultEvent.setParameters(event.getParameters());
- resultEvent.setStartTime(event.getStartTime());
- resultEvent.setEndTime(event.getEndTime());
- resultEvent.setLayer(event.getLayer().name());
- return resultEvent;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBLogQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBLogQueryDAO.java
deleted file mode 100644
index e7192b2461..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBLogQueryDAO.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.protobuf.InvalidProtocolBufferException;
-import java.io.IOException;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.apm.network.logging.v3.LogTags;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.log.LogRecord;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.Tag;
-import org.apache.skywalking.oap.server.core.query.enumeration.Order;
-import org.apache.skywalking.oap.server.core.query.input.TraceScopeCondition;
-import org.apache.skywalking.oap.server.core.query.type.ContentType;
-import org.apache.skywalking.oap.server.core.query.type.KeyValue;
-import org.apache.skywalking.oap.server.core.query.type.Log;
-import org.apache.skywalking.oap.server.core.query.type.Logs;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.query.ILogQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.util.CollectionUtils;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBLogQueryDAO implements ILogQueryDAO {
- private final IoTDBClient client;
- private final StorageBuilder<LogRecord> storageBuilder = new LogRecord.Builder();
-
- @Override
- public Logs queryLogs(String serviceId, String serviceInstanceId, String endpointId,
- TraceScopeCondition relatedTrace, Order queryOrder, int from, int limit, long startTB,
- long endTB, List<Tag> tags, List<String> keywordsOfContent,
- List<String> excludingKeywordsOfContent) throws IOException {
- StringBuilder query = new StringBuilder();
- // This method maybe have poor efficiency. It queries all data which meets a condition without select function.
- // https://github.com/apache/iotdb/discussions/3888
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, LogRecord.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- if (StringUtil.isNotEmpty(serviceId)) {
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceId);
- }
- if (Objects.nonNull(relatedTrace) && StringUtil.isNotEmpty(relatedTrace.getTraceId())) {
- indexAndValueMap.put(IoTDBIndexes.TRACE_ID_IDX, relatedTrace.getTraceId());
- }
- IoTDBUtils.addQueryIndexValue(LogRecord.INDEX_NAME, query, indexAndValueMap);
-
- StringBuilder where = new StringBuilder(" where ");
- if (startTB != 0 && endTB != 0) {
- where.append(IoTDBClient.TIME).append(" >= ")
- .append(TimeBucket.getTimestamp(startTB))
- .append(" and ");
- where.append(IoTDBClient.TIME).append(" <= ")
- .append(TimeBucket.getTimestamp(endTB))
- .append(" and ");
- }
- if (StringUtil.isNotEmpty(serviceInstanceId)) {
- where.append(AbstractLogRecord.SERVICE_INSTANCE_ID)
- .append(" = \"").append(serviceInstanceId).append("\"")
- .append(" and ");
- }
- if (StringUtil.isNotEmpty(endpointId)) {
- where.append(AbstractLogRecord.ENDPOINT_ID)
- .append(" = \"").append(endpointId).append("\"")
- .append(" and ");
- }
- if (Objects.nonNull(relatedTrace)) {
- if (StringUtil.isNotEmpty(relatedTrace.getSegmentId())) {
- where.append(AbstractLogRecord.TRACE_SEGMENT_ID)
- .append(" = \"").append(relatedTrace.getSegmentId()).append("\"")
- .append(" and ");
- }
- if (Objects.nonNull(relatedTrace.getSpanId())) {
- where.append(AbstractLogRecord.SPAN_ID)
- .append(" = ").append(relatedTrace.getSpanId())
- .append(" and ");
- }
- }
- if (CollectionUtils.isNotEmpty(tags)) {
- for (final Tag tag : tags) {
- where.append(tag.getKey()).append(" = \"")
- .append(tag.getValue()).append("\"")
- .append(" and ");
- }
- }
- if (where.length() > 7) {
- int length = where.length();
- where.delete(length - 5, length);
- query.append(where);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- Logs logs = new Logs();
- List<? super StorageData> storageDataList = client.filterQuery(LogRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- int limitCount = 0;
- for (int i = from; i < storageDataList.size(); i++) {
- if (limitCount < limit) {
- limitCount++;
- LogRecord logRecord = (LogRecord) storageDataList.get(i);
- Log log = new Log();
- log.setServiceId(logRecord.getServiceId());
- log.setServiceInstanceId(logRecord.getServiceInstanceId());
- log.setEndpointId(logRecord.getEndpointId());
- log.setTraceId(logRecord.getTraceId());
- log.setTimestamp(logRecord.getTimestamp());
- log.setContentType(ContentType.instanceOf(logRecord.getContentType()));
- log.setContent(logRecord.getContent());
- if (CollectionUtils.isNotEmpty(logRecord.getTagsRawData())) {
- iotdbParserDataBinary(logRecord.getTagsRawData(), log.getTags());
- }
- logs.getLogs().add(log);
- }
- }
- logs.setTotal(storageDataList.size());
- // resort by self, because of the select query result order by time.
- if (Order.DES.equals(queryOrder)) {
- logs.getLogs().sort((Log l1, Log l2) -> Long.compare(l2.getTimestamp(), l1.getTimestamp()));
- } else {
- logs.getLogs().sort(Comparator.comparingLong(Log::getTimestamp));
- }
- return logs;
- }
-
- private void iotdbParserDataBinary(byte[] tagsRawData, List<KeyValue> tags) {
- try {
- LogTags logTags = LogTags.parseFrom(tagsRawData);
- logTags.getDataList().forEach(pair -> tags.add(new KeyValue(pair.getKey(), pair.getValue())));
- } catch (InvalidProtocolBufferException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetadataQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetadataQueryDAO.java
deleted file mode 100644
index 2e41eef4c5..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetadataQueryDAO.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.common.base.Strings;
-import com.google.gson.Gson;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.Const;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.analysis.Layer;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.instance.InstanceTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessDetectType;
-import org.apache.skywalking.oap.server.core.analysis.manual.process.ProcessTraffic;
-import org.apache.skywalking.oap.server.core.analysis.manual.service.ServiceTraffic;
-import org.apache.skywalking.oap.server.core.query.enumeration.Language;
-import org.apache.skywalking.oap.server.core.query.enumeration.ProfilingSupportStatus;
-import org.apache.skywalking.oap.server.core.query.type.Attribute;
-import org.apache.skywalking.oap.server.core.query.type.Endpoint;
-import org.apache.skywalking.oap.server.core.query.type.Process;
-import org.apache.skywalking.oap.server.core.query.type.Service;
-import org.apache.skywalking.oap.server.core.query.type.ServiceInstance;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.query.IMetadataQueryDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBMetadataQueryDAO implements IMetadataQueryDAO {
- private static final Gson GSON = new Gson();
-
- private final IoTDBClient client;
- private final StorageBuilder<ServiceTraffic> serviceBuilder = new ServiceTraffic.Builder();
- private final StorageBuilder<EndpointTraffic> endpointBuilder = new EndpointTraffic.Builder();
- private final StorageBuilder<InstanceTraffic> instanceBuilder = new InstanceTraffic.Builder();
- private final StorageBuilder<ProcessTraffic> processBuilder = new ProcessTraffic.Builder();
-
- @Override
- public List<Service> listServices(final String layer, final String group) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ServiceTraffic.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- if (StringUtil.isNotEmpty(layer)) {
- indexAndValueMap.put(IoTDBIndexes.LAYER_IDX, String.valueOf(Layer.valueOf(layer).value()));
- }
- if (StringUtil.isNotEmpty(group)) {
- indexAndValueMap.put(IoTDBIndexes.GROUP_IDX, group);
- }
- IoTDBUtils.addQueryIndexValue(ServiceTraffic.INDEX_NAME, query, indexAndValueMap);
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ServiceTraffic.INDEX_NAME,
- query.toString(), serviceBuilder);
- return buildServices(storageDataList);
- }
-
- @Override
- public List<Service> getServices(final String serviceId) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ServiceTraffic.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceId);
- IoTDBUtils.addQueryIndexValue(ServiceTraffic.INDEX_NAME, query, indexAndValueMap);
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ServiceTraffic.INDEX_NAME,
- query.toString(), serviceBuilder);
- return buildServices(storageDataList);
- }
-
- @Override
- public List<ServiceInstance> listInstances(long startTimestamp, long endTimestamp, String serviceId)
- throws IOException {
- final long minuteTimeBucket = TimeBucket.getMinuteTimeBucket(startTimestamp);
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, InstanceTraffic.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceId);
- IoTDBUtils.addQueryIndexValue(InstanceTraffic.INDEX_NAME, query, indexAndValueMap);
- query.append(" where ").append(InstanceTraffic.LAST_PING_TIME_BUCKET).append(" >= ").append(minuteTimeBucket)
- .append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(InstanceTraffic.INDEX_NAME,
- query.toString(), instanceBuilder);
- return buildInstances(storageDataList);
- }
-
- @Override
- public ServiceInstance getInstance(final String instanceId) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ServiceTraffic.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.ID_IDX, instanceId);
- IoTDBUtils.addQueryIndexValue(ServiceTraffic.INDEX_NAME, query, indexAndValueMap);
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ServiceTraffic.INDEX_NAME,
- query.toString(), serviceBuilder);
- final List<ServiceInstance> instances = buildInstances(storageDataList);
- return instances.size() > 0 ? instances.get(0) : null;
- }
-
- @Override
- public List<Endpoint> findEndpoint(String keyword, String serviceId, int limit) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, EndpointTraffic.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceId);
- IoTDBUtils.addQueryIndexValue(EndpointTraffic.INDEX_NAME, query, indexAndValueMap);
- if (!Strings.isNullOrEmpty(keyword)) {
- query.append(" where ").append(EndpointTraffic.NAME).append(" like '%").append(keyword).append("%'");
- }
- query.append(" limit ").append(limit).append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(EndpointTraffic.INDEX_NAME,
- query.toString(), endpointBuilder);
- List<Endpoint> endpointList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData -> {
- EndpointTraffic endpointTraffic = (EndpointTraffic) storageData;
- Endpoint endpoint = new Endpoint();
- endpoint.setId(endpointTraffic.id());
- endpoint.setName(endpointTraffic.getName());
- endpointList.add(endpoint);
- });
- return endpointList;
- }
-
- @Override
- public List<Process> listProcesses(String serviceId, String instanceId, String agentId,
- final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
- final long lastPingEndTimeBucket)
- throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- appendProcessFromQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
- lastPingStartTimeBucket, lastPingEndTimeBucket);
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ProcessTraffic.INDEX_NAME,
- query.toString(), processBuilder);
- return buildProcesses(storageDataList);
- }
-
- @Override
- public long getProcessesCount(String serviceId, String instanceId, String agentId,
- final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
- final long lastPingEndTimeBucket) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select count(*) from ");
- appendProcessFromQuery(query, serviceId, instanceId, agentId, profilingSupportStatus,
- lastPingStartTimeBucket, lastPingEndTimeBucket);
-
- final List<Double> results = client.queryWithAgg(query.toString());
- return results.size() > 0 ? results.get(0).longValue() : 0;
- }
-
- private void appendProcessFromQuery(StringBuilder query, String serviceId, String instanceId, String agentId,
- final ProfilingSupportStatus profilingSupportStatus, final long lastPingStartTimeBucket,
- final long lastPingEndTimeBucket) {
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ProcessTraffic.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- if (StringUtil.isNotEmpty(serviceId)) {
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceId);
- }
- if (StringUtil.isNotEmpty(instanceId)) {
- indexAndValueMap.put(IoTDBIndexes.INSTANCE_ID_INX, instanceId);
- }
- if (StringUtil.isNotEmpty(agentId)) {
- indexAndValueMap.put(IoTDBIndexes.AGENT_ID_INX, agentId);
- }
- IoTDBUtils.addQueryIndexValue(ProcessTraffic.INDEX_NAME, query, indexAndValueMap);
-
- StringBuilder where = new StringBuilder();
- if (lastPingStartTimeBucket > 0) {
- where.append(ProcessTraffic.LAST_PING_TIME_BUCKET).append(" >= ").append(lastPingStartTimeBucket);
- }
- if (lastPingEndTimeBucket > 0) {
- if (where.length() > 0) {
- where.append(" and ");
- }
- where.append(ProcessTraffic.LAST_PING_TIME_BUCKET).append(" <= ").append(lastPingEndTimeBucket);
- }
- if (profilingSupportStatus != null) {
- if (where.length() > 0) {
- where.append(" and ");
- }
- where.append(ProcessTraffic.PROFILING_SUPPORT_STATUS).append(" = ").append(profilingSupportStatus.value());
- }
- if (where.length() > 0) {
- query.append(" where ").append(where);
- }
- }
-
- @Override
- public Process getProcess(String processId) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ProcessTraffic.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.ID_IDX, processId);
- IoTDBUtils.addQueryIndexValue(ProcessTraffic.INDEX_NAME, query, indexAndValueMap);
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ProcessTraffic.INDEX_NAME,
- query.toString(), processBuilder);
- final List<Process> processes = buildProcesses(storageDataList);
- return processes.size() > 0 ? processes.get(0) : null;
- }
-
- private List<Service> buildServices(List<? super StorageData> storageDataList) {
- List<Service> services = new ArrayList<>();
- storageDataList.forEach(storageData -> {
- ServiceTraffic serviceTraffic = (ServiceTraffic) storageData;
- String serviceName = serviceTraffic.getName();
- Service service = new Service();
- service.setId(serviceTraffic.getServiceId());
- service.setName(serviceName);
- service.setShortName(serviceTraffic.getShortName());
- service.setGroup(serviceTraffic.getGroup());
- service.getLayers().add(serviceTraffic.getLayer().name());
- services.add(service);
- });
- return services;
- }
-
- private List<ServiceInstance> buildInstances(List<? super StorageData> storageDataList) {
- List<ServiceInstance> serviceInstanceList = new ArrayList<>(storageDataList.size());
- storageDataList.forEach(storageData -> {
- InstanceTraffic instanceTraffic = (InstanceTraffic) storageData;
- if (instanceTraffic.getName() == null) {
- instanceTraffic.setName(Const.EMPTY_STRING);
- }
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setId(instanceTraffic.id());
- serviceInstance.setName(instanceTraffic.getName());
- serviceInstance.setInstanceUUID(serviceInstance.getId());
-
- JsonObject properties = instanceTraffic.getProperties();
- if (properties != null) {
- for (Map.Entry<String, JsonElement> property : properties.entrySet()) {
- String key = property.getKey();
- String value = property.getValue().getAsString();
- if (key.equals(InstanceTraffic.PropertyUtil.LANGUAGE)) {
- serviceInstance.setLanguage(Language.value(value));
- } else {
- serviceInstance.getAttributes().add(new Attribute(key, value));
- }
- }
- } else {
- serviceInstance.setLanguage(Language.UNKNOWN);
- }
- serviceInstanceList.add(serviceInstance);
- });
- return serviceInstanceList;
- }
-
- private List<Process> buildProcesses(List<? super StorageData> storageDataList) {
- List<Process> processes = new ArrayList<>();
- storageDataList.forEach(storageData -> {
- ProcessTraffic processTraffic = (ProcessTraffic) storageData;
- Process process = new Process();
- process.setId(processTraffic.id());
- process.setName(processTraffic.getName());
- final String serviceId = processTraffic.getServiceId();
- process.setServiceId(serviceId);
- process.setServiceName(IDManager.ServiceID.analysisId(serviceId).getName());
- final String instanceId = processTraffic.getInstanceId();
- process.setInstanceId(instanceId);
- process.setInstanceName(IDManager.ServiceInstanceID.analysisId(instanceId).getName());
- process.setAgentId(processTraffic.getAgentId());
- process.setDetectType(ProcessDetectType.valueOf(processTraffic.getDetectType()).name());
- JsonObject properties = processTraffic.getProperties();
- if (properties != null) {
- for (Map.Entry<String, JsonElement> property : properties.entrySet()) {
- String key = property.getKey();
- String value = property.getValue().getAsString();
- process.getAttributes().add(new Attribute(key, value));
- }
- }
- final String labelsJson = processTraffic.getLabelsJson();
- if (StringUtil.isNotEmpty(labelsJson)) {
- final List<String> labels = GSON.<List<String>>fromJson(labelsJson, ArrayList.class);
- process.getLabels().addAll(labels);
- }
- processes.add(process);
- });
- return processes;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetricsQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetricsQueryDAO.java
deleted file mode 100644
index 1f1cd8ab7b..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBMetricsQueryDAO.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.common.base.Splitter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.iotdb.rpc.IoTDBConnectionException;
-import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.iotdb.session.pool.SessionDataSetWrapper;
-import org.apache.iotdb.session.pool.SessionPool;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.Field;
-import org.apache.iotdb.tsfile.read.common.RowRecord;
-import org.apache.skywalking.oap.server.core.analysis.metrics.DataTable;
-import org.apache.skywalking.oap.server.core.query.PointOfTime;
-import org.apache.skywalking.oap.server.core.query.input.Duration;
-import org.apache.skywalking.oap.server.core.query.input.MetricsCondition;
-import org.apache.skywalking.oap.server.core.query.sql.Function;
-import org.apache.skywalking.oap.server.core.query.type.HeatMap;
-import org.apache.skywalking.oap.server.core.query.type.IntValues;
-import org.apache.skywalking.oap.server.core.query.type.KVInt;
-import org.apache.skywalking.oap.server.core.query.type.MetricsValues;
-import org.apache.skywalking.oap.server.core.storage.annotation.ValueColumnMetadata;
-import org.apache.skywalking.oap.server.core.storage.query.IMetricsQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBMetricsQueryDAO implements IMetricsQueryDAO {
- private final IoTDBClient client;
-
- @Override
- public long readMetricsValue(MetricsCondition condition,
- String valueColumnName,
- Duration duration)
- throws IOException {
- final int defaultValue = ValueColumnMetadata.INSTANCE.getDefaultValue(condition.getName());
- final Function function = ValueColumnMetadata.INSTANCE.getValueFunction(condition.getName());
- if (function == Function.Latest) {
- return readMetricsValues(condition, valueColumnName, duration).getValues().latestValue(defaultValue);
- }
-
- StringBuilder query = new StringBuilder();
- String op;
- if (function == Function.Avg) {
- op = "avg";
- } else {
- op = "sum";
- }
- query.append(String.format("select %s(%s) from ", op, valueColumnName));
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, condition.getName());
- final String entityId = condition.getEntity().buildId();
- if (entityId != null) {
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.ENTITY_ID_IDX, entityId);
- IoTDBUtils.addQueryIndexValue(condition.getName(), query, indexAndValueMap);
- } else {
- IoTDBUtils.addQueryAsterisk(condition.getName(), query);
- }
- query.append(" where ")
- .append(String.format("%s >= %s and %s <= %s",
- IoTDBClient.TIME, duration.getStartTimestamp(),
- IoTDBClient.TIME, duration.getEndTimestamp()))
- .append(" group by level = 3");
-
- List<Double> results = client.queryWithAgg(query.toString());
- if (results.size() > 0) {
- double result = results.get(0);
- return (long) result;
- } else {
- return defaultValue;
- }
- }
-
- @Override
- public MetricsValues readMetricsValues(final MetricsCondition condition,
- final String valueColumnName,
- final Duration duration) throws IOException {
- final List<PointOfTime> pointOfTimes = duration.assembleDurationPoints();
- final List<String> ids = new ArrayList<>(pointOfTimes.size());
- pointOfTimes.forEach(pointOfTime -> ids.add(pointOfTime.id(condition.getEntity().buildId())));
-
- StringBuilder query = new StringBuilder();
- query.append("select ").append(valueColumnName).append(" from ");
- for (String id : ids) {
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, condition.getName());
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.ID_IDX, id);
- IoTDBUtils.addQueryIndexValue(condition.getName(), query, indexAndValueMap);
- query.append(", ");
- }
- String queryString = query.toString();
- if (ids.size() > 0) {
- queryString = queryString.substring(0, queryString.lastIndexOf(","));
- }
- queryString += IoTDBClient.ALIGN_BY_DEVICE;
-
- SessionPool sessionPool = client.getSessionPool();
- SessionDataSetWrapper wrapper = null;
- MetricsValues metricsValues = new MetricsValues();
- // Label is null, because in readMetricsValues, no label parameter.
- final IntValues intValues = metricsValues.getValues();
- try {
- wrapper = sessionPool.executeQueryStatement(queryString);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, columnNames: {}", queryString, wrapper.getColumnNames());
- }
-
- while (wrapper.hasNext()) {
- RowRecord rowRecord = wrapper.next();
- List<Field> fields = rowRecord.getFields();
- List<String> layerNames = Splitter.on(IoTDBClient.DOT + "\"")
- .splitToList(fields.get(0).getStringValue());
- String id = IoTDBUtils.layerName2IndexValue(layerNames.get(1));
-
- Field valueField = fields.get(1);
- TSDataType valueType = valueField.getDataType();
- long value = 0;
- if (TSDataType.INT32.equals(valueType)) {
- value = valueField.getIntV();
- } else if (TSDataType.INT64.equals(valueType)) {
- value = valueField.getLongV();
- }
-
- KVInt kv = new KVInt();
- kv.setId(id);
- kv.setValue(value);
- intValues.addKVInt(kv);
- }
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- throw new IOException(e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
- metricsValues.setValues(
- Util.sortValues(intValues, ids,
- ValueColumnMetadata.INSTANCE.getDefaultValue(condition.getName())));
- return metricsValues;
- }
-
- @Override
- public List<MetricsValues> readLabeledMetricsValues(MetricsCondition condition,
- String valueColumnName,
- List<String> labels,
- Duration duration)
- throws IOException {
- final List<PointOfTime> pointOfTimes = duration.assembleDurationPoints();
- List<String> ids = new ArrayList<>(pointOfTimes.size());
- pointOfTimes.forEach(pointOfTime -> ids.add(pointOfTime.id(condition.getEntity().buildId())));
-
- StringBuilder query = new StringBuilder();
- query.append("select ").append(valueColumnName).append(" from ");
- for (String id : ids) {
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, condition.getName());
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.ID_IDX, id);
- IoTDBUtils.addQueryIndexValue(condition.getName(), query, indexAndValueMap);
- query.append(", ");
- }
- String queryString = query.toString();
- if (ids.size() > 0) {
- queryString = queryString.substring(0, queryString.lastIndexOf(","));
- }
- queryString += IoTDBClient.ALIGN_BY_DEVICE;
-
- SessionPool sessionPool = client.getSessionPool();
- SessionDataSetWrapper wrapper = null;
- Map<String, DataTable> idMap = new HashMap<>();
- try {
- wrapper = sessionPool.executeQueryStatement(queryString);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, columnNames: {}", queryString, wrapper.getColumnNames());
- }
-
- while (wrapper.hasNext()) {
- RowRecord rowRecord = wrapper.next();
- List<Field> fields = rowRecord.getFields();
- List<String> layerNames = Splitter.on(IoTDBClient.DOT + "\"")
- .splitToList(fields.get(0).getStringValue());
- String id = IoTDBUtils.layerName2IndexValue(layerNames.get(1));
-
- DataTable multipleValues = new DataTable(5);
- multipleValues.toObject(fields.get(1).getStringValue());
- idMap.put(id, multipleValues);
- }
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- throw new IOException(e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
- return Util.composeLabelValue(condition, labels, ids, idMap);
- }
-
- @Override
- public HeatMap readHeatMap(MetricsCondition condition,
- String valueColumnName,
- Duration duration)
- throws IOException {
- final List<PointOfTime> pointOfTimes = duration.assembleDurationPoints();
- List<String> ids = new ArrayList<>(pointOfTimes.size());
- pointOfTimes.forEach(pointOfTime -> ids.add(pointOfTime.id(condition.getEntity().buildId())));
-
- StringBuilder query = new StringBuilder();
- query.append("select ").append(valueColumnName).append(" from ");
- for (String id : ids) {
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, condition.getName());
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.ID_IDX, id);
- IoTDBUtils.addQueryIndexValue(condition.getName(), query, indexAndValueMap);
- query.append(", ");
- }
- String queryString = query.toString();
- if (ids.size() > 0) {
- queryString = queryString.substring(0, queryString.lastIndexOf(","));
- }
- queryString += IoTDBClient.ALIGN_BY_DEVICE;
-
- SessionPool sessionPool = client.getSessionPool();
- SessionDataSetWrapper wrapper = null;
- HeatMap heatMap = new HeatMap();
- final int defaultValue = ValueColumnMetadata.INSTANCE.getDefaultValue(condition.getName());
- try {
- wrapper = sessionPool.executeQueryStatement(queryString);
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, columnNames: {}", queryString, wrapper.getColumnNames());
- }
-
- while (wrapper.hasNext()) {
- RowRecord rowRecord = wrapper.next();
- List<Field> fields = rowRecord.getFields();
- List<String> layerNames = Splitter.on(IoTDBClient.DOT + "\"")
- .splitToList(fields.get(0).getStringValue());
- String id = IoTDBUtils.layerName2IndexValue(layerNames.get(1));
-
- heatMap.buildColumn(id, fields.get(1).getStringValue(), defaultValue);
- }
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- throw new IOException(e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
- heatMap.fixMissingColumns(ids, defaultValue);
- return heatMap;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBServiceLabelQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBServiceLabelQueryDAO.java
deleted file mode 100644
index 74f5159230..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBServiceLabelQueryDAO.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.skywalking.oap.server.core.analysis.manual.process.ServiceLabelRecord;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.profiling.ebpf.IServiceLabelDAO;
-import org.apache.skywalking.oap.server.core.storage.type.StorageBuilder;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBServiceLabelQueryDAO implements IServiceLabelDAO {
- private final IoTDBClient client;
- private final StorageBuilder<ServiceLabelRecord> storageBuilder = new ServiceLabelRecord.Builder();
-
- @Override
- public List<String> queryAllLabels(String serviceId) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, ServiceLabelRecord.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceId);
- IoTDBUtils.addQueryIndexValue(ServiceLabelRecord.INDEX_NAME, query, indexAndValueMap);
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- List<? super StorageData> storageDataList = client.filterQuery(ServiceLabelRecord.INDEX_NAME,
- query.toString(), storageBuilder);
- return storageDataList.stream().map(t -> ((ServiceLabelRecord) t).getLabel()).collect(Collectors.toList());
- }
-}
\ No newline at end of file
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBTagAutoCompleteQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBTagAutoCompleteQueryDAO.java
deleted file mode 100644
index 1a6db0911b..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBTagAutoCompleteQueryDAO.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.common.base.Splitter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import lombok.RequiredArgsConstructor;
-import org.apache.iotdb.rpc.IoTDBConnectionException;
-import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.iotdb.session.pool.SessionDataSetWrapper;
-import org.apache.iotdb.session.pool.SessionPool;
-import org.apache.iotdb.tsfile.read.common.RowRecord;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.TagAutocompleteData;
-import org.apache.skywalking.oap.server.core.analysis.manual.searchtag.TagType;
-import org.apache.skywalking.oap.server.core.storage.StorageData;
-import org.apache.skywalking.oap.server.core.storage.query.ITagAutoCompleteQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@RequiredArgsConstructor
-public class IoTDBTagAutoCompleteQueryDAO implements ITagAutoCompleteQueryDAO {
- private final IoTDBClient client;
-
- @Override
- public Set<String> queryTagAutocompleteKeys(final TagType tagType,
- final long startSecondTB,
- final long endSecondTB) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select *").append(" from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, TagAutocompleteData.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.AUTOCOMPLETE_TAG_TYPE, tagType.name());
- IoTDBUtils.addQueryIndexValue(TagAutocompleteData.INDEX_NAME, query, indexAndValueMap);
- appendTagAutocompleteCondition(startSecondTB, endSecondTB, query);
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- SessionPool sessionPool = client.getSessionPool();
- SessionDataSetWrapper wrapper = null;
- Set<String> tagKeys = new HashSet<>();
- try {
- wrapper = sessionPool.executeQueryStatement(query.toString());
- while (wrapper.hasNext()) {
- RowRecord rowRecord = wrapper.next();
- List<String> resultList = Splitter.on(IoTDBClient.DOT + "\"")
- .splitToList(rowRecord.getFields().get(0).getStringValue());
- String tagKey = resultList.get(resultList.size() - 2);
- tagKeys.add(tagKey.substring(0, tagKey.length() - 1));
- }
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- throw new IOException(e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
-
- return tagKeys;
- }
-
- @Override
- public Set<String> queryTagAutocompleteValues(final TagType tagType,
- final String tagKey,
- final int limit,
- final long startSecondTB,
- final long endSecondTB) throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select * from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, TagAutocompleteData.INDEX_NAME);
- Map<String, String> indexAndValueMap = new HashMap<>();
- indexAndValueMap.put(IoTDBIndexes.AUTOCOMPLETE_TAG_KEY, tagKey);
- indexAndValueMap.put(IoTDBIndexes.AUTOCOMPLETE_TAG_TYPE, tagType.name());
- IoTDBUtils.addQueryIndexValue(TagAutocompleteData.INDEX_NAME, query, indexAndValueMap);
- appendTagAutocompleteCondition(startSecondTB, endSecondTB, query);
- query.append(" limit ").append(limit).append(IoTDBClient.ALIGN_BY_DEVICE);
- List<? super StorageData> storageDataList = client.filterQuery(TagAutocompleteData.INDEX_NAME,
- query.toString(),
- new TagAutocompleteData.Builder()
- );
-
- Set<String> tagValues = new HashSet<>();
- storageDataList.forEach(storageData -> {
- TagAutocompleteData tagAutocompleteData = (TagAutocompleteData) storageData;
- tagValues.add(tagAutocompleteData.getTagValue());
- });
-
- return tagValues;
- }
-
- private void appendTagAutocompleteCondition(final long startSecondTB,
- final long endSecondTB,
- final StringBuilder query) {
- long startTB = startSecondTB / 1000000 * 10000;
- long endTB = endSecondTB / 1000000 * 10000 + 9999;
-
- StringBuilder where = new StringBuilder();
- if (startTB > 0) {
- where.append(IoTDBClient.TIME).append(" >= ").append(TimeBucket.getTimestamp(startTB));
- }
- if (endTB > 0) {
- if (where.length() > 0) {
- where.append(" and ");
- }
- where.append(IoTDBClient.TIME).append(" <= ").append(TimeBucket.getTimestamp(endTB));
- }
- if (where.length() > 0) {
- query.append(" where ").append(where);
- }
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBTopNRecordsQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBTopNRecordsQueryDAO.java
deleted file mode 100644
index b5fdd7cf99..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBTopNRecordsQueryDAO.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.common.base.Splitter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.iotdb.rpc.IoTDBConnectionException;
-import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.iotdb.session.pool.SessionDataSetWrapper;
-import org.apache.iotdb.session.pool.SessionPool;
-import org.apache.iotdb.tsfile.read.common.Field;
-import org.apache.iotdb.tsfile.read.common.RowRecord;
-import org.apache.skywalking.oap.server.core.analysis.IDManager;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.topn.TopN;
-import org.apache.skywalking.oap.server.core.query.enumeration.Order;
-import org.apache.skywalking.oap.server.core.query.input.Duration;
-import org.apache.skywalking.oap.server.core.query.input.TopNCondition;
-import org.apache.skywalking.oap.server.core.query.type.SelectedRecord;
-import org.apache.skywalking.oap.server.core.storage.query.ITopNRecordsQueryDAO;
-import org.apache.skywalking.oap.server.library.util.StringUtil;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBIndexes;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBTableMetaInfo;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBTopNRecordsQueryDAO implements ITopNRecordsQueryDAO {
- private final IoTDBClient client;
-
- @Override
- public List<SelectedRecord> readSampledRecords(TopNCondition condition,
- String valueColumnName,
- Duration duration)
- throws IOException {
- StringBuilder query = new StringBuilder();
- query.append("select ").append(TopN.STATEMENT).append(", ").append(valueColumnName)
- .append(" from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, condition.getName());
- Map<String, String> indexAndValueMap = new HashMap<>();
- if (StringUtil.isNotEmpty(condition.getParentService())) {
- final String serviceId = IDManager.ServiceID.buildId(condition.getParentService(), condition.isNormal());
- indexAndValueMap.put(IoTDBIndexes.SERVICE_ID_IDX, serviceId);
- }
- IoTDBUtils.addQueryIndexValue(condition.getName(), query, indexAndValueMap);
-
- StringBuilder where = new StringBuilder(" where ");
- if (Objects.nonNull(duration)) {
- where.append(IoTDBClient.TIME).append(" >= ")
- .append(TimeBucket.getTimestamp(duration.getStartTimeBucketInSec())).append(" and ");
- where.append(IoTDBClient.TIME).append(" <= ")
- .append(TimeBucket.getTimestamp(duration.getEndTimeBucketInSec()));
- }
- if (where.length() > 7) {
- query.append(where);
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- SessionPool sessionPool = client.getSessionPool();
- SessionDataSetWrapper wrapper = null;
- List<SelectedRecord> records = new ArrayList<>();
- try {
- wrapper = sessionPool.executeQueryStatement(query.toString());
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, columnNames: {}", query, wrapper.getColumnNames());
- }
-
- List<String> indexes = IoTDBTableMetaInfo.get(condition.getName()).getIndexes();
- int traceIdIdx = indexes.indexOf(IoTDBIndexes.TRACE_ID_IDX);
-
- while (wrapper.hasNext()) {
- SelectedRecord record = new SelectedRecord();
- RowRecord rowRecord = wrapper.next();
- List<Field> fields = rowRecord.getFields();
- record.setName(fields.get(1).getStringValue());
-
- String traceId = Splitter.on(IoTDBClient.DOT + "\"")
- .splitToList(fields.get(0).getStringValue())
- .get(traceIdIdx + 1);
- traceId = IoTDBUtils.layerName2IndexValue(traceId);
- record.setRefId(traceId);
-
- record.setId(record.getRefId());
- record.setValue(String.valueOf(fields.get(2).getObjectValue(fields.get(2).getDataType())));
- records.add(record);
- }
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- throw new IOException(e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
-
- // resort by self, because of the select query result order by time.
- if (Order.DES.equals(condition.getOrder())) {
- records.sort((SelectedRecord s1, SelectedRecord s2) ->
- Long.compare(Long.parseLong(s2.getValue()),
- Long.parseLong(s1.getValue())));
- } else {
- records.sort(Comparator.comparingLong((SelectedRecord s) -> Long.parseLong(s.getValue())));
- }
- return records;
- }
-}
diff --git a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBTopologyQueryDAO.java b/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBTopologyQueryDAO.java
deleted file mode 100644
index 8e70053865..0000000000
--- a/oap-server/server-storage-plugin/storage-iotdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/iotdb/query/IoTDBTopologyQueryDAO.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.skywalking.oap.server.storage.plugin.iotdb.query;
-
-import com.google.common.base.Splitter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.iotdb.rpc.IoTDBConnectionException;
-import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.iotdb.session.pool.SessionDataSetWrapper;
-import org.apache.iotdb.session.pool.SessionPool;
-import org.apache.iotdb.tsfile.read.common.Field;
-import org.apache.iotdb.tsfile.read.common.RowRecord;
-import org.apache.skywalking.oap.server.core.analysis.TimeBucket;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.endpoint.EndpointRelationServerSideMetrics;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationClientSideMetrics;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationServerSideMetrics;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.service.ServiceRelationClientSideMetrics;
-import org.apache.skywalking.oap.server.core.analysis.manual.relation.service.ServiceRelationServerSideMetrics;
-import org.apache.skywalking.oap.server.core.query.type.Call;
-import org.apache.skywalking.oap.server.core.source.DetectPoint;
-import org.apache.skywalking.oap.server.core.storage.query.ITopologyQueryDAO;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.IoTDBClient;
-import org.apache.skywalking.oap.server.storage.plugin.iotdb.utils.IoTDBUtils;
-
-@Slf4j
-@RequiredArgsConstructor
-public class IoTDBTopologyQueryDAO implements ITopologyQueryDAO {
- private final IoTDBClient client;
-
- @Override
- public List<Call.CallDetail> loadServiceRelationsDetectedAtServerSide(long startTB, long endTB,
- List<String> serviceIds)
- throws IOException {
- return loadServiceCalls(
- ServiceRelationServerSideMetrics.INDEX_NAME, startTB, endTB,
- ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID,
- ServiceRelationServerSideMetrics.DEST_SERVICE_ID,
- serviceIds, DetectPoint.SERVER);
- }
-
- @Override
- public List<Call.CallDetail> loadServiceRelationDetectedAtClientSide(long startTB, long endTB,
- List<String> serviceIds)
- throws IOException {
- return loadServiceCalls(
- ServiceRelationClientSideMetrics.INDEX_NAME, startTB, endTB,
- ServiceRelationClientSideMetrics.SOURCE_SERVICE_ID,
- ServiceRelationClientSideMetrics.DEST_SERVICE_ID,
- serviceIds, DetectPoint.CLIENT);
- }
-
- @Override
- public List<Call.CallDetail> loadServiceRelationsDetectedAtServerSide(long startTB, long endTB)
- throws IOException {
- return loadServiceCalls(
- ServiceRelationServerSideMetrics.INDEX_NAME, startTB, endTB,
- ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID,
- ServiceRelationServerSideMetrics.DEST_SERVICE_ID,
- new ArrayList<>(0), DetectPoint.SERVER);
- }
-
- @Override
- public List<Call.CallDetail> loadServiceRelationDetectedAtClientSide(long startTB, long endTB)
- throws IOException {
- return loadServiceCalls(
- ServiceRelationClientSideMetrics.INDEX_NAME, startTB, endTB,
- ServiceRelationClientSideMetrics.SOURCE_SERVICE_ID,
- ServiceRelationClientSideMetrics.DEST_SERVICE_ID,
- new ArrayList<>(0), DetectPoint.CLIENT);
- }
-
- @Override
- public List<Call.CallDetail> loadInstanceRelationDetectedAtServerSide(String clientServiceId,
- String serverServiceId,
- long startTB, long endTB)
- throws IOException {
- return loadServiceInstanceCalls(
- ServiceInstanceRelationServerSideMetrics.INDEX_NAME, startTB, endTB,
- ServiceInstanceRelationServerSideMetrics.SOURCE_SERVICE_ID,
- ServiceInstanceRelationServerSideMetrics.DEST_SERVICE_ID,
- clientServiceId, serverServiceId, DetectPoint.SERVER);
- }
-
- @Override
- public List<Call.CallDetail> loadInstanceRelationDetectedAtClientSide(String clientServiceId,
- String serverServiceId,
- long startTB, long endTB)
- throws IOException {
- return loadServiceInstanceCalls(
- ServiceInstanceRelationClientSideMetrics.INDEX_NAME, startTB, endTB,
- ServiceInstanceRelationClientSideMetrics.SOURCE_SERVICE_ID,
- ServiceInstanceRelationClientSideMetrics.DEST_SERVICE_ID,
- clientServiceId, serverServiceId, DetectPoint.CLIENT);
- }
-
- @Override
- public List<Call.CallDetail> loadEndpointRelation(long startTB, long endTB, String destEndpointId)
- throws IOException {
- List<Call.CallDetail> calls = loadEndpointFromSide(
- EndpointRelationServerSideMetrics.INDEX_NAME, startTB, endTB,
- EndpointRelationServerSideMetrics.SOURCE_ENDPOINT,
- EndpointRelationServerSideMetrics.DEST_ENDPOINT,
- destEndpointId, false);
- calls.addAll(loadEndpointFromSide(
- EndpointRelationServerSideMetrics.INDEX_NAME, startTB, endTB,
- EndpointRelationServerSideMetrics.SOURCE_ENDPOINT,
- EndpointRelationServerSideMetrics.DEST_ENDPOINT,
- destEndpointId, true));
- return calls;
- }
-
- private List<Call.CallDetail> loadServiceCalls(String tableName, long startTB, long endTB,
- String sourceCName, String destCName,
- List<String> serviceIds, DetectPoint detectPoint)
- throws IOException {
- // This method don't use "group by" like other storage plugin.
- StringBuilder query = new StringBuilder();
- query.append("select ").append(ServiceRelationServerSideMetrics.COMPONENT_ID).append(" from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, tableName);
- IoTDBUtils.addQueryAsterisk(tableName, query);
- query.append(" where ").append(IoTDBClient.TIME).append(" >= ").append(TimeBucket.getTimestamp(startTB))
- .append(" and ").append(IoTDBClient.TIME).append(" <= ").append(TimeBucket.getTimestamp(endTB));
- if (serviceIds.size() > 0) {
- query.append(" and (");
- for (int i = 0; i < serviceIds.size(); i++) {
- query.append(sourceCName).append(" = \"").append(serviceIds.get(i)).append("\" or ")
- .append(destCName).append(" = \"").append(serviceIds.get(i)).append("\"");
- if (i != serviceIds.size() - 1) {
- query.append(" or ");
- }
- }
- query.append(")");
- }
- query.append(IoTDBClient.ALIGN_BY_DEVICE);
-
- SessionPool sessionPool = client.getSessionPool();
- SessionDataSetWrapper wrapper = null;
- List<Call.CallDetail> calls = new ArrayList<>();
- try {
- wrapper = sessionPool.executeQueryStatement(query.toString());
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, columnNames: {}", query, wrapper.getColumnNames());
- }
-
- while (wrapper.hasNext()) {
- RowRecord rowRecord = wrapper.next();
- List<Field> fields = rowRecord.getFields();
- Call.CallDetail call = new Call.CallDetail();
- List<String> layerNames = Splitter.on(IoTDBClient.DOT + "\"")
- .splitToList(fields.get(0).getStringValue());
- String entityId = IoTDBUtils.layerName2IndexValue(layerNames.get(2));
- final int componentId = fields.get(1).getIntV();
- call.buildFromServiceRelation(entityId, componentId, detectPoint);
- calls.add(call);
- }
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- throw new IOException(e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
- return calls;
- }
-
- private List<Call.CallDetail> loadServiceInstanceCalls(String tableName, long startTB, long endTB,
- String sourceCName, String descCName,
- String sourceServiceId, String destServiceId,
- DetectPoint detectPoint) throws IOException {
- // This method don't use "group by" like other storage plugin.
- StringBuilder query = new StringBuilder();
- query.append("select ").append(ServiceInstanceRelationServerSideMetrics.COMPONENT_ID).append(" from ");
- IoTDBUtils.addModelPath(client.getStorageGroup(), query, tableName);
- IoTDBUtils.addQueryAsterisk(tableName, query);
- query.append(" where ").append(IoTDBClient.TIME).append(" >= ").append(TimeBucket.getTimestamp(startTB))
- .append(" and ").append(IoTDBClient.TIME).append(" <= ").append(TimeBucket.getTimestamp(endTB));
- query.append(" and ((").append(sourceCName).append(" = \"").append(sourceServiceId).append("\"")
- .append(" and ").append(descCName).append(" = \"").append(destServiceId).append("\"")
- .append(") or (").append(sourceCName).append(" = \"").append(destServiceId).append("\"")
- .append(" and ").append(descCName).append(" = \"").append(sourceServiceId).append(" \"))")
- .append(IoTDBClient.ALIGN_BY_DEVICE);
-
- SessionPool sessionPool = client.getSessionPool();
- SessionDataSetWrapper wrapper = null;
- List<Call.CallDetail> calls = new ArrayList<>();
- try {
- wrapper = sessionPool.executeQueryStatement(query.toString());
- if (log.isDebugEnabled()) {
- log.debug("SQL: {}, columnNames: {}", query, wrapper.getColumnNames());
- }
- while (wrapper.hasNext()) {
- RowRecord rowRecord = wrapper.next();
- List<Field> fields = rowRecord.getFields();
- Call.CallDetail call = new Call.CallDetail();
- List<String> layerNames = Splitter.on(IoTDBClient.DOT + "\"")
- .splitToList(fields.get(0).getStringValue());
- String entityId = IoTDBUtils.layerName2IndexValue(layerNames.get(2));
- final int componentId = fields.get(1).getIntV();
- call.buildFromInstanceRelation(entityId, componentId, detectPoint);
- calls.add(call);
- }
- } catch (IoTDBConnectionException | StatementExecutionException e) {
- throw new IOException(e);
- } finally {
- if (wrapper != null) {
- sessionPool.closeResultSet(wrapper);
- }
- }
- return calls;
... 2224 lines suppressed ...