Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
润土的好友猹
SkyWalking
提交
aecb1b39
S
SkyWalking
项目概览
润土的好友猹
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
9
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,发现更多精彩内容 >>
未验证
提交
aecb1b39
编写于
4月 13, 2021
作者:
Z
Zhenxu Ke
提交者:
GitHub
4月 13, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add some defensive codes of new protobuffers' semantics (#6737)
上级
cbb67101
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
18 deletion
+51
-18
CHANGES.md
CHANGES.md
+1
-0
oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/LogEntry2MetricsAdapter.java
...ap/server/receiver/envoy/als/LogEntry2MetricsAdapter.java
+4
-12
oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/Addresses.java
...ywalking/oap/server/receiver/envoy/als/k8s/Addresses.java
+32
-0
oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/K8sALSServiceMeshHTTPAnalysis.java
...receiver/envoy/als/k8s/K8sALSServiceMeshHTTPAnalysis.java
+14
-6
未找到文件。
CHANGES.md
浏览文件 @
aecb1b39
...
@@ -11,6 +11,7 @@ Release Notes.
...
@@ -11,6 +11,7 @@ Release Notes.
#### OAP-Backend
#### OAP-Backend
*
BugFix: filter invalid Envoy access logs whose socket address is empty.
*
Fix K8s monitoring the incorrect metrics calculate.
*
Fix K8s monitoring the incorrect metrics calculate.
#### UI
#### UI
...
...
oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/LogEntry2MetricsAdapter.java
浏览文件 @
aecb1b39
...
@@ -20,11 +20,9 @@ package org.apache.skywalking.oap.server.receiver.envoy.als;
...
@@ -20,11 +20,9 @@ package org.apache.skywalking.oap.server.receiver.envoy.als;
import
com.google.protobuf.Duration
;
import
com.google.protobuf.Duration
;
import
com.google.protobuf.Timestamp
;
import
com.google.protobuf.Timestamp
;
import
com.google.protobuf.UInt32Value
;
import
io.envoyproxy.envoy.data.accesslog.v3.AccessLogCommon
;
import
io.envoyproxy.envoy.data.accesslog.v3.AccessLogCommon
;
import
io.envoyproxy.envoy.data.accesslog.v3.HTTPAccessLogEntry
;
import
io.envoyproxy.envoy.data.accesslog.v3.HTTPAccessLogEntry
;
import
io.envoyproxy.envoy.data.accesslog.v3.HTTPRequestProperties
;
import
io.envoyproxy.envoy.data.accesslog.v3.HTTPRequestProperties
;
import
io.envoyproxy.envoy.data.accesslog.v3.HTTPResponseProperties
;
import
io.envoyproxy.envoy.data.accesslog.v3.ResponseFlags
;
import
io.envoyproxy.envoy.data.accesslog.v3.ResponseFlags
;
import
io.envoyproxy.envoy.data.accesslog.v3.TLSProperties
;
import
io.envoyproxy.envoy.data.accesslog.v3.TLSProperties
;
import
java.time.Instant
;
import
java.time.Instant
;
...
@@ -36,7 +34,6 @@ import org.apache.skywalking.apm.network.servicemesh.v3.Protocol;
...
@@ -36,7 +34,6 @@ import org.apache.skywalking.apm.network.servicemesh.v3.Protocol;
import
org.apache.skywalking.apm.network.servicemesh.v3.ServiceMeshMetric
;
import
org.apache.skywalking.apm.network.servicemesh.v3.ServiceMeshMetric
;
import
static
com
.
google
.
common
.
base
.
Strings
.
isNullOrEmpty
;
import
static
com
.
google
.
common
.
base
.
Strings
.
isNullOrEmpty
;
import
static
java
.
util
.
Optional
.
ofNullable
;
/**
/**
* Adapt {@link HTTPAccessLogEntry} objects to {@link ServiceMeshMetric} builders.
* Adapt {@link HTTPAccessLogEntry} objects to {@link ServiceMeshMetric} builders.
...
@@ -97,9 +94,8 @@ public class LogEntry2MetricsAdapter {
...
@@ -97,9 +94,8 @@ public class LogEntry2MetricsAdapter {
protected
ServiceMeshMetric
.
Builder
adaptCommonPart
()
{
protected
ServiceMeshMetric
.
Builder
adaptCommonPart
()
{
final
AccessLogCommon
properties
=
entry
.
getCommonProperties
();
final
AccessLogCommon
properties
=
entry
.
getCommonProperties
();
final
String
endpoint
=
endpoint
();
final
String
endpoint
=
endpoint
();
final
int
responseCode
=
ofNullable
(
entry
.
getResponse
()).
map
(
HTTPResponseProperties:
:
getResponseCode
)
int
responseCode
=
entry
.
getResponse
().
getResponseCode
().
getValue
();
.
map
(
UInt32Value:
:
getValue
)
responseCode
=
responseCode
>
0
?
responseCode
:
200
;
.
orElse
(
200
);
final
boolean
status
=
responseCode
>=
200
&&
responseCode
<
400
;
final
boolean
status
=
responseCode
>=
200
&&
responseCode
<
400
;
final
Protocol
protocol
=
requestProtocol
(
entry
.
getRequest
());
final
Protocol
protocol
=
requestProtocol
(
entry
.
getRequest
());
final
String
tlsMode
=
parseTLS
(
properties
.
getTlsProperties
());
final
String
tlsMode
=
parseTLS
(
properties
.
getTlsProperties
());
...
@@ -162,15 +158,11 @@ public class LogEntry2MetricsAdapter {
...
@@ -162,15 +158,11 @@ public class LogEntry2MetricsAdapter {
if
(
properties
==
null
)
{
if
(
properties
==
null
)
{
return
NON_TLS
;
return
NON_TLS
;
}
}
TLSProperties
.
CertificateProperties
lp
=
Optional
TLSProperties
.
CertificateProperties
lp
=
properties
.
getLocalCertificateProperties
();
.
ofNullable
(
properties
.
getLocalCertificateProperties
())
.
orElse
(
TLSProperties
.
CertificateProperties
.
newBuilder
().
build
());
if
(
isNullOrEmpty
(
lp
.
getSubject
())
&&
!
hasSAN
(
lp
.
getSubjectAltNameList
()))
{
if
(
isNullOrEmpty
(
lp
.
getSubject
())
&&
!
hasSAN
(
lp
.
getSubjectAltNameList
()))
{
return
NON_TLS
;
return
NON_TLS
;
}
}
TLSProperties
.
CertificateProperties
pp
=
Optional
TLSProperties
.
CertificateProperties
pp
=
properties
.
getPeerCertificateProperties
();
.
ofNullable
(
properties
.
getPeerCertificateProperties
())
.
orElse
(
TLSProperties
.
CertificateProperties
.
newBuilder
().
build
());
if
(
isNullOrEmpty
(
pp
.
getSubject
())
&&
!
hasSAN
(
pp
.
getSubjectAltNameList
()))
{
if
(
isNullOrEmpty
(
pp
.
getSubject
())
&&
!
hasSAN
(
pp
.
getSubjectAltNameList
()))
{
return
TLS
;
return
TLS
;
}
}
...
...
oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/Addresses.java
0 → 100644
浏览文件 @
aecb1b39
/*
* 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.receiver.envoy.als.k8s
;
import
io.envoyproxy.envoy.config.core.v3.Address
;
import
static
java
.
util
.
Objects
.
nonNull
;
import
static
org
.
apache
.
skywalking
.
apm
.
util
.
StringUtil
.
isNotBlank
;
public
class
Addresses
{
public
static
boolean
isValid
(
final
Address
address
)
{
return
nonNull
(
address
)
&&
address
.
hasSocketAddress
()
&&
isNotBlank
(
address
.
getSocketAddress
().
getAddress
());
}
}
oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/k8s/K8sALSServiceMeshHTTPAnalysis.java
浏览文件 @
aecb1b39
...
@@ -35,8 +35,10 @@ import org.apache.skywalking.oap.server.receiver.envoy.als.AbstractALSAnalyzer;
...
@@ -35,8 +35,10 @@ import org.apache.skywalking.oap.server.receiver.envoy.als.AbstractALSAnalyzer;
import
org.apache.skywalking.oap.server.receiver.envoy.als.Role
;
import
org.apache.skywalking.oap.server.receiver.envoy.als.Role
;
import
org.apache.skywalking.oap.server.receiver.envoy.als.ServiceMetaInfo
;
import
org.apache.skywalking.oap.server.receiver.envoy.als.ServiceMetaInfo
;
import
static
org
.
apache
.
skywalking
.
apm
.
util
.
StringUtil
.
isBlank
;
import
static
org
.
apache
.
skywalking
.
oap
.
server
.
library
.
util
.
CollectionUtils
.
isNotEmpty
;
import
static
org
.
apache
.
skywalking
.
oap
.
server
.
library
.
util
.
CollectionUtils
.
isNotEmpty
;
import
static
org
.
apache
.
skywalking
.
oap
.
server
.
receiver
.
envoy
.
als
.
LogEntry2MetricsAdapter
.
NON_TLS
;
import
static
org
.
apache
.
skywalking
.
oap
.
server
.
receiver
.
envoy
.
als
.
LogEntry2MetricsAdapter
.
NON_TLS
;
import
static
org
.
apache
.
skywalking
.
oap
.
server
.
receiver
.
envoy
.
als
.
k8s
.
Addresses
.
isValid
;
/**
/**
* Analysis log based on ingress and mesh scenarios.
* Analysis log based on ingress and mesh scenarios.
...
@@ -81,12 +83,12 @@ public class K8sALSServiceMeshHTTPAnalysis extends AbstractALSAnalyzer {
...
@@ -81,12 +83,12 @@ public class K8sALSServiceMeshHTTPAnalysis extends AbstractALSAnalyzer {
}
}
protected
List
<
ServiceMeshMetric
.
Builder
>
analyzeSideCar
(
final
HTTPAccessLogEntry
entry
)
{
protected
List
<
ServiceMeshMetric
.
Builder
>
analyzeSideCar
(
final
HTTPAccessLogEntry
entry
)
{
final
AccessLogCommon
properties
=
entry
.
getCommonProperties
();
if
(!
entry
.
hasCommonProperties
())
{
if
(
properties
==
null
)
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
final
AccessLogCommon
properties
=
entry
.
getCommonProperties
();
final
String
cluster
=
properties
.
getUpstreamCluster
();
final
String
cluster
=
properties
.
getUpstreamCluster
();
if
(
cluster
==
null
)
{
if
(
isBlank
(
cluster
)
)
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
...
@@ -98,6 +100,9 @@ public class K8sALSServiceMeshHTTPAnalysis extends AbstractALSAnalyzer {
...
@@ -98,6 +100,9 @@ public class K8sALSServiceMeshHTTPAnalysis extends AbstractALSAnalyzer {
:
properties
.
getDownstreamRemoteAddress
();
:
properties
.
getDownstreamRemoteAddress
();
final
ServiceMetaInfo
downstreamService
=
find
(
downstreamRemoteAddress
.
getSocketAddress
().
getAddress
());
final
ServiceMetaInfo
downstreamService
=
find
(
downstreamRemoteAddress
.
getSocketAddress
().
getAddress
());
final
Address
downstreamLocalAddress
=
properties
.
getDownstreamLocalAddress
();
final
Address
downstreamLocalAddress
=
properties
.
getDownstreamLocalAddress
();
if
(!
isValid
(
downstreamRemoteAddress
)
||
!
isValid
(
downstreamLocalAddress
))
{
return
Collections
.
emptyList
();
}
final
ServiceMetaInfo
localService
=
find
(
downstreamLocalAddress
.
getSocketAddress
().
getAddress
());
final
ServiceMetaInfo
localService
=
find
(
downstreamLocalAddress
.
getSocketAddress
().
getAddress
());
if
(
cluster
.
startsWith
(
"inbound|"
))
{
if
(
cluster
.
startsWith
(
"inbound|"
))
{
...
@@ -119,6 +124,9 @@ public class K8sALSServiceMeshHTTPAnalysis extends AbstractALSAnalyzer {
...
@@ -119,6 +124,9 @@ public class K8sALSServiceMeshHTTPAnalysis extends AbstractALSAnalyzer {
}
else
if
(
cluster
.
startsWith
(
"outbound|"
))
{
}
else
if
(
cluster
.
startsWith
(
"outbound|"
))
{
// sidecar(client side) -> sidecar
// sidecar(client side) -> sidecar
final
Address
upstreamRemoteAddress
=
properties
.
getUpstreamRemoteAddress
();
final
Address
upstreamRemoteAddress
=
properties
.
getUpstreamRemoteAddress
();
if
(!
isValid
(
upstreamRemoteAddress
))
{
return
sources
;
}
final
ServiceMetaInfo
destService
=
find
(
upstreamRemoteAddress
.
getSocketAddress
().
getAddress
());
final
ServiceMetaInfo
destService
=
find
(
upstreamRemoteAddress
.
getSocketAddress
().
getAddress
());
final
ServiceMeshMetric
.
Builder
metric
=
newAdapter
(
entry
,
downstreamService
,
destService
).
adaptToUpstreamMetrics
();
final
ServiceMeshMetric
.
Builder
metric
=
newAdapter
(
entry
,
downstreamService
,
destService
).
adaptToUpstreamMetrics
();
...
@@ -131,15 +139,15 @@ public class K8sALSServiceMeshHTTPAnalysis extends AbstractALSAnalyzer {
...
@@ -131,15 +139,15 @@ public class K8sALSServiceMeshHTTPAnalysis extends AbstractALSAnalyzer {
}
}
protected
List
<
ServiceMeshMetric
.
Builder
>
analyzeProxy
(
final
HTTPAccessLogEntry
entry
)
{
protected
List
<
ServiceMeshMetric
.
Builder
>
analyzeProxy
(
final
HTTPAccessLogEntry
entry
)
{
final
AccessLogCommon
properties
=
entry
.
getCommonProperties
();
if
(!
entry
.
hasCommonProperties
())
{
if
(
properties
==
null
)
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
final
AccessLogCommon
properties
=
entry
.
getCommonProperties
();
final
Address
downstreamLocalAddress
=
properties
.
getDownstreamLocalAddress
();
final
Address
downstreamLocalAddress
=
properties
.
getDownstreamLocalAddress
();
final
Address
downstreamRemoteAddress
=
properties
.
hasDownstreamDirectRemoteAddress
()
?
final
Address
downstreamRemoteAddress
=
properties
.
hasDownstreamDirectRemoteAddress
()
?
properties
.
getDownstreamDirectRemoteAddress
()
:
properties
.
getDownstreamRemoteAddress
();
properties
.
getDownstreamDirectRemoteAddress
()
:
properties
.
getDownstreamRemoteAddress
();
final
Address
upstreamRemoteAddress
=
properties
.
getUpstreamRemoteAddress
();
final
Address
upstreamRemoteAddress
=
properties
.
getUpstreamRemoteAddress
();
if
(
downstreamLocalAddress
==
null
||
downstreamRemoteAddress
==
null
||
upstreamRemoteAddress
==
null
)
{
if
(
!
isValid
(
downstreamLocalAddress
)
||
!
isValid
(
downstreamRemoteAddress
)
||
!
isValid
(
upstreamRemoteAddress
)
)
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录