From f060ccc5e6790280ed4a8bf4a7850c1309fae4bb Mon Sep 17 00:00:00 2001 From: ankitchoudhary111 <35135474+ankitchoudhary111@users.noreply.github.com> Date: Fri, 24 Sep 2021 11:36:47 +0530 Subject: [PATCH] Filter out internal attributes using the internal flag (#78) * filtered out attributes using the internal flag in the getAll method * corrected mistake in if condition * filtering out internal attributes * snyk-scan fix * same version for netty libs Co-authored-by: Ankit Choudhary --- .../core/graphql/attributes/CachingAttributeStore.java | 2 ++ .../core/graphql/attributes/CachingAttributeStoreTest.java | 6 +++++- hypertrace-core-graphql-platform/build.gradle.kts | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hypertrace-core-graphql-attribute-store/src/main/java/org/hypertrace/core/graphql/attributes/CachingAttributeStore.java b/hypertrace-core-graphql-attribute-store/src/main/java/org/hypertrace/core/graphql/attributes/CachingAttributeStore.java index 55cd2cc4..2e141fee 100644 --- a/hypertrace-core-graphql-attribute-store/src/main/java/org/hypertrace/core/graphql/attributes/CachingAttributeStore.java +++ b/hypertrace-core-graphql-attribute-store/src/main/java/org/hypertrace/core/graphql/attributes/CachingAttributeStore.java @@ -7,6 +7,7 @@ import javax.inject.Inject; import javax.inject.Singleton; import org.hypertrace.core.attribute.service.cachingclient.CachingAttributeClient; +import org.hypertrace.core.attribute.service.v1.AttributeMetadataFilter; import org.hypertrace.core.graphql.context.GraphQlRequestContext; import org.hypertrace.core.graphql.spi.config.GraphQlServiceConfig; import org.hypertrace.core.graphql.utils.grpc.GrpcChannelRegistry; @@ -36,6 +37,7 @@ class CachingAttributeStore implements AttributeStore { channelRegistry.forAddress( serviceConfig.getAttributeServiceHost(), serviceConfig.getAttributeServicePort())) + .withAttributeFilter(AttributeMetadataFilter.newBuilder().setInternal(false).build()) .withCacheExpiration(Duration.ofMinutes(5)) .withMaximumCacheContexts(1000) .build()); diff --git a/hypertrace-core-graphql-attribute-store/src/test/java/org/hypertrace/core/graphql/attributes/CachingAttributeStoreTest.java b/hypertrace-core-graphql-attribute-store/src/test/java/org/hypertrace/core/graphql/attributes/CachingAttributeStoreTest.java index f5122ae0..f507b159 100644 --- a/hypertrace-core-graphql-attribute-store/src/test/java/org/hypertrace/core/graphql/attributes/CachingAttributeStoreTest.java +++ b/hypertrace-core-graphql-attribute-store/src/test/java/org/hypertrace/core/graphql/attributes/CachingAttributeStoreTest.java @@ -53,7 +53,11 @@ void supportsBasicRead() { AttributeModel spanIdAttribute = DefaultAttributeModel.builder().scope("SPAN").key("id").build(); AttributeMetadata spanIdResponse = - AttributeMetadata.newBuilder().setScopeString("SPAN").setKey("id").build(); + AttributeMetadata.newBuilder() + .setScopeString("SPAN") + .setKey("id") + .setInternal(false) + .build(); when(this.mockAttributeClient.get("SPAN", "id")).thenReturn(Single.just(spanIdResponse)); when(this.mockAttributeModeTranslator.translate(spanIdResponse)) diff --git a/hypertrace-core-graphql-platform/build.gradle.kts b/hypertrace-core-graphql-platform/build.gradle.kts index f39d324d..d6dd05e9 100644 --- a/hypertrace-core-graphql-platform/build.gradle.kts +++ b/hypertrace-core-graphql-platform/build.gradle.kts @@ -9,7 +9,7 @@ dependencies { api("org.hypertrace.core.grpcutils:grpc-client-utils:0.6.1") api("org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.6.1") api("org.hypertrace.gateway.service:gateway-service-api:0.1.59") - api("org.hypertrace.core.attribute.service:caching-attribute-service-client:0.13.3") + api("org.hypertrace.core.attribute.service:caching-attribute-service-client:0.13.5") api("com.google.inject:guice:4.2.3") api("com.graphql-java:graphql-java:15.0") @@ -35,10 +35,10 @@ dependencies { runtime("org.apache.logging.log4j:log4j-slf4j-impl:2.14.0") runtime("io.grpc:grpc-netty:1.40.0") - runtime("io.netty:netty-codec-http2:4.1.61.Final") { + runtime("io.netty:netty-codec-http2:4.1.68.Final") { because("https://snyk.io/vuln/SNYK-JAVA-IONETTY-1083991") } - runtime("io.netty:netty-handler-proxy:4.1.61.Final") { + runtime("io.netty:netty-handler-proxy:4.1.68.Final") { because("https://snyk.io/vuln/SNYK-JAVA-IONETTY-1083991") } }