diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 4521bb9b..465fc887 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -68,6 +68,6 @@ jobs: - name: Setup snyk uses: snyk/actions/setup@0.3.0 - name: Snyk test - run: snyk test --all-sub-projects --org=hypertrace --severity-threshold=low --policy-path=.snyk + run: snyk test --all-sub-projects --org=hypertrace --severity-threshold=low --policy-path=.snyk --remote-repo-url='${{ github.server_url }}/${{ github.repository }}.git' env: SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 80d8ff33..b9dfe86d 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -34,10 +34,9 @@ jobs: args: jacocoTestReport - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2 with: name: unit test reports - fail_ci_if_error: true flags: unit - name: Publish Unit Test Results diff --git a/hypertrace-core-graphql-attribute-store/src/main/java/org/hypertrace/core/graphql/attributes/AttributeStore.java b/hypertrace-core-graphql-attribute-store/src/main/java/org/hypertrace/core/graphql/attributes/AttributeStore.java index 6d3d7029..0f018f83 100644 --- a/hypertrace-core-graphql-attribute-store/src/main/java/org/hypertrace/core/graphql/attributes/AttributeStore.java +++ b/hypertrace-core-graphql-attribute-store/src/main/java/org/hypertrace/core/graphql/attributes/AttributeStore.java @@ -5,7 +5,7 @@ import org.hypertrace.core.graphql.context.GraphQlRequestContext; public interface AttributeStore { - Single> getAll(GraphQlRequestContext context); + Single> getAllExternal(GraphQlRequestContext context); Single get(GraphQlRequestContext context, String scope, String key); 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 2e141fee..9fe0a9a1 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,7 +7,6 @@ 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; @@ -37,7 +36,6 @@ class CachingAttributeStore implements AttributeStore { channelRegistry.forAddress( serviceConfig.getAttributeServiceHost(), serviceConfig.getAttributeServicePort())) - .withAttributeFilter(AttributeMetadataFilter.newBuilder().setInternal(false).build()) .withCacheExpiration(Duration.ofMinutes(5)) .withMaximumCacheContexts(1000) .build()); @@ -55,10 +53,11 @@ class CachingAttributeStore implements AttributeStore { } @Override - public Single> getAll(GraphQlRequestContext requestContext) { + public Single> getAllExternal(GraphQlRequestContext requestContext) { return GrpcRxExecutionContext.forContext(this.grpcContextBuilder.build(requestContext)) .wrapSingle(this.cachingAttributeClient::getAll) .flattenAsObservable(list -> list) + .filter(attribute -> !attribute.getInternal()) .mapOptional(this.translator::translate) .toList(); } 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 f507b159..f0dcc3c8 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 @@ -59,15 +59,24 @@ void supportsBasicRead() { .setInternal(false) .build(); + AttributeMetadata internalAttrResponse = + AttributeMetadata.newBuilder() + .setScopeString("SPAN") + .setKey("other") + .setInternal(true) + .build(); + when(this.mockAttributeClient.get("SPAN", "id")).thenReturn(Single.just(spanIdResponse)); when(this.mockAttributeModeTranslator.translate(spanIdResponse)) .thenReturn(Optional.of(spanIdAttribute)); assertEquals(spanIdAttribute, this.attributeStore.get(mockContext, "SPAN", "id").blockingGet()); - when(this.mockAttributeClient.getAll()).thenReturn(Single.just(List.of(spanIdResponse))); + when(this.mockAttributeClient.getAll()) + .thenReturn(Single.just(List.of(spanIdResponse, internalAttrResponse))); - assertEquals(List.of(spanIdAttribute), this.attributeStore.getAll(mockContext).blockingGet()); + assertEquals( + List.of(spanIdAttribute), this.attributeStore.getAllExternal(mockContext).blockingGet()); } @Test diff --git a/hypertrace-core-graphql-metadata-schema/src/main/java/org/hypertrace/core/graphql/metadata/fetcher/MetadataFetcher.java b/hypertrace-core-graphql-metadata-schema/src/main/java/org/hypertrace/core/graphql/metadata/fetcher/MetadataFetcher.java index 5783dd51..5ad55b33 100644 --- a/hypertrace-core-graphql-metadata-schema/src/main/java/org/hypertrace/core/graphql/metadata/fetcher/MetadataFetcher.java +++ b/hypertrace-core-graphql-metadata-schema/src/main/java/org/hypertrace/core/graphql/metadata/fetcher/MetadataFetcher.java @@ -30,7 +30,7 @@ static final class MetadataFetcherImpl @Override public CompletableFuture> get(DataFetchingEnvironment environment) { return this.attributeStore - .getAll(environment.getContext()) + .getAllExternal(environment.getContext()) .flatMap(this.responseBuilder::build) .toCompletionStage() .toCompletableFuture(); diff --git a/hypertrace-core-graphql-metadata-schema/src/test/java/org/hypertrace/core/graphql/metadata/fetcher/MetadataFetcherTest.java b/hypertrace-core-graphql-metadata-schema/src/test/java/org/hypertrace/core/graphql/metadata/fetcher/MetadataFetcherTest.java index 4def8cf7..3a677c79 100644 --- a/hypertrace-core-graphql-metadata-schema/src/test/java/org/hypertrace/core/graphql/metadata/fetcher/MetadataFetcherTest.java +++ b/hypertrace-core-graphql-metadata-schema/src/test/java/org/hypertrace/core/graphql/metadata/fetcher/MetadataFetcherTest.java @@ -36,7 +36,7 @@ void beforeEach() { List mockModelResult = List.of(mockModel); List mockMetadataResult = List.of(mockMetadata); when(this.mockDataFetchingEnvironment.getContext()).thenReturn(this.mockContext); - when(this.mockAttributeStore.getAll(eq(this.mockContext))) + when(this.mockAttributeStore.getAllExternal(eq(this.mockContext))) .thenReturn(Single.just(mockModelResult)); when(this.mockResponseBuilder.build(eq(mockModelResult))) .thenReturn(Single.just(mockMetadataResult));