Skip to content

Commit

Permalink
accesslog: remove ALS gRPC initialMetadata (envoyproxy#3751)
Browse files Browse the repository at this point in the history
remove ALS gRPC initialMetadata

Signed-off-by: zirain <zirain2009@gmail.com>
  • Loading branch information
zirain authored Jul 12, 2024
1 parent 11dd6d3 commit b9d1493
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 41 deletions.
22 changes: 0 additions & 22 deletions internal/xds/translator/accesslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package translator

import (
"encoding/json"
"errors"
"sort"
"strings"
Expand Down Expand Up @@ -190,27 +189,6 @@ func buildXdsAccessLog(al *ir.AccessLog, forListener bool) []*accesslog.AccessLo
TransportApiVersion: cfgcore.ApiVersion_V3,
}

// include text and json format as metadata when initiating stream
md := make([]*cfgcore.HeaderValue, 0, 2)

if als.Text != nil && *als.Text != "" {
md = append(md, &cfgcore.HeaderValue{
Key: "x-accesslog-text",
Value: strings.ReplaceAll(strings.Trim(*als.Text, "\x00\n\r"), "\x00\n\r", " "),
})
}

if len(als.Attributes) > 0 {
if attr, err := json.Marshal(als.Attributes); err == nil {
md = append(md, &cfgcore.HeaderValue{
Key: "x-accesslog-attr",
Value: string(attr),
})
}
}

cc.GrpcService.InitialMetadata = md

switch als.Type {
case egv1a1.ALSEnvoyProxyAccessLogTypeHTTP:
alCfg := &grpcaccesslog.HttpGrpcAccessLogConfig{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@
grpcService:
envoyGrpc:
clusterName: accesslog/monitoring/envoy-als/port/9000
initialMetadata:
- key: x-accesslog-text
value: '[%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%"'
- key: x-accesslog-attr
value: '{"attr1":"value1","attr2":"value2"}'
transportApiVersion: V3
- filter:
responseFlagFilter:
Expand Down Expand Up @@ -127,15 +119,6 @@
grpcService:
envoyGrpc:
clusterName: accesslog/monitoring/envoy-als/port/9000
initialMetadata:
- key: x-accesslog-text
value: '[%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%"'
- key: x-accesslog-attr
value: '{"attr1":"value1","attr2":"value2"}'
transportApiVersion: V3
- name: envoy.access_loggers.open_telemetry
typedConfig:
Expand Down
4 changes: 2 additions & 2 deletions tools/make/kube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ experimental-conformance: create-cluster kube-install-image kube-deploy run-expe
benchmark: create-cluster kube-install-image kube-deploy-for-benchmark-test run-benchmark delete-cluster ## Create a kind cluster, deploy EG into it, run Envoy Gateway benchmark test, and clean up.

.PHONY: e2e
e2e: create-cluster kube-install-image kube-deploy install-ratelimit run-e2e delete-cluster
e2e: create-cluster kube-install-image kube-deploy install-ratelimit install-e2e-telemetry run-e2e delete-cluster

.PHONY: install-ratelimit
install-ratelimit:
Expand All @@ -133,7 +133,7 @@ install-ratelimit:
kubectl wait --timeout=5m -n envoy-gateway-system deployment/envoy-ratelimit --for=condition=Available

.PHONY: run-e2e
run-e2e: install-e2e-telemetry
run-e2e: ## Run e2e tests
@$(LOG_TARGET)
kubectl wait --timeout=5m -n envoy-gateway-system deployment/envoy-ratelimit --for=condition=Available
kubectl wait --timeout=5m -n envoy-gateway-system deployment/envoy-gateway --for=condition=Available
Expand Down

0 comments on commit b9d1493

Please sign in to comment.