Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gdyjdao
SkyWalking
提交
17e3fff8
S
SkyWalking
项目概览
gdyjdao
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
17e3fff8
编写于
1月 29, 2020
作者:
wu-sheng
提交者:
GitHub
1月 29, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor the storage to support `getSubsetOfMultipleLinearIntValues` (#4289)
上级
0e105a49
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
60 addition
and
23 deletion
+60
-23
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetricQueryService.java
.../skywalking/oap/server/core/query/MetricQueryService.java
+15
-2
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetricsQueryDAO.java
...lking/oap/server/core/storage/query/IMetricsQueryDAO.java
+12
-6
oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetricQuery.java
...he/skywalking/oap/query/graphql/resolver/MetricQuery.java
+22
-6
oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol
...in/query-graphql-plugin/src/main/resources/query-protocol
+1
-1
oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetricsQueryEsDAO.java
...storage/plugin/elasticsearch/query/MetricsQueryEsDAO.java
+5
-4
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetricsQueryDAO.java
.../server/storage/plugin/jdbc/h2/dao/H2MetricsQueryDAO.java
+5
-4
未找到文件。
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetricQueryService.java
浏览文件 @
17e3fff8
...
...
@@ -97,6 +97,19 @@ public class MetricQueryService implements Service {
}
public
List
<
IntValues
>
getMultipleLinearIntValues
(
final
String
indName
,
final
String
id
,
final
int
numOfLinear
,
final
Downsampling
downsampling
,
final
long
startTB
,
final
long
endTB
)
throws
IOException
{
List
<
Integer
>
linearIndex
=
new
ArrayList
<>(
numOfLinear
);
for
(
int
i
=
0
;
i
<
numOfLinear
;
i
++)
{
linearIndex
.
add
(
i
);
}
return
getSubsetOfMultipleLinearIntValues
(
indName
,
id
,
linearIndex
,
downsampling
,
startTB
,
endTB
);
}
public
List
<
IntValues
>
getSubsetOfMultipleLinearIntValues
(
final
String
indName
,
final
String
id
,
final
List
<
Integer
>
linearIndex
,
final
Downsampling
downsampling
,
final
long
startTB
,
final
long
endTB
)
throws
IOException
{
...
...
@@ -108,9 +121,9 @@ public class MetricQueryService implements Service {
durationPoints
.
forEach
(
durationPoint
->
ids
.
add
(
durationPoint
.
getPoint
()
+
Const
.
ID_SPLIT
+
id
));
}
IntValues
[]
multipleLinearIntValues
=
getMetricQueryDAO
().
getMultipleLinearIntValues
(
indName
,
downsampling
,
ids
,
numOfLinear
,
ValueColumnIds
.
INSTANCE
.
getValueCName
(
indName
));
IntValues
[]
multipleLinearIntValues
=
getMetricQueryDAO
().
getMultipleLinearIntValues
(
indName
,
downsampling
,
ids
,
linearIndex
,
ValueColumnIds
.
INSTANCE
.
getValueCName
(
indName
));
List
<
IntValues
>
response
=
new
ArrayList
<>(
numOfLinear
);
List
<
IntValues
>
response
=
new
ArrayList
<>(
linearIndex
.
size
()
);
Collections
.
addAll
(
response
,
multipleLinearIntValues
);
return
response
;
}
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetricsQueryDAO.java
浏览文件 @
17e3fff8
...
...
@@ -21,8 +21,10 @@ package org.apache.skywalking.oap.server.core.storage.query;
import
java.io.IOException
;
import
java.util.List
;
import
org.apache.skywalking.oap.server.core.analysis.Downsampling
;
import
org.apache.skywalking.oap.server.core.query.entity.*
;
import
org.apache.skywalking.oap.server.core.query.sql.*
;
import
org.apache.skywalking.oap.server.core.query.entity.IntValues
;
import
org.apache.skywalking.oap.server.core.query.entity.Thermodynamic
;
import
org.apache.skywalking.oap.server.core.query.sql.Function
;
import
org.apache.skywalking.oap.server.core.query.sql.Where
;
import
org.apache.skywalking.oap.server.core.storage.DAO
;
/**
...
...
@@ -30,11 +32,15 @@ import org.apache.skywalking.oap.server.core.storage.DAO;
*/
public
interface
IMetricsQueryDAO
extends
DAO
{
IntValues
getValues
(
String
indName
,
Downsampling
downsampling
,
long
startTB
,
long
endTB
,
Where
where
,
String
valueCName
,
Function
function
)
throws
IOException
;
IntValues
getValues
(
String
indName
,
Downsampling
downsampling
,
long
startTB
,
long
endTB
,
Where
where
,
String
valueCName
,
Function
function
)
throws
IOException
;
IntValues
getLinearIntValues
(
String
indName
,
Downsampling
downsampling
,
List
<
String
>
ids
,
String
valueCName
)
throws
IOException
;
IntValues
getLinearIntValues
(
String
indName
,
Downsampling
downsampling
,
List
<
String
>
ids
,
String
valueCName
)
throws
IOException
;
IntValues
[]
getMultipleLinearIntValues
(
String
indName
,
Downsampling
downsampling
,
List
<
String
>
ids
,
int
numOfLinear
,
String
valueCName
)
throws
IOException
;
IntValues
[]
getMultipleLinearIntValues
(
String
indName
,
Downsampling
downsampling
,
List
<
String
>
ids
,
List
<
Integer
>
linearIndex
,
String
valueCName
)
throws
IOException
;
Thermodynamic
getThermodynamic
(
String
indName
,
Downsampling
downsampling
,
List
<
String
>
ids
,
String
valueCName
)
throws
IOException
;
Thermodynamic
getThermodynamic
(
String
indName
,
Downsampling
downsampling
,
List
<
String
>
ids
,
String
valueCName
)
throws
IOException
;
}
oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetricQuery.java
浏览文件 @
17e3fff8
...
...
@@ -22,10 +22,15 @@ import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.util.List
;
import
org.apache.skywalking.oap.query.graphql.type.*
;
import
org.apache.skywalking.oap.query.graphql.type.BatchMetricConditions
;
import
org.apache.skywalking.oap.query.graphql.type.Duration
;
import
org.apache.skywalking.oap.query.graphql.type.MetricCondition
;
import
org.apache.skywalking.oap.server.core.CoreModule
;
import
org.apache.skywalking.oap.server.core.query.*
;
import
org.apache.skywalking.oap.server.core.query.entity.*
;
import
org.apache.skywalking.oap.server.core.query.DurationUtils
;
import
org.apache.skywalking.oap.server.core.query.MetricQueryService
;
import
org.apache.skywalking.oap.server.core.query.StepToDownsampling
;
import
org.apache.skywalking.oap.server.core.query.entity.IntValues
;
import
org.apache.skywalking.oap.server.core.query.entity.Thermodynamic
;
import
org.apache.skywalking.oap.server.library.module.ModuleManager
;
/**
...
...
@@ -54,21 +59,32 @@ public class MetricQuery implements GraphQLQueryResolver {
return
getMetricQueryService
().
getValues
(
metrics
.
getName
(),
metrics
.
getIds
(),
StepToDownsampling
.
transform
(
duration
.
getStep
()),
startTimeBucket
,
endTimeBucket
);
}
public
IntValues
getLinearIntValues
(
final
MetricCondition
metrics
,
final
Duration
duration
)
throws
IOException
,
ParseException
{
public
IntValues
getLinearIntValues
(
final
MetricCondition
metrics
,
final
Duration
duration
)
throws
IOException
,
ParseException
{
long
startTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
endTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getMetricQueryService
().
getLinearIntValues
(
metrics
.
getName
(),
metrics
.
getId
(),
StepToDownsampling
.
transform
(
duration
.
getStep
()),
startTimeBucket
,
endTimeBucket
);
}
public
List
<
IntValues
>
getMultipleLinearIntValues
(
final
MetricCondition
metrics
,
final
int
numOfLinear
,
final
Duration
duration
)
throws
IOException
,
ParseException
{
public
List
<
IntValues
>
getMultipleLinearIntValues
(
final
MetricCondition
metrics
,
final
int
numOfLinear
,
final
Duration
duration
)
throws
IOException
,
ParseException
{
long
startTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
endTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getMetricQueryService
().
getMultipleLinearIntValues
(
metrics
.
getName
(),
metrics
.
getId
(),
numOfLinear
,
StepToDownsampling
.
transform
(
duration
.
getStep
()),
startTimeBucket
,
endTimeBucket
);
}
public
Thermodynamic
getThermodynamic
(
final
MetricCondition
metrics
,
final
Duration
duration
)
throws
IOException
,
ParseException
{
public
List
<
IntValues
>
getSubsetOfMultipleLinearIntValues
(
final
MetricCondition
metrics
,
final
List
<
Integer
>
linearIndex
,
final
Duration
duration
)
throws
IOException
,
ParseException
{
long
startTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
endTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
return
getMetricQueryService
().
getSubsetOfMultipleLinearIntValues
(
metrics
.
getName
(),
metrics
.
getId
(),
linearIndex
,
StepToDownsampling
.
transform
(
duration
.
getStep
()),
startTimeBucket
,
endTimeBucket
);
}
public
Thermodynamic
getThermodynamic
(
final
MetricCondition
metrics
,
final
Duration
duration
)
throws
IOException
,
ParseException
{
long
startTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getStart
());
long
endTimeBucket
=
DurationUtils
.
INSTANCE
.
exchangeToTimeBucket
(
duration
.
getEnd
());
...
...
query-protocol
@
03ed7858
比较
249addea
...
03ed7858
Subproject commit
249addeaaf524c0dd990444e5f4bcaf355ce8e01
Subproject commit
03ed7858ea05ade81b9ceaa3abe468b422ce8110
oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetricsQueryEsDAO.java
浏览文件 @
17e3fff8
...
...
@@ -135,13 +135,13 @@ public class MetricsQueryEsDAO extends EsDAO implements IMetricsQueryDAO {
}
@Override
public
IntValues
[]
getMultipleLinearIntValues
(
String
indName
,
Downsampling
downsampling
,
List
<
String
>
ids
,
int
numOfLinear
,
String
valueCName
)
throws
IOException
{
List
<
String
>
ids
,
List
<
Integer
>
linearIndex
,
String
valueCName
)
throws
IOException
{
String
indexName
=
ModelName
.
build
(
downsampling
,
indName
);
SearchResponse
response
=
getClient
().
ids
(
indexName
,
ids
.
toArray
(
new
String
[
0
]));
Map
<
String
,
Map
<
String
,
Object
>>
idMap
=
toMap
(
response
);
IntValues
[]
intValuesArray
=
new
IntValues
[
numOfLinear
];
IntValues
[]
intValuesArray
=
new
IntValues
[
linearIndex
.
size
()
];
for
(
int
i
=
0
;
i
<
intValuesArray
.
length
;
i
++)
{
intValuesArray
[
i
]
=
new
IntValues
();
}
...
...
@@ -159,8 +159,9 @@ public class MetricsQueryEsDAO extends EsDAO implements IMetricsQueryDAO {
IntKeyLongValueHashMap
multipleValues
=
new
IntKeyLongValueHashMap
(
5
);
multipleValues
.
toObject
((
String
)
source
.
getOrDefault
(
valueCName
,
""
));
for
(
int
i
=
0
;
i
<
intValuesArray
.
length
;
i
++)
{
intValuesArray
[
i
].
getLast
().
setValue
(
multipleValues
.
get
(
i
).
getValue
());
for
(
int
i
=
0
;
i
<
linearIndex
.
size
();
i
++)
{
Integer
index
=
linearIndex
.
get
(
i
);
intValuesArray
[
i
].
getLast
().
setValue
(
multipleValues
.
get
(
index
).
getValue
());
}
}
...
...
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetricsQueryDAO.java
浏览文件 @
17e3fff8
...
...
@@ -145,7 +145,7 @@ public class H2MetricsQueryDAO extends H2SQLExecutor implements IMetricsQueryDAO
@Override
public
IntValues
[]
getMultipleLinearIntValues
(
String
indName
,
Downsampling
downsampling
,
List
<
String
>
ids
,
int
numOfLinear
,
final
List
<
Integer
>
linearIndex
,
String
valueCName
)
throws
IOException
{
String
tableName
=
ModelName
.
build
(
downsampling
,
indName
);
...
...
@@ -157,7 +157,7 @@ public class H2MetricsQueryDAO extends H2SQLExecutor implements IMetricsQueryDAO
idValues
.
append
(
"'"
).
append
(
ids
.
get
(
valueIdx
)).
append
(
"'"
);
}
IntValues
[]
intValuesArray
=
new
IntValues
[
numOfLinear
];
IntValues
[]
intValuesArray
=
new
IntValues
[
linearIndex
.
size
()
];
for
(
int
i
=
0
;
i
<
intValuesArray
.
length
;
i
++)
{
intValuesArray
[
i
]
=
new
IntValues
();
}
...
...
@@ -170,10 +170,11 @@ public class H2MetricsQueryDAO extends H2SQLExecutor implements IMetricsQueryDAO
IntKeyLongValueHashMap
multipleValues
=
new
IntKeyLongValueHashMap
(
5
);
multipleValues
.
toObject
(
resultSet
.
getString
(
valueCName
));
for
(
int
i
=
0
;
i
<
intValuesArray
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
linearIndex
.
size
();
i
++)
{
Integer
index
=
linearIndex
.
get
(
i
);
KVInt
kv
=
new
KVInt
();
kv
.
setId
(
id
);
kv
.
setValue
(
multipleValues
.
get
(
i
).
getValue
());
kv
.
setValue
(
multipleValues
.
get
(
i
ndex
).
getValue
());
intValuesArray
[
i
].
addKVInt
(
kv
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录