Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
777c670c
S
SkyWalking
项目概览
killuaz丶x
/
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,发现更多精彩内容 >>
未验证
提交
777c670c
编写于
1月 22, 2021
作者:
W
wankai123
提交者:
GitHub
1月 22, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Support the identification of the source host of the metric data in otel-receiver-plugin (#6243)
上级
100823cb
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
35 addition
and
2 deletion
+35
-2
CHANGES.md
CHANGES.md
+1
-0
docs/en/setup/backend/backend-receivers.md
docs/en/setup/backend/backend-receivers.md
+3
-0
oap-server/server-receiver-plugin/otel-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/otel/oc/OCMetricHandler.java
...ywalking/oap/server/receiver/otel/oc/OCMetricHandler.java
+31
-2
未找到文件。
CHANGES.md
浏览文件 @
777c670c
...
...
@@ -74,6 +74,7 @@ Release Notes.
*
Add the implementation of ConfigurationDiscovery on the OAP side.
*
Fix bug in
`parseInternalErrorCode`
where some error codes are never reached.
*
OAL supports multiple values when as numeric
*
Add node information from the Openensus proto to the labels of the samples, to support the identification of the source of the Metric data.
#### UI
*
Fix un-removed tags in trace query.
...
...
docs/en/setup/backend/backend-receivers.md
浏览文件 @
777c670c
...
...
@@ -182,6 +182,9 @@ receiver-otel:
enabledHandlers
:
${SW_OTEL_RECEIVER_ENABLED_HANDLERS:"oc"}
enabledOcRules
:
${SW_OTEL_RECEIVER_ENABLED_OC_RULES:"istio-controlplane"}
```
The receiver adds labels with
`key = node_identifier_host_name`
and
`key = node_identifier_pid`
to the collected data samples,
and values from
`Node.identifier.host_name`
and
`Node.identifier.pid`
defined in opencensus agent proto,
to be the identification of the metric data.
## Meter receiver
...
...
oap-server/server-receiver-plugin/otel-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/otel/oc/OCMetricHandler.java
浏览文件 @
777c670c
...
...
@@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.receiver.otel.oc;
import
com.google.protobuf.Timestamp
;
import
io.grpc.stub.StreamObserver
;
import
io.opencensus.proto.agent.common.v1.Node
;
import
io.opencensus.proto.agent.metrics.v1.ExportMetricsServiceRequest
;
import
io.opencensus.proto.agent.metrics.v1.ExportMetricsServiceResponse
;
import
io.opencensus.proto.agent.metrics.v1.MetricsServiceGrpc
;
...
...
@@ -34,6 +35,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.skywalking.apm.util.StringUtil
;
import
org.apache.skywalking.oap.meter.analyzer.MetricConvert
;
import
org.apache.skywalking.oap.meter.analyzer.prometheus.PrometheusMetricConverter
;
import
org.apache.skywalking.oap.meter.analyzer.prometheus.rule.Rule
;
...
...
@@ -57,11 +59,32 @@ public class OCMetricHandler extends MetricsServiceGrpc.MetricsServiceImplBase i
@Override
public
StreamObserver
<
ExportMetricsServiceRequest
>
export
(
StreamObserver
<
ExportMetricsServiceResponse
>
responseObserver
)
{
return
new
StreamObserver
<
ExportMetricsServiceRequest
>()
{
@Override
public
void
onNext
(
ExportMetricsServiceRequest
request
)
{
private
Node
node
;
private
Map
<
String
,
String
>
nodeLabels
=
new
HashMap
<>();
@Override
public
void
onNext
(
ExportMetricsServiceRequest
request
)
{
if
(
request
.
hasNode
())
{
node
=
request
.
getNode
();
nodeLabels
.
clear
();
if
(
node
.
hasIdentifier
())
{
if
(
StringUtil
.
isNotBlank
(
node
.
getIdentifier
().
getHostName
()))
{
nodeLabels
.
put
(
"node_identifier_host_name"
,
node
.
getIdentifier
().
getHostName
());
}
if
(
node
.
getIdentifier
().
getPid
()
>
0
)
{
nodeLabels
.
put
(
"node_identifier_pid"
,
String
.
valueOf
(
node
.
getIdentifier
().
getPid
()));
}
}
}
metrics
.
forEach
(
m
->
m
.
toMeter
(
request
.
getMetricsList
().
stream
()
.
flatMap
(
metric
->
metric
.
getTimeseriesList
().
stream
().
map
(
timeSeries
->
Tuple
.
of
(
metric
.
getMetricDescriptor
(),
buildLabels
(
metric
.
getMetricDescriptor
().
getLabelKeysList
(),
timeSeries
.
getLabelValuesList
()),
buildLabelsFromNodeInfo
(
nodeLabels
,
buildLabels
(
metric
.
getMetricDescriptor
().
getLabelKeysList
(),
timeSeries
.
getLabelValuesList
()
)
),
timeSeries
)))
.
flatMap
(
t
->
t
.
_3
.
getPointsList
().
stream
().
map
(
point
->
Tuple
.
of
(
t
.
_1
,
t
.
_2
,
point
)))
.
map
(
Function1
.
liftTry
(
t
->
{
...
...
@@ -107,6 +130,12 @@ public class OCMetricHandler extends MetricsServiceGrpc.MetricsServiceImplBase i
return
result
;
}
private
static
Map
<
String
,
String
>
buildLabelsFromNodeInfo
(
Map
<
String
,
String
>
nodeLabels
,
Map
<
String
,
String
>
buildLabelsResult
)
{
buildLabelsResult
.
putAll
(
nodeLabels
);
return
buildLabelsResult
;
}
private
static
Map
<
Double
,
Long
>
buildBuckets
(
DistributionValue
distributionValue
)
{
Map
<
Double
,
Long
>
result
=
new
HashMap
<>();
List
<
Double
>
bounds
=
distributionValue
.
getBucketOptions
().
getExplicit
().
getBoundsList
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录