Skip to content

Commit

Permalink
Trace parsed unvalidated resources
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Sep 11, 2023
1 parent c41c3da commit 5c8b11b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export class ClusterResourceType extends XdsResourceType {
);
}
const message = decodeSingleResource(CDS_TYPE_URL, resource.value);
trace('Decoded raw resource of type ' + CDS_TYPE_URL + ': ' + JSON.stringify(message));
const validatedMessage = this.validateResource(context, message);
if (validatedMessage) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export class EndpointResourceType extends XdsResourceType {
);
}
const message = decodeSingleResource(EDS_TYPE_URL, resource.value);
trace('Decoded raw resource of type ' + EDS_TYPE_URL + ': ' + JSON.stringify(message));
const validatedMessage = this.validateResource(message);
if (validatedMessage) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export class ListenerResourceType extends XdsResourceType {
);
}
const message = decodeSingleResource(LDS_TYPE_URL, resource.value);
trace('Decoded raw resource of type ' + LDS_TYPE_URL + ': ' + JSON.stringify(message));
const validatedMessage = this.validateResource(message);
if (validatedMessage) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*
*/

import { experimental, logVerbosity } from "@grpc/grpc-js";
import { EXPERIMENTAL_FAULT_INJECTION, EXPERIMENTAL_RETRY } from "../environment";
import { RetryPolicy__Output } from "../generated/envoy/config/route/v3/RetryPolicy";
import { RouteConfiguration__Output } from "../generated/envoy/config/route/v3/RouteConfiguration";
Expand All @@ -24,6 +25,11 @@ import { validateOverrideFilter } from "../http-filter";
import { RDS_TYPE_URL, decodeSingleResource } from "../resources";
import { Watcher, XdsClient } from "../xds-client";
import { XdsDecodeContext, XdsDecodeResult, XdsResourceType } from "./xds-resource-type";
const TRACER_NAME = 'xds_client';

function trace(text: string): void {
experimental.trace(logVerbosity.DEBUG, TRACER_NAME, text);
}

const SUPPORTED_PATH_SPECIFIERS = ['prefix', 'path', 'safe_regex'];
const SUPPPORTED_HEADER_MATCH_SPECIFIERS = [
Expand Down Expand Up @@ -169,6 +175,7 @@ export class RouteConfigurationResourceType extends XdsResourceType {
);
}
const message = decodeSingleResource(RDS_TYPE_URL, resource.value);
trace('Decoded raw resource of type ' + RDS_TYPE_URL + ': ' + JSON.stringify(message));
const validatedMessage = this.validateResource(message);
if (validatedMessage) {
return {
Expand Down

0 comments on commit 5c8b11b

Please sign in to comment.