Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿信在这里
SkyWalking
提交
762e347c
S
SkyWalking
项目概览
阿信在这里
/
SkyWalking
与 Fork 源项目一致
Fork自
山不在高_有仙则灵 / 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,发现更多精彩内容 >>
未验证
提交
762e347c
编写于
1月 20, 2021
作者:
Z
zhang-wei
提交者:
GitHub
1月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OAL supports multiple values when as numeric (#6233)
上级
a8e66244
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
60 addition
and
12 deletion
+60
-12
CHANGES.md
CHANGES.md
+1
-0
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/ConditionExpression.java
.../apache/skywalking/oal/rt/parser/ConditionExpression.java
+8
-1
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/OALListener.java
...java/org/apache/skywalking/oal/rt/parser/OALListener.java
+1
-0
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/parser/ScriptParserTest.java
...org/apache/skywalking/oal/rt/parser/ScriptParserTest.java
+21
-1
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/expression/InMatch.java
.../oap/server/core/analysis/metrics/expression/InMatch.java
+19
-0
oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/analysis/metrics/expression/InMatchTest.java
.../server/core/analysis/metrics/expression/InMatchTest.java
+10
-10
未找到文件。
CHANGES.md
浏览文件 @
762e347c
...
@@ -71,6 +71,7 @@ Release Notes.
...
@@ -71,6 +71,7 @@ Release Notes.
*
Support Alarm to feishu
*
Support Alarm to feishu
*
Add the implementation of ConfigurationDiscovery on the OAP side.
*
Add the implementation of ConfigurationDiscovery on the OAP side.
*
Fix bug in
`parseInternalErrorCode`
where some error codes are never reached.
*
Fix bug in
`parseInternalErrorCode`
where some error codes are never reached.
*
OAL supports multiple values when as numeric
#### UI
#### UI
*
Fix un-removed tags in trace query.
*
Fix un-removed tags in trace query.
...
...
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/ConditionExpression.java
浏览文件 @
762e347c
...
@@ -35,6 +35,7 @@ public class ConditionExpression {
...
@@ -35,6 +35,7 @@ public class ConditionExpression {
private
List
<
String
>
attributes
=
new
ArrayList
<>();
private
List
<
String
>
attributes
=
new
ArrayList
<>();
private
String
value
;
private
String
value
;
private
List
<
String
>
values
;
private
List
<
String
>
values
;
private
boolean
number
;
public
ConditionExpression
(
final
String
expressionType
,
final
String
attributes
,
final
String
value
)
{
public
ConditionExpression
(
final
String
expressionType
,
final
String
attributes
,
final
String
value
)
{
this
.
expressionType
=
expressionType
;
this
.
expressionType
=
expressionType
;
...
@@ -50,11 +51,17 @@ public class ConditionExpression {
...
@@ -50,11 +51,17 @@ public class ConditionExpression {
}
}
}
}
public
void
isNumber
()
{
number
=
true
;
}
public
void
enterMultiConditionValue
()
{
public
void
enterMultiConditionValue
()
{
values
=
new
LinkedList
<>();
values
=
new
LinkedList
<>();
}
}
public
void
exitMultiConditionValue
()
{
public
void
exitMultiConditionValue
()
{
value
=
"new Object[]{"
+
String
.
join
(
","
,
values
)
+
"}"
;
value
=
number
?
"new long[]{"
+
String
.
join
(
","
,
values
)
+
"}"
:
"new Object[]{"
+
String
.
join
(
","
,
values
)
+
"}"
;
}
}
}
}
oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/rt/parser/OALListener.java
浏览文件 @
762e347c
...
@@ -196,6 +196,7 @@ public class OALListener extends OALParserBaseListener {
...
@@ -196,6 +196,7 @@ public class OALListener extends OALParserBaseListener {
@Override
@Override
public
void
enterNumberConditionValue
(
OALParser
.
NumberConditionValueContext
ctx
)
{
public
void
enterNumberConditionValue
(
OALParser
.
NumberConditionValueContext
ctx
)
{
conditionExpression
.
isNumber
();
enterConditionValue
(
ctx
.
getText
());
enterConditionValue
(
ctx
.
getText
());
}
}
...
...
oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/rt/parser/ScriptParserTest.java
浏览文件 @
762e347c
...
@@ -227,11 +227,31 @@ public class ScriptParserTest {
...
@@ -227,11 +227,31 @@ public class ScriptParserTest {
"org.apache.skywalking.oap.server.core.analysis.metrics.expression.InMatch"
,
"org.apache.skywalking.oap.server.core.analysis.metrics.expression.InMatch"
,
expression
.
getExpressionObject
()
expression
.
getExpressionObject
()
);
);
Assert
.
assertEquals
(
"new
Object
[]{1,2,3}"
,
expression
.
getRight
());
Assert
.
assertEquals
(
"new
long
[]{1,2,3}"
,
expression
.
getRight
());
}
}
@Test
@Test
public
void
testParse8
()
throws
IOException
{
public
void
testParse8
()
throws
IOException
{
ScriptParser
parser
=
ScriptParser
.
createFromScriptText
(
"service_response_s4_summary = from(Service.latency).filter(latency != 1).filter(latency in [\"1\",\"2\", \"3\"]).sum();"
,
TEST_SOURCE_PACKAGE
);
List
<
AnalysisResult
>
results
=
parser
.
parse
().
getMetricsStmts
();
Assert
.
assertEquals
(
1
,
results
.
size
());
AnalysisResult
result
=
results
.
get
(
0
);
List
<
Expression
>
expressions
=
result
.
getFilterExpressions
();
Assert
.
assertEquals
(
2
,
expressions
.
size
());
Expression
expression
=
expressions
.
get
(
1
);
Assert
.
assertEquals
(
"source.getLatency()"
,
expression
.
getLeft
());
Assert
.
assertEquals
(
"org.apache.skywalking.oap.server.core.analysis.metrics.expression.InMatch"
,
expression
.
getExpressionObject
()
);
Assert
.
assertEquals
(
"new Object[]{\"1\",\"2\",\"3\"}"
,
expression
.
getRight
());
}
@Test
public
void
testParse9
()
throws
IOException
{
ScriptParser
parser
=
ScriptParser
.
createFromScriptText
(
ScriptParser
parser
=
ScriptParser
.
createFromScriptText
(
"ServicePercent = from(Service.sidecar.internalError).filter(sidecar.internalError == \"abc\").percent(sidecar.internalError != \"\");"
,
TEST_SOURCE_PACKAGE
);
"ServicePercent = from(Service.sidecar.internalError).filter(sidecar.internalError == \"abc\").percent(sidecar.internalError != \"\");"
,
TEST_SOURCE_PACKAGE
);
List
<
AnalysisResult
>
results
=
parser
.
parse
().
getMetricsStmts
();
List
<
AnalysisResult
>
results
=
parser
.
parse
().
getMetricsStmts
();
...
...
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/metrics/expression/InMatch.java
浏览文件 @
762e347c
...
@@ -22,6 +22,25 @@ import org.apache.skywalking.oap.server.core.analysis.metrics.annotation.FilterM
...
@@ -22,6 +22,25 @@ import org.apache.skywalking.oap.server.core.analysis.metrics.annotation.FilterM
@FilterMatcher
@FilterMatcher
public
class
InMatch
{
public
class
InMatch
{
public
boolean
match
(
int
left
,
long
[]
rights
)
{
for
(
long
right
:
rights
)
{
if
(
left
==
right
)
{
return
true
;
}
}
return
false
;
}
public
boolean
match
(
long
left
,
long
[]
rights
)
{
for
(
long
right
:
rights
)
{
if
(
left
==
right
)
{
return
true
;
}
}
return
false
;
}
public
boolean
match
(
Object
left
,
Object
[]
rights
)
{
public
boolean
match
(
Object
left
,
Object
[]
rights
)
{
for
(
Object
right
:
rights
)
{
for
(
Object
right
:
rights
)
{
if
(
right
instanceof
String
)
{
if
(
right
instanceof
String
)
{
...
...
oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/analysis/metrics/expression/InMatchTest.java
浏览文件 @
762e347c
...
@@ -48,26 +48,26 @@ public class InMatchTest {
...
@@ -48,26 +48,26 @@ public class InMatchTest {
}
}
));
));
Assert
.
assertTrue
(
new
InMatch
().
match
(
1
,
new
Object
[]
{
Assert
.
assertTrue
(
new
InMatch
().
match
(
1
,
new
long
[]
{
1
,
1
,
2
,
2
,
3
3
}));
}));
Assert
.
assertFalse
(
new
InMatch
().
match
(
4
,
new
Object
[]
{
Assert
.
assertFalse
(
new
InMatch
().
match
(
4
,
new
long
[]
{
1
,
1
,
2
,
2
,
3
3
}));
}));
Assert
.
assertTrue
(
new
InMatch
().
match
(
1
.0
D
,
new
Object
[]
{
Assert
.
assertTrue
(
new
InMatch
().
match
(
1
L
,
new
long
[]
{
1
.0
D
,
1
,
2
.0
D
,
2
,
3
.0
D
3
}));
}));
Assert
.
assertFalse
(
new
InMatch
().
match
(
4
.0
D
,
new
Object
[]
{
Assert
.
assertFalse
(
new
InMatch
().
match
(
4
L
,
new
long
[]
{
1
.0
D
,
1
,
2
.0
D
,
2
,
3
.0
D
3
}));
}));
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录