-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add enable stats for peer endpoint of envoyproxy (#3145)
* feat: add enable stats for peer endpoint of envoyproxy Signed-off-by: ShyunnY <1147212064@qq.com> * fix: add warning comment Signed-off-by: ShyunnY <1147212064@qq.com> * fix: update doc Signed-off-by: ShyunnY <1147212064@qq.com> * fix: gen-check Signed-off-by: ShyunnY <1147212064@qq.com> --------- Signed-off-by: ShyunnY <1147212064@qq.com> Co-authored-by: zirain <zirain2009@gmail.com>
- Loading branch information
Showing
42 changed files
with
1,077 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
internal/xds/translator/testdata/in/xds-ir/accesslog-endpoint-stats.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: "accesslog" | ||
metrics: | ||
enablePerEndpointStats: true | ||
accesslog: | ||
text: | ||
- path: "/dev/stdout" | ||
format: | | ||
[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%" | ||
json: | ||
- path: "/dev/stdout" | ||
json: | ||
start_time: "%START_TIME%" | ||
method: "%REQ(:METHOD)%" | ||
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" | ||
protocol: "%PROTOCOL%" | ||
response_code: "%RESPONSE_CODE%" | ||
openTelemetry: | ||
- text: | | ||
[%START_TIME%] "%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%" %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% "%REQ(X-FORWARDED-FOR)%" "%REQ(USER-AGENT)%" "%REQ(X-REQUEST-ID)%" "%REQ(:AUTHORITY)%" "%UPSTREAM_HOST%" | ||
attributes: | ||
"response_code": "%RESPONSE_CODE%" | ||
resources: | ||
"cluster_name": "cluster1" | ||
host: otel-collector.default.svc.cluster.local | ||
port: 4317 | ||
http: | ||
- name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
path: | ||
mergeSlashes: true | ||
escapedSlashesAction: UnescapeAndRedirect | ||
routes: | ||
- name: "direct-route" | ||
hostname: "*" | ||
destination: | ||
name: "direct-route-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 | ||
directResponse: | ||
body: "Unknown custom filter type: UnsupportedType" | ||
statusCode: 500 |
21 changes: 21 additions & 0 deletions
21
internal/xds/translator/testdata/in/xds-ir/http-endpoint-stats.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: "metrics-endpoint-stats" | ||
metrics: | ||
enablePerEndpointStats: true | ||
http: | ||
- name: "listener-enable-endpoint-stats" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
path: | ||
mergeSlashes: true | ||
escapedSlashesAction: UnescapeAndRedirect | ||
routes: | ||
- name: "first-route" | ||
hostname: "*" | ||
destination: | ||
name: "first-route-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 |
66 changes: 66 additions & 0 deletions
66
internal/xds/translator/testdata/in/xds-ir/ratelimit-endpoint-stats.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
metrics: | ||
enablePerEndpointStats: true | ||
http: | ||
- name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
path: | ||
mergeSlashes: true | ||
escapedSlashesAction: UnescapeAndRedirect | ||
routes: | ||
- name: "first-route" | ||
hostname: "*" | ||
rateLimit: | ||
global: | ||
rules: | ||
- headerMatches: | ||
- name: "x-user-id" | ||
exact: "one" | ||
limit: | ||
requests: 5 | ||
unit: second | ||
pathMatch: | ||
exact: "foo/bar" | ||
destination: | ||
name: "first-route-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 | ||
- name: "second-route" | ||
hostname: "*" | ||
rateLimit: | ||
global: | ||
rules: | ||
- headerMatches: | ||
- name: "x-user-id" | ||
distinct: true | ||
limit: | ||
requests: 5 | ||
unit: second | ||
pathMatch: | ||
exact: "example" | ||
destination: | ||
name: "second-route-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 | ||
- name: "third-route" | ||
hostname: "*" | ||
rateLimit: | ||
global: | ||
rules: | ||
- limit: | ||
requests: 5 | ||
unit: second | ||
pathMatch: | ||
exact: "test" | ||
destination: | ||
name: "third-route-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 |
15 changes: 15 additions & 0 deletions
15
internal/xds/translator/testdata/in/xds-ir/tcp-endpoint-stats.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: "metrics-endpoint-stats" | ||
metrics: | ||
enablePerEndpointStats: true | ||
tcp: | ||
- name: "tcp-route-enable-endpoint-stats" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
destination: | ||
name: "tcp-route-simple-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 | ||
- host: "5.6.7.8" | ||
port: 50001 |
44 changes: 44 additions & 0 deletions
44
internal/xds/translator/testdata/in/xds-ir/tracing-endpoint-stats.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: "tracing" | ||
metrics: | ||
enablePerEndpointStats: true | ||
tracing: | ||
serviceName: "fake-name.fake-ns" | ||
samplingRate: 90 | ||
customTags: | ||
"literal1": | ||
type: Literal | ||
literal: | ||
value: "value1" | ||
"env1": | ||
type: Environment | ||
environment: | ||
name: "env1" | ||
defaultValue: "-" | ||
"req1": | ||
type: RequestHeader | ||
requestHeader: | ||
name: "X-Request-Id" | ||
defaultValue: "-" | ||
host: otel-collector.monitoring.svc.cluster.local | ||
port: 4317 | ||
http: | ||
- name: "first-listener" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
hostnames: | ||
- "*" | ||
path: | ||
mergeSlashes: true | ||
escapedSlashesAction: UnescapeAndRedirect | ||
routes: | ||
- name: "direct-route" | ||
hostname: "*" | ||
destination: | ||
name: "direct-route-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 | ||
directResponse: | ||
body: "Unknown custom filter type: UnsupportedType" | ||
statusCode: 500 |
15 changes: 15 additions & 0 deletions
15
internal/xds/translator/testdata/in/xds-ir/udp-endpoint-stats.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: "metrics-endpoint-stats" | ||
metrics: | ||
enablePerEndpointStats: true | ||
udp: | ||
- name: "udp-route-enable-endpoint-stats" | ||
address: "0.0.0.0" | ||
port: 10080 | ||
destination: | ||
name: "udp-route-dest" | ||
settings: | ||
- endpoints: | ||
- host: "1.2.3.4" | ||
port: 50000 | ||
- host: "5.6.7.8" | ||
port: 50001 |
53 changes: 53 additions & 0 deletions
53
internal/xds/translator/testdata/out/xds-ir/accesslog-endpoint-stats.clusters.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
- circuitBreakers: | ||
thresholds: | ||
- maxRetries: 1024 | ||
commonLbConfig: | ||
localityWeightedLbConfig: {} | ||
connectTimeout: 10s | ||
dnsLookupFamily: V4_ONLY | ||
edsClusterConfig: | ||
edsConfig: | ||
ads: {} | ||
resourceApiVersion: V3 | ||
serviceName: direct-route-dest | ||
lbPolicy: LEAST_REQUEST | ||
name: direct-route-dest | ||
outlierDetection: {} | ||
perConnectionBufferLimitBytes: 32768 | ||
trackClusterStats: | ||
perEndpointStats: true | ||
type: EDS | ||
- circuitBreakers: | ||
thresholds: | ||
- maxRetries: 1024 | ||
commonLbConfig: | ||
localityWeightedLbConfig: {} | ||
connectTimeout: 10s | ||
dnsLookupFamily: V4_ONLY | ||
dnsRefreshRate: 30s | ||
lbPolicy: LEAST_REQUEST | ||
loadAssignment: | ||
clusterName: accesslog|otel-collector.default.svc.cluster.local|4317 | ||
endpoints: | ||
- lbEndpoints: | ||
- endpoint: | ||
address: | ||
socketAddress: | ||
address: otel-collector.default.svc.cluster.local | ||
portValue: 4317 | ||
loadBalancingWeight: 1 | ||
loadBalancingWeight: 1 | ||
locality: | ||
region: accesslog|otel-collector.default.svc.cluster.local|4317/backend/0 | ||
name: accesslog|otel-collector.default.svc.cluster.local|4317 | ||
outlierDetection: {} | ||
perConnectionBufferLimitBytes: 32768 | ||
respectDnsTtl: true | ||
trackClusterStats: | ||
perEndpointStats: true | ||
type: STRICT_DNS | ||
typedExtensionProtocolOptions: | ||
envoy.extensions.upstreams.http.v3.HttpProtocolOptions: | ||
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions | ||
explicitHttpConfig: | ||
http2ProtocolOptions: {} |
12 changes: 12 additions & 0 deletions
12
internal/xds/translator/testdata/out/xds-ir/accesslog-endpoint-stats.endpoints.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
- clusterName: direct-route-dest | ||
endpoints: | ||
- lbEndpoints: | ||
- endpoint: | ||
address: | ||
socketAddress: | ||
address: 1.2.3.4 | ||
portValue: 50000 | ||
loadBalancingWeight: 1 | ||
loadBalancingWeight: 1 | ||
locality: | ||
region: direct-route-dest/backend/0 |
Oops, something went wrong.