diff --git a/.github/workflows/merge-publish.yml b/.github/workflows/merge-publish.yml index df7730a5..5ecdc1fa 100644 --- a/.github/workflows/merge-publish.yml +++ b/.github/workflows/merge-publish.yml @@ -7,29 +7,17 @@ on: jobs: merge-publish: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation - name: Check out code - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 with: fetch-depth: 0 submodules: recursive - - - name: create checksum file - uses: hypertrace/github-actions/checksum@main - - - name: Cache packages - uses: actions/cache@v2 - with: - path: ~/.gradle - key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} - restore-keys: | - gradle-packages-${{ runner.os }}-${{ github.job }} - gradle-packages-${{ runner.os }} - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_READ_USER }} password: ${{ secrets.DOCKERHUB_READ_TOKEN }} diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index a7852877..79624f4e 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -9,11 +9,11 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation - name: Check out code - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -23,20 +23,8 @@ jobs: - name: Ensure submodules point to commit from main branch run: git submodule foreach --recursive "git merge-base --is-ancestor HEAD origin/main" - - name: create checksum file - uses: hypertrace/github-actions/checksum@main - - - name: Cache packages - uses: actions/cache@v2 - with: - path: ~/.gradle - key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} - restore-keys: | - gradle-packages-${{ runner.os }}-${{ github.job }} - gradle-packages-${{ runner.os }} - - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_READ_USER }} password: ${{ secrets.DOCKERHUB_READ_TOKEN }} @@ -44,13 +32,13 @@ jobs: - name: Build with Gradle uses: hypertrace/github-actions/gradle@main with: - args: build dockerBuildImages + args: assemble dockerBuildImages validate-helm-charts: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Check out code - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -59,23 +47,3 @@ jobs: - name: validate charts uses: hypertrace/github-actions/validate-charts@main - - snyk-scan: - runs-on: ubuntu-20.04 - steps: - # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation - - name: Check out code - uses: actions/checkout@v2.3.4 - with: - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - fetch-depth: 0 - submodules: recursive - - - 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 --remote-repo-url='${{ github.server_url }}/${{ github.repository }}.git' - env: - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} - GRADLE_OPTS: -Dorg.gradle.workers.max=1 # Snyk doesn't handle parallelism diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 90bfb55b..fbb2d447 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -7,35 +7,22 @@ on: jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation - name: Check out code - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 with: fetch-depth: 0 submodules: recursive - - - name: create checksum file - uses: hypertrace/github-actions/checksum@main - - - name: Cache packages - id: cache-packages - uses: actions/cache@v2 - with: - path: ~/.gradle - key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} - restore-keys: | - gradle-packages-${{ runner.os }}-${{ github.job }} - gradle-packages-${{ runner.os }} - name: Unit test uses: hypertrace/github-actions/gradle@main with: - args: jacocoTestReport + args: check jacocoTestReport - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: name: unit test reports flags: unit @@ -53,8 +40,13 @@ jobs: if: always() - name: Publish Unit Test Results - uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1.6 + uses: EnricoMi/publish-unit-test-result-action@v2 if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository with: github_token: ${{ secrets.GITHUB_TOKEN }} - files: ./**/build/test-results/**/*.xml \ No newline at end of file + files: ./**/build/test-results/**/*.xml + dependency-check: + runs-on: ubuntu-22.04 + steps: + - name: Dependency Check + uses: hypertrace/github-actions/dependency-check@main diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fda7cdfb..08fabe59 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,29 +8,17 @@ on: jobs: publish-artifacts: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation - name: Check out code - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 with: fetch-depth: 0 submodules: recursive - - - name: create checksum file - uses: hypertrace/github-actions/checksum@main - - - name: Cache packages - uses: actions/cache@v2 - with: - path: ~/.gradle - key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }} - restore-keys: | - gradle-packages-${{ runner.os }}-${{ github.job }} - gradle-packages-${{ runner.os }} - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_READ_USER }} password: ${{ secrets.DOCKERHUB_READ_TOKEN }} @@ -45,11 +33,11 @@ jobs: publish-helm-charts: needs: publish-artifacts - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation - name: Checkout Repository - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v3 with: fetch-depth: 0 submodules: recursive @@ -61,9 +49,9 @@ jobs: helm-gcs-repository: ${{ secrets.HELM_GCS_REPOSITORY }} publish-release-notes: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: hypertrace/github-actions/release-notes@main diff --git a/.github/workflows/update-locks.yml b/.github/workflows/update-locks.yml new file mode 100644 index 00000000..b1e7723a --- /dev/null +++ b/.github/workflows/update-locks.yml @@ -0,0 +1,31 @@ +name: Update Locks +on: + workflow_dispatch: + schedule: + - cron: '12 12 * * 5' +jobs: + update-versions: + runs-on: ubuntu-22.04 + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + - name: Calculate simple repository name + id: repo-basename + shell: bash + run: | + echo "value=`basename ${{ github.repository }}`" >> $GITHUB_OUTPUT + - name: Get Token from Github App + uses: tibdex/github-app-token@v2 + id: generate-token + with: + app_id: ${{ secrets.GH_CI_APP_ID }} + private_key: ${{ secrets.GH_CI_APP_PRIVATE_KEY }} + repositories: >- + [${{ toJson(steps.repo-basename.outputs.value) }}] + - name: Update locks if needed + uses: hypertrace/github-actions/raise-lock-pr@main + with: + token: ${{ steps.generate-token.outputs.token }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1f93dfcf..f6531c2c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ build .idea +.DS_Store diff --git a/.snyk b/.snyk deleted file mode 100644 index 154d7794..00000000 --- a/.snyk +++ /dev/null @@ -1,10 +0,0 @@ -# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. -version: v1.14.1 -# ignores vulnerabilities until expiry date; change duration by modifying expiry date -ignore: - SNYK-JAVA-IONETTY-1042268: - - '*': - reason: No replacement available - expires: 2022-03-31T00:00:00.000Z -patch: {} - diff --git a/build.gradle.kts b/build.gradle.kts index 0aa9c03c..f0c975f5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,31 +1,24 @@ plugins { - id("org.hypertrace.repository-plugin") version "0.4.0" - id("org.hypertrace.ci-utils-plugin") version "0.3.0" - id("org.hypertrace.jacoco-report-plugin") version "0.2.0" apply false - id("org.hypertrace.docker-java-application-plugin") version "0.9.0" apply false - id("org.hypertrace.docker-publish-plugin") version "0.9.0" apply false - id("org.hypertrace.code-style-plugin") version "1.1.0" apply false + alias(commonLibs.plugins.hypertrace.ciutils) + alias(commonLibs.plugins.hypertrace.codestyle) apply false + alias(commonLibs.plugins.owasp.dependencycheck) } subprojects { group = "org.hypertrace.graphql" pluginManager.withPlugin("java") { - apply(plugin = "org.hypertrace.code-style-plugin") + apply(plugin = commonLibs.plugins.hypertrace.codestyle.get().pluginId) configure { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } } +} - pluginManager.withPlugin("java-library") { - dependencies { - "api"(platform(project(":hypertrace-graphql-platform"))) - "annotationProcessor"(platform(project(":hypertrace-graphql-platform"))) - "testAnnotationProcessor"(platform(project(":hypertrace-graphql-platform"))) - "testImplementation"(platform("org.hypertrace.core.graphql:hypertrace-core-graphql-test-platform")) - "compileOnly"(platform(project(":hypertrace-graphql-platform"))) - "testCompileOnly"(platform(project(":hypertrace-graphql-platform"))) - } - } +dependencyCheck { + format = org.owasp.dependencycheck.reporting.ReportGenerator.Format.ALL.toString() + suppressionFile = "owasp-suppressions.xml" + scanConfigurations.add("runtimeClasspath") + failBuildOnCVSS = 7.0F } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..3b2bdc42 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,20 @@ +[libraries] +graphql-annotations = { module = "io.github.graphql-java:graphql-java-annotations", version = "9.1" } +graphql-servlet = { module = "com.graphql-java-kickstart:graphql-java-servlet", version = "14.0.0" } + +core-attribute-constants = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-scope-constants" } +core-schema-common = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-common-schema" } +core-schema-utils = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-schema-utils" } +core-schema-registry = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-schema-registry" } +core-schema-metadata = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-metadata-schema" } +core-schema-spans = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-span-schema" } +core-schema-logevents = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-log-event-schema" } +core-schema-traces = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-trace-schema" } +core-attribute-store = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-store" } +core-spi = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-spi" } +core-grpc = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-grpc-utils" } +core-context = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-context" } +core-deserialization = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-deserialization" } +core-rxutils = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-rx-utils" } +core-request-transformation = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-request-transformation" } +core-gateway-utils = { module = "org.hypertrace.core.graphql:hypertrace-core-graphql-gateway-service-utils" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f..d64cd491 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac0b842f..e6aba251 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..1aa94a42 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32..6689b85b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/helm/templates/serviceconfig.yaml b/helm/templates/serviceconfig.yaml index ce8e86dd..6df85802 100644 --- a/helm/templates/serviceconfig.yaml +++ b/helm/templates/serviceconfig.yaml @@ -18,6 +18,9 @@ data: graphql.corsEnabled = {{ .Values.serviceConfig.corsEnabled }} graphql.timeout = {{ .Values.serviceConfig.timeoutDuration }} + threads.io.max = {{ .Values.serviceConfig.threads.io }} + threads.request.max = {{ .Values.serviceConfig.threads.request }} + attribute.service = { host = {{ .Values.serviceConfig.attributeService.host }} port = {{ .Values.serviceConfig.attributeService.port }} diff --git a/helm/values.yaml b/helm/values.yaml index 6147b7d3..d3d4029f 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -47,6 +47,9 @@ serviceConfig: corsEnabled: true defaultTenantId: "" timeoutDuration: 30s + threads: + io: 10 + request: 10 attributeService: host: attribute-service port: 9012 diff --git a/hypertrace-core-graphql b/hypertrace-core-graphql index 23cb2239..15da6ece 160000 --- a/hypertrace-core-graphql +++ b/hypertrace-core-graphql @@ -1 +1 @@ -Subproject commit 23cb2239e5db37cafaaa8e7fcfc60bef4c626c47 +Subproject commit 15da6ece8c20b10ef0f9875722cd77716b82eae7 diff --git a/hypertrace-graphql-attribute-scope/build.gradle.kts b/hypertrace-graphql-attribute-scope/build.gradle.kts index c17047dd..48f04351 100644 --- a/hypertrace-graphql-attribute-scope/build.gradle.kts +++ b/hypertrace-graphql-attribute-scope/build.gradle.kts @@ -3,9 +3,9 @@ plugins { } dependencies { - api("com.google.inject:guice") - api("io.reactivex.rxjava3:rxjava") - api("org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-scope-constants") - api("org.hypertrace.core.graphql:hypertrace-core-graphql-common-schema") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-store") + api(commonLibs.guice) + api(commonLibs.rxjava3) + api(localLibs.core.attribute.constants) + api(localLibs.core.schema.common) + implementation(localLibs.core.attribute.store) } diff --git a/hypertrace-graphql-attribute-scope/gradle.lockfile b/hypertrace-graphql-attribute-scope/gradle.lockfile new file mode 100644 index 00000000..05764b1c --- /dev/null +++ b/hypertrace-graphql-attribute-scope/gradle.lockfile @@ -0,0 +1,61 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +aopalliance:aopalliance:1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.auth0:java-jwt:4.4.0=runtimeClasspath,testRuntimeClasspath +com.auth0:jwks-rsa:0.22.0=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.android:annotations:4.1.1.4=runtimeClasspath,testRuntimeClasspath +com.google.api.grpc:proto-google-common-protos:2.22.0=runtimeClasspath,testRuntimeClasspath +com.google.code.findbugs:jsr305:3.0.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.10.1=runtimeClasspath,testRuntimeClasspath +com.google.errorprone:error_prone_annotations:2.18.0=compileClasspath,testCompileClasspath +com.google.errorprone:error_prone_annotations:2.20.0=runtimeClasspath,testRuntimeClasspath +com.google.guava:failureaccess:1.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava-parent:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.inject:guice:6.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.j2objc:j2objc-annotations:2.8=compileClasspath,testCompileClasspath +com.google.protobuf:protobuf-java:3.24.1=runtimeClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-kickstart:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-servlet:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java-extended-scalars:17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java:19.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:java-dataloader:3.2.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.github.graphql-java:graphql-java-annotations:9.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-api:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-bom:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-context:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-core:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-inprocess:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf-lite:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-stub:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-util:1.60.0=runtimeClasspath,testRuntimeClasspath +io.netty:netty-bom:4.1.108.Final=runtimeClasspath,testRuntimeClasspath +io.perfmark:perfmark-api:0.26.0=runtimeClasspath,testRuntimeClasspath +io.reactivex.rxjava3:rxjava:3.1.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.annotation:javax.annotation-api:1.3.2=runtimeClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:4.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.websocket:javax.websocket-api:1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.23=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:attribute-service-api:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:caching-attribute-service-client:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.reactivestreams:reactive-streams:1.0.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty=annotationProcessor diff --git a/hypertrace-graphql-entity-schema/build.gradle.kts b/hypertrace-graphql-entity-schema/build.gradle.kts index bfd0683b..a330fca7 100644 --- a/hypertrace-graphql-entity-schema/build.gradle.kts +++ b/hypertrace-graphql-entity-schema/build.gradle.kts @@ -1,41 +1,42 @@ plugins { `java-library` jacoco - id("org.hypertrace.jacoco-report-plugin") + alias(commonLibs.plugins.hypertrace.jacoco) } dependencies { - api("com.google.inject:guice") - api("com.graphql-java:graphql-java") - api("org.hypertrace.core.graphql:hypertrace-core-graphql-spi") - api("io.github.graphql-java:graphql-java-annotations") - api(project(":hypertrace-graphql-metric-schema")) - api("org.hypertrace.core.graphql:hypertrace-core-graphql-common-schema") + api(commonLibs.guice) + api(commonLibs.graphql.java) + api(localLibs.core.spi) + api(localLibs.graphql.annotations) + api(projects.hypertraceGraphqlMetricSchema) + api(localLibs.core.schema.common) - annotationProcessor("org.projectlombok:lombok") - compileOnly("org.projectlombok:lombok") - compileOnly(project(":hypertrace-graphql-attribute-scope")) + annotationProcessor(commonLibs.lombok) + compileOnly(commonLibs.lombok) + compileOnly(projects.hypertraceGraphqlAttributeScope) - implementation("org.slf4j:slf4j-api") - implementation("io.reactivex.rxjava3:rxjava") - implementation("org.hypertrace.gateway.service:gateway-service-api") - implementation("com.google.protobuf:protobuf-java-util") - implementation("com.google.guava:guava") + implementation(commonLibs.slf4j2.api) + implementation(commonLibs.rxjava3) + implementation(commonLibs.hypertrace.gatewayservice.api) + implementation(commonLibs.protobuf.javautil) + implementation(commonLibs.guava) + implementation(commonLibs.hypertrace.grpcutils.client) + implementation(projects.hypertraceGraphqlLabelsSchemaApi) - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-context") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-grpc-utils") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-schema-utils") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-store") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-deserialization") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-rx-utils") + implementation(localLibs.core.request.transformation) + implementation(localLibs.core.context) + implementation(localLibs.core.grpc) + implementation(localLibs.core.schema.utils) + implementation(localLibs.core.attribute.store) + implementation(localLibs.core.deserialization) + implementation(localLibs.core.rxutils) - implementation(project(":hypertrace-graphql-labels-schema-api")) - - testImplementation("org.junit.jupiter:junit-jupiter") - testImplementation("org.mockito:mockito-core") - testImplementation("org.mockito:mockito-junit-jupiter") - testAnnotationProcessor("org.projectlombok:lombok") - testCompileOnly("org.projectlombok:lombok") + testImplementation(commonLibs.junit.jupiter) + testImplementation(commonLibs.mockito.core) + testImplementation(commonLibs.mockito.junit) + testAnnotationProcessor(commonLibs.lombok) + testCompileOnly(commonLibs.lombok) } tasks.test { diff --git a/hypertrace-graphql-entity-schema/gradle.lockfile b/hypertrace-graphql-entity-schema/gradle.lockfile new file mode 100644 index 00000000..60c6b3a2 --- /dev/null +++ b/hypertrace-graphql-entity-schema/gradle.lockfile @@ -0,0 +1,83 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +aopalliance:aopalliance:1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.auth0:java-jwt:4.4.0=runtimeClasspath,testRuntimeClasspath +com.auth0:jwks-rsa:0.22.0=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.android:annotations:4.1.1.4=runtimeClasspath,testRuntimeClasspath +com.google.api.grpc:proto-google-common-protos:2.22.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.findbugs:jsr305:3.0.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.10.1=runtimeClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.8.9=compileClasspath,testCompileClasspath +com.google.errorprone:error_prone_annotations:2.20.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:failureaccess:1.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava-parent:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.inject:guice:6.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.j2objc:j2objc-annotations:2.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java-util:3.24.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java:3.24.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-kickstart:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-servlet:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java-extended-scalars:17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java:19.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:java-dataloader:3.2.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.github.graphql-java:graphql-java-annotations:9.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-api:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-bom:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-context:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-core:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-inprocess:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf-lite:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-stub:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-util:1.60.0=runtimeClasspath,testRuntimeClasspath +io.netty:netty-bom:4.1.108.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.perfmark:perfmark-api:0.26.0=runtimeClasspath,testRuntimeClasspath +io.reactivex.rxjava3:rxjava:3.1.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:4.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.websocket:javax.websocket-api:1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy-agent:1.14.10=testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.14.10=testCompileClasspath,testRuntimeClasspath +org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath +org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.23=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:attribute-service-api:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:caching-attribute-service-client:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-utils:0.13.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.gateway.service:gateway-service-api:0.3.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-api:5.10.0=testCompileClasspath +org.junit.jupiter:junit-jupiter-api:5.10.1=testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:5.10.1=testRuntimeClasspath +org.junit.jupiter:junit-jupiter-params:5.10.0=testCompileClasspath +org.junit.jupiter:junit-jupiter-params:5.10.1=testRuntimeClasspath +org.junit.jupiter:junit-jupiter:5.10.0=testCompileClasspath +org.junit.jupiter:junit-jupiter:5.10.1=testRuntimeClasspath +org.junit.platform:junit-platform-commons:1.10.0=testCompileClasspath +org.junit.platform:junit-platform-commons:1.10.1=testRuntimeClasspath +org.junit.platform:junit-platform-engine:1.10.1=testRuntimeClasspath +org.junit:junit-bom:5.10.0=testCompileClasspath +org.junit:junit-bom:5.10.1=testRuntimeClasspath +org.mockito:mockito-core:5.8.0=testCompileClasspath,testRuntimeClasspath +org.mockito:mockito-junit-jupiter:5.8.0=testCompileClasspath,testRuntimeClasspath +org.objenesis:objenesis:3.3=testRuntimeClasspath +org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath +org.projectlombok:lombok:1.18.30=annotationProcessor,compileClasspath,testCompileClasspath +org.reactivestreams:reactive-streams:1.0.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty= diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/EdgesDataFetcherImpl.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/EdgesDataFetcherImpl.java new file mode 100644 index 00000000..9b116665 --- /dev/null +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/EdgesDataFetcherImpl.java @@ -0,0 +1,55 @@ +package org.hypertrace.graphql.entity.dao; + +import graphql.schema.DataFetcher; +import graphql.schema.DataFetchingEnvironment; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; +import org.hypertrace.core.graphql.deserialization.ArgumentDeserializer; +import org.hypertrace.graphql.entity.schema.EdgeResultSet; +import org.hypertrace.graphql.entity.schema.Entity; +import org.hypertrace.graphql.entity.schema.EntityType; +import org.hypertrace.graphql.entity.schema.argument.NeighborEntityScopeArgument; +import org.hypertrace.graphql.entity.schema.argument.NeighborEntityTypeArgument; + +abstract class EdgesDataFetcherImpl implements DataFetcher> { + + private final ArgumentDeserializer argumentDeserializer; + + protected abstract EdgeResultSet getEdges( + Entity entity, EntityType neighborType, String neighborScope, List filterBy); + + EdgesDataFetcherImpl(ArgumentDeserializer argumentDeserializer) { + this.argumentDeserializer = argumentDeserializer; + } + + @Override + public CompletableFuture get(DataFetchingEnvironment environment) { + // TODO: Edges when used with filters have two limitations for now + // 1. We can only have one entityType incoming/outgoing edge + // 2. If different filters for same entity type, filters will be merged into one AND filter. + // + // We are passing the empty filter as argument to query the edges. + // This will work for now because we have restricted multiple edges selection in a request + // Fix this when we will solve the above two limitations. + return CompletableFuture.completedFuture( + getEdges( + environment.getSource(), + getNeighborEntityType(environment.getArguments()).orElse(null), + getNeighborEntityScope(environment.getArguments()).orElse(null), + Collections.emptyList())); + } + + private Optional getNeighborEntityScope(Map arguments) { + return this.argumentDeserializer.deserializePrimitive( + arguments, NeighborEntityScopeArgument.class); + } + + private Optional getNeighborEntityType(Map arguments) { + return this.argumentDeserializer.deserializePrimitive( + arguments, NeighborEntityTypeArgument.class); + } +} diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityConverter.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityConverter.java index c8b5d183..81e18ee3 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityConverter.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityConverter.java @@ -16,6 +16,7 @@ import lombok.experimental.Accessors; import org.hypertrace.core.graphql.common.request.AttributeRequest; import org.hypertrace.core.graphql.common.schema.attributes.arguments.AttributeExpression; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; import org.hypertrace.core.graphql.common.utils.BiConverter; import org.hypertrace.core.graphql.common.utils.TriConverter; import org.hypertrace.gateway.service.v1.baseline.BaselineEntitiesResponse; @@ -33,6 +34,7 @@ import org.hypertrace.graphql.metric.schema.MetricContainer; class GatewayServiceEntityConverter { + private final BiConverter< Collection, Map, Map> attributeMapConverter; @@ -143,6 +145,7 @@ private Single convertEntity( @lombok.Value @Accessors(fluent = true) private static class ConvertedEntity implements Entity { + String id; String type; Map attributeValues; @@ -161,13 +164,15 @@ public MetricContainer metric(AttributeExpression attributeExpression) { } @Override - public EdgeResultSet incomingEdges(EntityType neighborType, String neighborScope) { + public EdgeResultSet incomingEdges( + EntityType neighborType, String neighborScope, List filterBy) { return this.incomingEdges.getOrDefault( this.resolveEntityScope(neighborType, neighborScope), EMPTY_EDGE_RESULT_SET); } @Override - public EdgeResultSet outgoingEdges(EntityType neighborType, String neighborScope) { + public EdgeResultSet outgoingEdges( + EntityType neighborType, String neighborScope, List filterBy) { return this.outgoingEdges.getOrDefault( this.resolveEntityScope(neighborType, neighborScope), EMPTY_EDGE_RESULT_SET); @@ -188,6 +193,7 @@ private String resolveEntityScope( @lombok.Value @Accessors(fluent = true) private static class ConvertedEntityResultSet implements EntityResultSet { + List results; long total; long count; diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java index 9211674e..2088ee53 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityDao.java @@ -13,10 +13,12 @@ import lombok.extern.slf4j.Slf4j; import org.hypertrace.core.graphql.common.request.AttributeRequest; import org.hypertrace.core.graphql.context.GraphQlRequestContext; +import org.hypertrace.core.graphql.request.transformation.RequestTransformer; import org.hypertrace.core.graphql.rx.BoundedIoScheduler; import org.hypertrace.core.graphql.spi.config.GraphQlServiceConfig; import org.hypertrace.core.graphql.utils.grpc.GrpcChannelRegistry; import org.hypertrace.core.graphql.utils.grpc.GrpcContextBuilder; +import org.hypertrace.core.grpcutils.client.GrpcChannelConfig; import org.hypertrace.gateway.service.GatewayServiceGrpc; import org.hypertrace.gateway.service.GatewayServiceGrpc.GatewayServiceFutureStub; import org.hypertrace.gateway.service.v1.common.Value; @@ -43,6 +45,7 @@ class GatewayServiceEntityDao implements EntityDao { private final GraphQlServiceConfig serviceConfig; private final Scheduler boundedIoScheduler; private final LabelJoinerBuilder labelJoinerBuilder; + private final RequestTransformer requestTransformer; @Inject GatewayServiceEntityDao( @@ -54,6 +57,7 @@ class GatewayServiceEntityDao implements EntityDao { GatewayServiceEntityConverter entityConverter, BaselineDao baselineDao, LabelJoinerBuilder labelJoinerBuilder, + RequestTransformer requestTransformer, @BoundedIoScheduler Scheduler boundedIoScheduler) { this.grpcContextBuilder = grpcContextBuilder; this.requestBuilder = requestBuilder; @@ -61,20 +65,29 @@ class GatewayServiceEntityDao implements EntityDao { this.baselineDao = baselineDao; this.labelJoinerBuilder = labelJoinerBuilder; this.serviceConfig = serviceConfig; + this.requestTransformer = requestTransformer; this.boundedIoScheduler = boundedIoScheduler; + final GrpcChannelConfig grpcChannelConfig = + GrpcChannelConfig.builder() + .maxInboundMessageSize(serviceConfig.getGatewayServiceMaxInboundMessageSize()) + .build(); + this.gatewayServiceStub = GatewayServiceGrpc.newFutureStub( grpcChannelRegistry.forAddress( - serviceConfig.getGatewayServiceHost(), serviceConfig.getGatewayServicePort())) + serviceConfig.getGatewayServiceHost(), + serviceConfig.getGatewayServicePort(), + grpcChannelConfig)) .withCallCredentials(credentials); } @Override public Single getEntities(EntityRequest request) { GraphQlRequestContext context = request.resultSetRequest().context(); - return this.requestBuilder - .buildRequest(request) + return this.requestTransformer + .transform(request) + .flatMap(this.requestBuilder::buildRequest) .subscribeOn(this.boundedIoScheduler) .flatMap(serverRequest -> this.fetchAndMapEntities(context, request, serverRequest)); } diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityEdgeFetcher.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityEdgeFetcher.java index ae723f78..ba729000 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityEdgeFetcher.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityEdgeFetcher.java @@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory; class GatewayServiceEntityEdgeFetcher { + private static final Logger LOG = LoggerFactory.getLogger(GatewayServiceEntityEdgeFetcher.class); static final EdgeResultSet EMPTY_EDGE_RESULT_SET = new ConvertedEdgeResultSet(List.of()); @@ -119,9 +120,14 @@ private Maybe buildEdge( return zip( this.attributeMapConverter.convert( - edgeSetGroupRequest.attributeRequests(), response.getAttributeMap()), + edgeSetGroupRequest.edgeSetRequests().get(neighbor.type()).attributeRequests(), + response.getAttributeMap()), this.baselineMetricAggregationContainerMapConverter.convert( - edgeSetGroupRequest.metricAggregationRequests(), response.getMetricsMap()), + edgeSetGroupRequest + .edgeSetRequests() + .get(neighbor.type()) + .metricAggregationRequests(), + response.getMetricsMap()), (attributes, metrics) -> (Edge) new ConvertedEdge(neighbor, attributes, metrics)) .toMaybe(); } @@ -129,6 +135,7 @@ private Maybe buildEdge( @lombok.Value @Accessors(fluent = true) private static class ConvertedEdge implements Edge { + Entity neighbor; Map attributeValues; Map metricContainers; @@ -147,6 +154,7 @@ public BaselinedMetricAggregationContainer metric(AttributeExpression attributeE @lombok.Value @Accessors(fluent = true) private static class ConvertedEdgeResultSet implements EdgeResultSet { + List results; @Override diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java index 777344b4..f71a3ec1 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/GatewayServiceEntityInteractionRequestBuilder.java @@ -7,6 +7,7 @@ import java.util.Collection; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; import javax.inject.Inject; import lombok.Value; import lombok.experimental.Accessors; @@ -20,11 +21,14 @@ import org.hypertrace.core.graphql.common.utils.Converter; import org.hypertrace.gateway.service.v1.common.Expression; import org.hypertrace.gateway.service.v1.common.Filter; +import org.hypertrace.gateway.service.v1.common.Operator; import org.hypertrace.gateway.service.v1.entity.InteractionsRequest; import org.hypertrace.graphql.entity.request.EdgeSetGroupRequest; +import org.hypertrace.graphql.entity.request.EdgeSetRequest; import org.hypertrace.graphql.metric.request.MetricAggregationRequest; class GatewayServiceEntityInteractionRequestBuilder { + private static final Integer DEFAULT_INTERACTION_LIMIT = 1000; private final Converter, Set> selectionConverter; private final Converter, Set> @@ -42,13 +46,13 @@ class GatewayServiceEntityInteractionRequestBuilder { } Single build(EdgeSetGroupRequest edgeSetRequestGroup) { - if (edgeSetRequestGroup.entityTypes().isEmpty()) { + if (edgeSetRequestGroup.edgeSetRequests().isEmpty()) { return Single.just(InteractionsRequest.getDefaultInstance()); } return zip( this.collectSelectionsAndAggregations(edgeSetRequestGroup), - this.buildEntityTypeFilter(edgeSetRequestGroup), + this.buildEntityInteractionFilter(edgeSetRequestGroup), (selections, filter) -> InteractionsRequest.newBuilder() .addAllSelection(selections) @@ -59,34 +63,64 @@ Single build(EdgeSetGroupRequest edgeSetRequestGroup) { private Single> collectSelectionsAndAggregations(EdgeSetGroupRequest request) { return this.selectionConverter - .convert(request.attributeRequests()) - .mergeWith(this.aggregationConverter.convert(request.metricAggregationRequests())) + .convert(getAllAttributeRequests(request)) + .mergeWith(this.aggregationConverter.convert(getAllMetricAggregationRequests(request))) .toObservable() .flatMap(Observable::fromIterable) .collect(Collectors.toUnmodifiableSet()); } - private Single buildEntityTypeFilter(EdgeSetGroupRequest request) { - return Observable.fromIterable(request.entityTypes()) - .collect(Collectors.toUnmodifiableSet()) + private Set getAllAttributeRequests(EdgeSetGroupRequest request) { + return request.edgeSetRequests().values().stream() + .map(EdgeSetRequest::attributeRequests) + .flatMap(Collection::stream) + .collect(Collectors.toUnmodifiableSet()); + } + + private Set getAllMetricAggregationRequests( + EdgeSetGroupRequest request) { + return request.edgeSetRequests().values().stream() + .map(EdgeSetRequest::metricAggregationRequests) + .flatMap(Collection::stream) + .collect(Collectors.toUnmodifiableSet()); + } + + private Single buildEntityInteractionFilter(EdgeSetGroupRequest request) { + // Todo: we should be using converter taking argument as logical filters with filter arg schema + return Observable.fromIterable(request.edgeSetRequests().entrySet()) + .map( + entry -> + Stream.concat( + Stream.of(buildEntityTypeFilter(request, entry.getKey())), + entry.getValue().filterArguments().stream()) + .collect(Collectors.toUnmodifiableList())) + .flatMapSingle(this.filterConverter::convert) + .collect(Collectors.toUnmodifiableList()) .map( - entityTypes -> - AttributeAssociation.of( - request.neighborTypeAttribute().attributeExpressionAssociation().attribute(), - new EntityNeighborTypeFilter( - request.neighborTypeAttribute().attributeExpressionAssociation().value(), - entityTypes))) - .flatMap(filterAssociation -> this.filterConverter.convert(Set.of(filterAssociation))); + childFilters -> + Filter.newBuilder() + .setOperator(Operator.OR) + .addAllChildFilter(childFilters) + .build()); + } + + private AttributeAssociation buildEntityTypeFilter( + EdgeSetGroupRequest request, String entityType) { + return AttributeAssociation.of( + request.neighborTypeAttribute().attributeExpressionAssociation().attribute(), + new EntityNeighborTypeFilter( + request.neighborTypeAttribute().attributeExpressionAssociation().value(), entityType)); } @Value @Accessors(fluent = true) private static class EntityNeighborTypeFilter implements FilterArgument { + FilterType type = FilterType.ATTRIBUTE; String key = null; AttributeExpression keyExpression; - FilterOperatorType operator = FilterOperatorType.IN; - Collection value; + FilterOperatorType operator = FilterOperatorType.EQUALS; + String value; AttributeScope idType = null; String idScope = null; } diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/IncomingEdgesDataFetcher.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/IncomingEdgesDataFetcher.java new file mode 100644 index 00000000..dd506853 --- /dev/null +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/IncomingEdgesDataFetcher.java @@ -0,0 +1,33 @@ +package org.hypertrace.graphql.entity.dao; + +import java.util.List; +import javax.inject.Inject; +import org.hypertrace.core.graphql.common.fetcher.InjectableDataFetcher; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; +import org.hypertrace.core.graphql.deserialization.ArgumentDeserializer; +import org.hypertrace.graphql.entity.schema.EdgeResultSet; +import org.hypertrace.graphql.entity.schema.Entity; +import org.hypertrace.graphql.entity.schema.EntityType; + +public class IncomingEdgesDataFetcher extends InjectableDataFetcher { + public IncomingEdgesDataFetcher() { + super(IncomingEdgesDataFetcherImpl.class); + } + + private static class IncomingEdgesDataFetcherImpl extends EdgesDataFetcherImpl { + + @Inject + IncomingEdgesDataFetcherImpl(ArgumentDeserializer argumentDeserializer) { + super(argumentDeserializer); + } + + @Override + protected EdgeResultSet getEdges( + Entity entity, + EntityType neighborType, + String neighborScope, + List filterBy) { + return entity.incomingEdges(neighborType, neighborScope, filterBy); + } + } +} diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/OutgoingEdgesDataFetcher.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/OutgoingEdgesDataFetcher.java new file mode 100644 index 00000000..04541efb --- /dev/null +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/dao/OutgoingEdgesDataFetcher.java @@ -0,0 +1,34 @@ +package org.hypertrace.graphql.entity.dao; + +import java.util.List; +import javax.inject.Inject; +import org.hypertrace.core.graphql.common.fetcher.InjectableDataFetcher; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; +import org.hypertrace.core.graphql.deserialization.ArgumentDeserializer; +import org.hypertrace.graphql.entity.schema.EdgeResultSet; +import org.hypertrace.graphql.entity.schema.Entity; +import org.hypertrace.graphql.entity.schema.EntityType; + +public class OutgoingEdgesDataFetcher extends InjectableDataFetcher { + + public OutgoingEdgesDataFetcher() { + super(OutgoingEdgesDataFetcherImpl.class); + } + + private static class OutgoingEdgesDataFetcherImpl extends EdgesDataFetcherImpl { + + @Inject + OutgoingEdgesDataFetcherImpl(ArgumentDeserializer argumentDeserializer) { + super(argumentDeserializer); + } + + @Override + protected EdgeResultSet getEdges( + Entity entity, + EntityType neighborType, + String neighborScope, + List filterBy) { + return entity.outgoingEdges(neighborType, neighborScope, filterBy); + } + } +} diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/fetcher/EntityFetcher.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/fetcher/EntityFetcher.java index 5b4c0b29..679023ca 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/fetcher/EntityFetcher.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/fetcher/EntityFetcher.java @@ -1,5 +1,7 @@ package org.hypertrace.graphql.entity.fetcher; +import static org.hypertrace.core.graphql.context.GraphQlRequestContext.contextFromEnvironment; + import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import java.util.concurrent.CompletableFuture; @@ -29,7 +31,9 @@ static final class EntityFetcherImpl implements DataFetcher get(DataFetchingEnvironment environment) { return this.requestBuilder .build( - environment.getContext(), environment.getArguments(), environment.getSelectionSet()) + contextFromEnvironment(environment), + environment.getArguments(), + environment.getSelectionSet()) .flatMap(this.entityDao::getEntities) .toCompletionStage() .toCompletableFuture(); diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java index 08fde849..8a24ce58 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilder.java @@ -52,6 +52,7 @@ import org.hypertrace.core.graphql.utils.schema.SelectionQuery; import org.hypertrace.graphql.entity.dao.EntityDao; import org.hypertrace.graphql.entity.request.EdgeSetGroupRequest; +import org.hypertrace.graphql.entity.request.EdgeSetRequest; import org.hypertrace.graphql.entity.request.EntityLabelRequest; import org.hypertrace.graphql.entity.request.EntityLabelRequestBuilder; import org.hypertrace.graphql.entity.request.EntityRequest; @@ -59,7 +60,6 @@ import org.hypertrace.graphql.entity.schema.EntityJoinable; import org.hypertrace.graphql.entity.schema.EntityResultSet; import org.hypertrace.graphql.entity.schema.argument.EntityTypeStringArgument; -import org.hypertrace.graphql.metric.request.MetricAggregationRequest; import org.hypertrace.graphql.metric.request.MetricRequest; import org.hypertrace.graphql.metric.request.MetricRequestBuilder; import org.hypertrace.graphql.metric.schema.argument.AggregatableOrderArgument; @@ -317,11 +317,9 @@ private static class DefaultEntityRequest implements EntityRequest { @Value @Accessors(fluent = true) private static class EmptyEdgeSetGroupRequest implements EdgeSetGroupRequest { - Set entityTypes = Collections.emptySet(); - Collection attributeRequests = Collections.emptyList(); - Collection metricAggregationRequests = Collections.emptyList(); AttributeRequest neighborIdAttribute = null; AttributeRequest neighborTypeAttribute = null; + Map edgeSetRequests = Collections.emptyMap(); @Override public Single buildNeighborRequest( diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java index 39a9e154..788a0725 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java @@ -18,6 +18,7 @@ import org.hypertrace.core.graphql.common.request.ResultSetRequestBuilder; import org.hypertrace.core.graphql.common.schema.arguments.TimeRangeArgument; import org.hypertrace.core.graphql.common.schema.results.ResultSet; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; import org.hypertrace.core.graphql.common.schema.results.arguments.space.SpaceArgument; import org.hypertrace.core.graphql.context.GraphQlRequestContext; import org.hypertrace.core.graphql.deserialization.ArgumentDeserializer; @@ -74,6 +75,24 @@ public Single build( return this.build(context, arguments, entityScope, selectionSet); } + @Override + public Single rebuildWithAdditionalFilters( + EntityRequest originalRequest, List filterArguments) { + return this.resultSetRequestBuilder + .rebuildWithAdditionalFilters(originalRequest.resultSetRequest(), filterArguments) + .map( + newResultSetRequest -> + new DefaultEntityRequest( + originalRequest.entityType(), + newResultSetRequest, + originalRequest.metricRequests(), + originalRequest.incomingEdgeRequests(), + originalRequest.outgoingEdgeRequests(), + originalRequest.includeInactive(), + originalRequest.fetchTotal(), + originalRequest.labelRequest())); + } + private Single build( GraphQlRequestContext context, Map arguments, diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java index 4cad1968..62c6764c 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeRequestBuilder.java @@ -3,10 +3,12 @@ import static io.reactivex.rxjava3.core.Single.zip; import graphql.schema.SelectedField; +import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.Single; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Optional; import java.util.Set; import java.util.function.BiFunction; @@ -16,11 +18,14 @@ import javax.inject.Provider; import lombok.Value; import lombok.experimental.Accessors; +import org.hypertrace.core.graphql.common.request.AttributeAssociation; import org.hypertrace.core.graphql.common.request.AttributeRequest; import org.hypertrace.core.graphql.common.request.AttributeRequestBuilder; +import org.hypertrace.core.graphql.common.request.FilterRequestBuilder; import org.hypertrace.core.graphql.common.schema.arguments.TimeRangeArgument; import org.hypertrace.core.graphql.common.schema.attributes.arguments.AttributeExpression; import org.hypertrace.core.graphql.common.schema.results.ResultSet; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; import org.hypertrace.core.graphql.context.GraphQlRequestContext; import org.hypertrace.core.graphql.deserialization.ArgumentDeserializer; import org.hypertrace.core.graphql.utils.schema.GraphQlSelectionFinder; @@ -33,6 +38,7 @@ import org.hypertrace.graphql.metric.request.MetricAggregationRequestBuilder; class EdgeRequestBuilder { + private final String INCOMING_ENTITY_ID_KEY = "fromEntityId"; private final String INCOMING_ENTITY_TYPE_KEY = "fromEntityType"; private final String OUTGOING_ENTITY_ID_KEY = "toEntityId"; @@ -40,6 +46,7 @@ class EdgeRequestBuilder { private final ArgumentDeserializer argumentDeserializer; private final GraphQlSelectionFinder selectionFinder; private final MetricAggregationRequestBuilder metricAggregationRequestBuilder; + private final FilterRequestBuilder filterRequestBuilder; private final AttributeRequestBuilder attributeRequestBuilder; // Use provider to avoid cycle private final Provider neighborEntitiesRequestBuilderProvider; @@ -49,6 +56,7 @@ class EdgeRequestBuilder { ArgumentDeserializer argumentDeserializer, GraphQlSelectionFinder selectionFinder, MetricAggregationRequestBuilder metricAggregationRequestBuilder, + FilterRequestBuilder filterRequestBuilder, AttributeRequestBuilder attributeRequestBuilder, Provider neighborEntitiesRequestBuilderProvider) { this.argumentDeserializer = argumentDeserializer; @@ -56,6 +64,7 @@ class EdgeRequestBuilder { this.metricAggregationRequestBuilder = metricAggregationRequestBuilder; this.attributeRequestBuilder = attributeRequestBuilder; this.neighborEntitiesRequestBuilderProvider = neighborEntitiesRequestBuilderProvider; + this.filterRequestBuilder = filterRequestBuilder; } Single buildIncomingEdgeRequest( @@ -63,8 +72,7 @@ Single buildIncomingEdgeRequest( TimeRangeArgument timeRange, Optional space, Stream edgeSetFields) { - return this.buildEdgeRequest( - context, timeRange, space, this.getEdgesByType(edgeSetFields), EdgeType.INCOMING); + return this.buildEdgeRequest(context, timeRange, space, edgeSetFields, EdgeType.INCOMING); } Single buildOutgoingEdgeRequest( @@ -72,35 +80,28 @@ Single buildOutgoingEdgeRequest( TimeRangeArgument timeRange, Optional space, Stream edgeSetFields) { - return this.buildEdgeRequest( - context, timeRange, space, this.getEdgesByType(edgeSetFields), EdgeType.OUTGOING); + return this.buildEdgeRequest(context, timeRange, space, edgeSetFields, EdgeType.OUTGOING); } private Single buildEdgeRequest( GraphQlRequestContext context, TimeRangeArgument timeRange, Optional space, - Map> edgesByType, + Stream edgeSetFields, EdgeType edgeType) { - - Set allEdges = - edgesByType.values().stream() - .flatMap(Collection::stream) - .collect(Collectors.toUnmodifiableSet()); + Set edgeFields = edgeSetFields.collect(Collectors.toUnmodifiableSet()); + Map> edgesSelectionsByType = + this.getEdgesSelectionByType(edgeFields.stream()); return zip( - this.getRequestedAndRequiredAttributes(context, allEdges, edgeType), this.getNeighborIdAttribute(context, edgeType), this.getNeighborTypeAttribute(context, edgeType), - this.metricAggregationRequestBuilder.build( - context, HypertraceAttributeScopeString.INTERACTION, allEdges.stream()), - (attributeRequests, neighborIdRequest, neighborTypeRequest, metricRequests) -> + this.getEntityTypeToEdgeSetRequest(context, edgeType, edgeFields), + (neighborIdRequest, neighborTypeRequest, edgeRequests) -> new DefaultEdgeSetGroupRequest( - edgesByType.keySet(), - attributeRequests, - metricRequests, neighborIdRequest, neighborTypeRequest, + edgeRequests, (entityType, neighborIds) -> this.neighborEntitiesRequestBuilderProvider .get() @@ -110,11 +111,44 @@ private Single buildEdgeRequest( timeRange, space, neighborIds, - edgesByType.get(entityType)))); + edgesSelectionsByType.get(entityType)))); } - private Map> getEdgesByType(Stream edgeSetStream) { + private Single> getEntityTypeToEdgeSetRequest( + GraphQlRequestContext context, EdgeType edgeType, Set edgeFields) { + return Observable.fromIterable(edgeFields) + .collect(Collectors.groupingBy(this::getEntityType, Collectors.toUnmodifiableSet())) + .flatMap(edgeFieldsMap -> this.getEdgeSetRequestMap(context, edgeType, edgeFieldsMap)); + } + private Single> getEdgeSetRequestMap( + GraphQlRequestContext context, + EdgeType edgeType, + Map> entityTypeToEdgeFieldsMap) { + return Observable.fromIterable(entityTypeToEdgeFieldsMap.entrySet()) + .flatMapSingle( + entry -> + this.getEdgeSetRequestEntry(context, edgeType, entry.getKey(), entry.getValue())) + .collect(Collectors.toUnmodifiableMap(Entry::getKey, Entry::getValue)); + } + + private Single> getEdgeSetRequestEntry( + GraphQlRequestContext context, + EdgeType edgeType, + String entityType, + Set edgeFields) { + return zip( + this.getRequestedAndRequiredAttributes(context, edgeFields, edgeType), + this.getMetricAggregationRequestAttributes(context, edgeFields), + this.getFilterArguments(context, edgeFields), + (requestAttributes, metricAttributes, filters) -> + Map.entry( + entityType, + new DefaultEdgeSetRequest(requestAttributes, metricAttributes, filters))); + } + + private Map> getEdgesSelectionByType( + Stream edgeSetStream) { return edgeSetStream.collect( Collectors.groupingBy( this::getEntityType, @@ -137,11 +171,25 @@ private String getEntityType(SelectedField edgeSetField) { .orElseThrow(); } + private Single> getMetricAggregationRequestAttributes( + GraphQlRequestContext context, Collection edges) { + Set selections = + edges.stream() + .collect( + Collectors.flatMapping(this::getEdgesForEdgeSet, Collectors.toUnmodifiableSet())); + return this.metricAggregationRequestBuilder.build( + context, HypertraceAttributeScopeString.INTERACTION, selections.stream()); + } + private Single> getRequestedAndRequiredAttributes( GraphQlRequestContext context, Collection edges, EdgeType edgeType) { + Set selections = + edges.stream() + .collect( + Collectors.flatMapping(this::getEdgesForEdgeSet, Collectors.toUnmodifiableSet())); return this.attributeRequestBuilder .buildForAttributeQueryableFields( - context, HypertraceAttributeScopeString.INTERACTION, edges.stream()) + context, HypertraceAttributeScopeString.INTERACTION, selections.stream()) .mergeWith(this.getNeighborIdAttribute(context, edgeType)) .mergeWith(this.getNeighborTypeAttribute(context, edgeType)) .collect(Collectors.toUnmodifiableList()); @@ -165,6 +213,23 @@ private Single getNeighborIdAttribute( } } + private Single>> getFilterArguments( + GraphQlRequestContext context, Set edgeFields) { + Set filterArguments = + edgeFields.stream() + .collect(Collectors.flatMapping(this::getFilter, Collectors.toUnmodifiableSet())); + + return this.filterRequestBuilder.build( + context, HypertraceAttributeScopeString.INTERACTION, filterArguments); + } + + private Stream getFilter(SelectedField selectedField) { + return this.argumentDeserializer + .deserializeObjectList(selectedField.getArguments(), FilterArgument.class) + .stream() + .flatMap(Collection::stream); + } + private Single getNeighborTypeAttribute( GraphQlRequestContext context, EdgeType edgeType) { switch (edgeType) { @@ -191,11 +256,9 @@ private enum EdgeType { @Value @Accessors(fluent = true) private static class DefaultEdgeSetGroupRequest implements EdgeSetGroupRequest { - Set entityTypes; - Collection attributeRequests; - Collection metricAggregationRequests; AttributeRequest neighborIdAttribute; AttributeRequest neighborTypeAttribute; + Map edgeSetRequests; BiFunction, Single> neighborRequestBuilder; @Override @@ -204,4 +267,12 @@ public Single buildNeighborRequest( return this.neighborRequestBuilder.apply(entityType, neighborIds); } } + + @Value + @Accessors(fluent = true) + private static class DefaultEdgeSetRequest implements EdgeSetRequest { + Collection attributeRequests; + Collection metricAggregationRequests; + Collection> filterArguments; + } } diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeSetGroupRequest.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeSetGroupRequest.java index fc7d6bef..b5075fbb 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeSetGroupRequest.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeSetGroupRequest.java @@ -2,22 +2,15 @@ import io.reactivex.rxjava3.core.Single; import java.util.Collection; -import java.util.Set; +import java.util.Map; import org.hypertrace.core.graphql.common.request.AttributeRequest; -import org.hypertrace.graphql.metric.request.MetricAggregationRequest; public interface EdgeSetGroupRequest { - - Set entityTypes(); - - // Includes neighbor id and type - Collection attributeRequests(); - - Collection metricAggregationRequests(); - AttributeRequest neighborIdAttribute(); AttributeRequest neighborTypeAttribute(); Single buildNeighborRequest(String entityType, Collection neighborIds); + + Map edgeSetRequests(); } diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeSetRequest.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeSetRequest.java new file mode 100644 index 00000000..9ca1a375 --- /dev/null +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EdgeSetRequest.java @@ -0,0 +1,17 @@ +package org.hypertrace.graphql.entity.request; + +import java.util.Collection; +import org.hypertrace.core.graphql.common.request.AttributeAssociation; +import org.hypertrace.core.graphql.common.request.AttributeRequest; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; +import org.hypertrace.graphql.metric.request.MetricAggregationRequest; + +public interface EdgeSetRequest { + // list of filter arguments + Collection> filterArguments(); + + // Includes neighbor id and type + Collection attributeRequests(); + + Collection metricAggregationRequests(); +} diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java index 7f25cf51..3562b1e1 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java @@ -2,11 +2,19 @@ import java.util.List; import java.util.Optional; +import org.hypertrace.core.graphql.common.request.ContextualRequest; import org.hypertrace.core.graphql.common.request.ResultSetRequest; +import org.hypertrace.core.graphql.context.GraphQlRequestContext; import org.hypertrace.graphql.metric.request.MetricRequest; import org.hypertrace.graphql.metric.schema.argument.AggregatableOrderArgument; -public interface EntityRequest { +public interface EntityRequest extends ContextualRequest { + + @Override + default GraphQlRequestContext context() { + return resultSetRequest().context(); + } + String entityType(); ResultSetRequest resultSetRequest(); diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequestBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequestBuilder.java index e0e8bd16..411a86b3 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequestBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequestBuilder.java @@ -2,7 +2,9 @@ import graphql.schema.DataFetchingFieldSelectionSet; import io.reactivex.rxjava3.core.Single; +import java.util.List; import java.util.Map; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; import org.hypertrace.core.graphql.context.GraphQlRequestContext; public interface EntityRequestBuilder { @@ -10,4 +12,7 @@ Single build( GraphQlRequestContext context, Map arguments, DataFetchingFieldSelectionSet selectionSet); + + Single rebuildWithAdditionalFilters( + EntityRequest originalRequest, List filterArguments); } diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/schema/Entity.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/schema/Entity.java index cc381887..8d9c8696 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/schema/Entity.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/schema/Entity.java @@ -1,11 +1,16 @@ package org.hypertrace.graphql.entity.schema; +import graphql.annotations.annotationTypes.GraphQLDataFetcher; import graphql.annotations.annotationTypes.GraphQLField; import graphql.annotations.annotationTypes.GraphQLName; import graphql.annotations.annotationTypes.GraphQLNonNull; +import java.util.List; import org.hypertrace.core.graphql.common.schema.attributes.AttributeQueryable; import org.hypertrace.core.graphql.common.schema.id.Identifiable; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; import org.hypertrace.core.graphql.common.schema.type.Typed; +import org.hypertrace.graphql.entity.dao.IncomingEdgesDataFetcher; +import org.hypertrace.graphql.entity.dao.OutgoingEdgesDataFetcher; import org.hypertrace.graphql.entity.schema.argument.NeighborEntityScopeArgument; import org.hypertrace.graphql.entity.schema.argument.NeighborEntityTypeArgument; import org.hypertrace.graphql.label.schema.LabelResultSet; @@ -27,16 +32,20 @@ public interface Entity extends AttributeQueryable, MetricQueryable, Identifiabl @GraphQLField @GraphQLNonNull @GraphQLName(ENTITY_INCOMING_EDGES_KEY) + @GraphQLDataFetcher(IncomingEdgesDataFetcher.class) EdgeResultSet incomingEdges( @GraphQLName(NeighborEntityTypeArgument.ARGUMENT_NAME) EntityType neighborType, - @GraphQLName(NeighborEntityScopeArgument.ARGUMENT_NAME) String neighborScope); + @GraphQLName(NeighborEntityScopeArgument.ARGUMENT_NAME) String neighborScope, + @GraphQLName(FilterArgument.ARGUMENT_NAME) List filterBy); @GraphQLField @GraphQLNonNull @GraphQLName(ENTITY_OUTGOING_EDGES_KEY) + @GraphQLDataFetcher(OutgoingEdgesDataFetcher.class) EdgeResultSet outgoingEdges( @GraphQLName(NeighborEntityTypeArgument.ARGUMENT_NAME) EntityType neighborType, - @GraphQLName(NeighborEntityScopeArgument.ARGUMENT_NAME) String neighborScope); + @GraphQLName(NeighborEntityScopeArgument.ARGUMENT_NAME) String neighborScope, + @GraphQLName(FilterArgument.ARGUMENT_NAME) List filterBy); @GraphQLField @GraphQLNonNull diff --git a/hypertrace-graphql-entity-schema/src/test/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilderTest.java b/hypertrace-graphql-entity-schema/src/test/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilderTest.java index 9c359a7b..e5dcadeb 100644 --- a/hypertrace-graphql-entity-schema/src/test/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilderTest.java +++ b/hypertrace-graphql-entity-schema/src/test/java/org/hypertrace/graphql/entity/joiner/DefaultEntityJoinerBuilderTest.java @@ -342,12 +342,14 @@ public Object attribute(AttributeExpression attributeExpression) { } @Override - public EdgeResultSet incomingEdges(EntityType neighborType, String neighborScope) { + public EdgeResultSet incomingEdges( + EntityType neighborType, String neighborScope, List filterBy) { return null; } @Override - public EdgeResultSet outgoingEdges(EntityType neighborType, String neighborScope) { + public EdgeResultSet outgoingEdges( + EntityType neighborType, String neighborScope, List filterBy) { return null; } diff --git a/hypertrace-graphql-entity-type/build.gradle.kts b/hypertrace-graphql-entity-type/build.gradle.kts index 26b87e7b..cf576a61 100644 --- a/hypertrace-graphql-entity-type/build.gradle.kts +++ b/hypertrace-graphql-entity-type/build.gradle.kts @@ -3,14 +3,14 @@ plugins { } dependencies { - api("com.google.inject:guice") - api("io.reactivex.rxjava3:rxjava") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-store") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-common-schema") - implementation("org.hypertrace.entity.service:entity-type-service-rx-client") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-grpc-utils") - implementation(project(":hypertrace-graphql-entity-schema")) - implementation(project(":hypertrace-graphql-service-config")) + api(commonLibs.guice) + api(commonLibs.rxjava3) + implementation(localLibs.core.attribute.store) + implementation(localLibs.core.schema.common) + implementation(commonLibs.hypertrace.entityservice.types.rxclient) + implementation(localLibs.core.grpc) + implementation(projects.hypertraceGraphqlEntitySchema) + implementation(projects.hypertraceGraphqlServiceConfig) - compileOnly(project(":hypertrace-graphql-attribute-scope")) + compileOnly(projects.hypertraceGraphqlAttributeScope) } diff --git a/hypertrace-graphql-entity-type/gradle.lockfile b/hypertrace-graphql-entity-type/gradle.lockfile new file mode 100644 index 00000000..98424289 --- /dev/null +++ b/hypertrace-graphql-entity-type/gradle.lockfile @@ -0,0 +1,64 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +aopalliance:aopalliance:1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.auth0:java-jwt:4.4.0=runtimeClasspath,testRuntimeClasspath +com.auth0:jwks-rsa:0.22.0=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.android:annotations:4.1.1.4=runtimeClasspath,testRuntimeClasspath +com.google.api.grpc:proto-google-common-protos:2.22.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.findbugs:jsr305:3.0.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.10.1=runtimeClasspath,testRuntimeClasspath +com.google.errorprone:error_prone_annotations:2.20.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:failureaccess:1.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava-parent:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.inject:guice:6.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.j2objc:j2objc-annotations:2.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java-util:3.24.1=runtimeClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java:3.24.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-kickstart:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-servlet:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java-extended-scalars:17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java:19.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:java-dataloader:3.2.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.github.graphql-java:graphql-java-annotations:9.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-api:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-bom:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-context:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-core:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-inprocess:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf-lite:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-stub:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-util:1.60.0=runtimeClasspath,testRuntimeClasspath +io.netty:netty-bom:4.1.108.Final=runtimeClasspath,testRuntimeClasspath +io.perfmark:perfmark-api:0.26.0=runtimeClasspath,testRuntimeClasspath +io.reactivex.rxjava3:rxjava:3.1.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:4.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.websocket:javax.websocket-api:1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.23=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:attribute-service-api:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:caching-attribute-service-client:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.entity.service:entity-service-api:0.8.86=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.entity.service:entity-type-service-rx-client:0.8.86=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.gateway.service:gateway-service-api:0.3.9=runtimeClasspath,testRuntimeClasspath +org.reactivestreams:reactive-streams:1.0.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty=annotationProcessor diff --git a/hypertrace-graphql-explorer-context/build.gradle.kts b/hypertrace-graphql-explorer-context/build.gradle.kts index f401408d..7f55c39c 100644 --- a/hypertrace-graphql-explorer-context/build.gradle.kts +++ b/hypertrace-graphql-explorer-context/build.gradle.kts @@ -3,11 +3,11 @@ plugins { } dependencies { - api("com.google.inject:guice") - api("io.reactivex.rxjava3:rxjava") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-store") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-common-schema") - implementation(project(":hypertrace-graphql-explorer-schema")) + api(commonLibs.guice) + api(commonLibs.rxjava3) + implementation(localLibs.core.attribute.store) + implementation(localLibs.core.schema.common) + implementation(projects.hypertraceGraphqlExplorerSchema) - compileOnly(project(":hypertrace-graphql-attribute-scope")) + compileOnly(projects.hypertraceGraphqlAttributeScope) } diff --git a/hypertrace-graphql-explorer-context/gradle.lockfile b/hypertrace-graphql-explorer-context/gradle.lockfile new file mode 100644 index 00000000..1066ed5d --- /dev/null +++ b/hypertrace-graphql-explorer-context/gradle.lockfile @@ -0,0 +1,63 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +aopalliance:aopalliance:1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.auth0:java-jwt:4.4.0=runtimeClasspath,testRuntimeClasspath +com.auth0:jwks-rsa:0.22.0=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.android:annotations:4.1.1.4=runtimeClasspath,testRuntimeClasspath +com.google.api.grpc:proto-google-common-protos:2.22.0=runtimeClasspath,testRuntimeClasspath +com.google.code.findbugs:jsr305:3.0.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.10.1=runtimeClasspath,testRuntimeClasspath +com.google.errorprone:error_prone_annotations:2.18.0=compileClasspath,testCompileClasspath +com.google.errorprone:error_prone_annotations:2.20.0=runtimeClasspath,testRuntimeClasspath +com.google.guava:failureaccess:1.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava-parent:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.inject:guice:6.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.j2objc:j2objc-annotations:2.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java-util:3.24.1=runtimeClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java:3.24.1=runtimeClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-kickstart:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-servlet:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java-extended-scalars:17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java:19.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:java-dataloader:3.2.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.github.graphql-java:graphql-java-annotations:9.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-api:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-bom:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-context:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-core:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-inprocess:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf-lite:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-stub:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-util:1.60.0=runtimeClasspath,testRuntimeClasspath +io.netty:netty-bom:4.1.108.Final=runtimeClasspath,testRuntimeClasspath +io.perfmark:perfmark-api:0.26.0=runtimeClasspath,testRuntimeClasspath +io.reactivex.rxjava3:rxjava:3.1.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.annotation:javax.annotation-api:1.3.2=runtimeClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:4.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.websocket:javax.websocket-api:1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.23=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:attribute-service-api:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:caching-attribute-service-client:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.gateway.service:gateway-service-api:0.3.9=runtimeClasspath,testRuntimeClasspath +org.reactivestreams:reactive-streams:1.0.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty=annotationProcessor diff --git a/hypertrace-graphql-explorer-schema/build.gradle.kts b/hypertrace-graphql-explorer-schema/build.gradle.kts index de71e57a..ae1d26ac 100644 --- a/hypertrace-graphql-explorer-schema/build.gradle.kts +++ b/hypertrace-graphql-explorer-schema/build.gradle.kts @@ -1,36 +1,36 @@ plugins { `java-library` jacoco - id("org.hypertrace.jacoco-report-plugin") + alias(commonLibs.plugins.hypertrace.jacoco) } dependencies { - api("com.google.inject:guice") - api("com.graphql-java:graphql-java") - api("org.hypertrace.core.graphql:hypertrace-core-graphql-spi") - api("io.github.graphql-java:graphql-java-annotations") - api(project(":hypertrace-graphql-metric-schema")) + api(commonLibs.guice) + api(commonLibs.graphql.java) + api(localLibs.core.spi) + api(localLibs.graphql.annotations) + api(projects.hypertraceGraphqlMetricSchema) - annotationProcessor("org.projectlombok:lombok") - compileOnly("org.projectlombok:lombok") + annotationProcessor(commonLibs.lombok) + compileOnly(commonLibs.lombok) - implementation("org.slf4j:slf4j-api") - implementation("io.reactivex.rxjava3:rxjava") - implementation("org.hypertrace.gateway.service:gateway-service-api") - implementation("com.google.protobuf:protobuf-java-util") + implementation(commonLibs.slf4j2.api) + implementation(commonLibs.rxjava3) + implementation(commonLibs.hypertrace.gatewayservice.api) + implementation(commonLibs.protobuf.javautil) - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-context") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-grpc-utils") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-common-schema") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-store") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-deserialization") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-schema-utils") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-rx-utils") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-request-transformation") + implementation(localLibs.core.context) + implementation(localLibs.core.grpc) + implementation(localLibs.core.schema.common) + implementation(localLibs.core.attribute.store) + implementation(localLibs.core.deserialization) + implementation(localLibs.core.schema.utils) + implementation(localLibs.core.rxutils) + implementation(localLibs.core.request.transformation) - testImplementation("org.junit.jupiter:junit-jupiter") - testImplementation("org.mockito:mockito-core") - testImplementation("org.mockito:mockito-junit-jupiter") + testImplementation(commonLibs.junit.jupiter) + testImplementation(commonLibs.mockito.core) + testImplementation(commonLibs.mockito.junit) } tasks.test { diff --git a/hypertrace-graphql-explorer-schema/gradle.lockfile b/hypertrace-graphql-explorer-schema/gradle.lockfile new file mode 100644 index 00000000..c943760c --- /dev/null +++ b/hypertrace-graphql-explorer-schema/gradle.lockfile @@ -0,0 +1,83 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +aopalliance:aopalliance:1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.auth0:java-jwt:4.4.0=runtimeClasspath,testRuntimeClasspath +com.auth0:jwks-rsa:0.22.0=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.android:annotations:4.1.1.4=runtimeClasspath,testRuntimeClasspath +com.google.api.grpc:proto-google-common-protos:2.22.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.findbugs:jsr305:3.0.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.10.1=runtimeClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.8.9=compileClasspath,testCompileClasspath +com.google.errorprone:error_prone_annotations:2.20.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:failureaccess:1.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava-parent:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.inject:guice:6.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.j2objc:j2objc-annotations:2.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java-util:3.24.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java:3.24.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-kickstart:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-servlet:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java-extended-scalars:17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java:19.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:java-dataloader:3.2.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.github.graphql-java:graphql-java-annotations:9.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-api:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-bom:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-context:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-core:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-inprocess:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf-lite:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-stub:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-util:1.60.0=runtimeClasspath,testRuntimeClasspath +io.netty:netty-bom:4.1.108.Final=runtimeClasspath,testRuntimeClasspath +io.perfmark:perfmark-api:0.26.0=runtimeClasspath,testRuntimeClasspath +io.reactivex.rxjava3:rxjava:3.1.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:4.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.websocket:javax.websocket-api:1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy-agent:1.14.10=testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.14.10=testCompileClasspath,testRuntimeClasspath +org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath +org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.23=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:attribute-service-api:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:caching-attribute-service-client:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.gateway.service:gateway-service-api:0.3.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-api:5.10.0=testCompileClasspath +org.junit.jupiter:junit-jupiter-api:5.10.1=testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:5.10.1=testRuntimeClasspath +org.junit.jupiter:junit-jupiter-params:5.10.0=testCompileClasspath +org.junit.jupiter:junit-jupiter-params:5.10.1=testRuntimeClasspath +org.junit.jupiter:junit-jupiter:5.10.0=testCompileClasspath +org.junit.jupiter:junit-jupiter:5.10.1=testRuntimeClasspath +org.junit.platform:junit-platform-commons:1.10.0=testCompileClasspath +org.junit.platform:junit-platform-commons:1.10.1=testRuntimeClasspath +org.junit.platform:junit-platform-engine:1.10.1=testRuntimeClasspath +org.junit:junit-bom:5.10.0=testCompileClasspath +org.junit:junit-bom:5.10.1=testRuntimeClasspath +org.mockito:mockito-core:5.8.0=testCompileClasspath,testRuntimeClasspath +org.mockito:mockito-junit-jupiter:5.8.0=testCompileClasspath,testRuntimeClasspath +org.objenesis:objenesis:3.3=testRuntimeClasspath +org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath +org.projectlombok:lombok:1.18.30=annotationProcessor,compileClasspath +org.reactivestreams:reactive-streams:1.0.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty= diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/dao/GatewayServiceExploreRequestBuilder.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/dao/GatewayServiceExploreRequestBuilder.java index 7b6d200a..6d49643a 100644 --- a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/dao/GatewayServiceExploreRequestBuilder.java +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/dao/GatewayServiceExploreRequestBuilder.java @@ -21,7 +21,11 @@ import org.hypertrace.gateway.service.v1.common.Expression; import org.hypertrace.gateway.service.v1.common.Filter; import org.hypertrace.gateway.service.v1.common.TimeAggregation; +import org.hypertrace.gateway.service.v1.explore.ContextOption; +import org.hypertrace.gateway.service.v1.explore.EntityOption; +import org.hypertrace.gateway.service.v1.explore.ExploreRequest.Builder; import org.hypertrace.graphql.explorer.request.ExploreRequest; +import org.hypertrace.graphql.explorer.schema.argument.EntityContextOptions; import org.hypertrace.graphql.explorer.schema.argument.IntervalArgument; import org.hypertrace.graphql.metric.request.MetricAggregationRequest; import org.hypertrace.graphql.metric.request.MetricSeriesRequest; @@ -58,23 +62,33 @@ Single buildRequest( this.filterConverter.convert(request.filterArguments()), this.buildAnyAggregations(request), this.buildAnyTimeAggregations(request), - (attributes, orderBys, groupBys, filter, aggregations, series) -> - org.hypertrace.gateway.service.v1.explore.ExploreRequest.newBuilder() - .setContext(request.scope()) - .setStartTimeMillis(request.timeRange().startTime().toEpochMilli()) - .setEndTimeMillis(request.timeRange().endTime().toEpochMilli()) - .addAllSelection(attributes) - .addAllSelection(aggregations) - .addAllTimeAggregation(series) - .addAllOrderBy(orderBys) - .addAllGroupBy(groupBys) - .setLimit(request.limit()) - .setIncludeRestGroup(request.includeRest()) - .setOffset(request.offset()) - .setFilter(filter) - .setSpaceId(request.spaceId().orElse("")) // String proto default value - .setGroupLimit(request.groupLimit().orElse(0)) // Int proto default value - .build()); + this.buildContextOptions(request), + (attributes, orderBys, groupBys, filter, aggregations, series, contextOptions) -> { + Builder builder = + org.hypertrace.gateway.service.v1.explore.ExploreRequest.newBuilder() + .setContext(request.scope()) + .addAllSelection(attributes) + .addAllSelection(aggregations) + .addAllTimeAggregation(series) + .addAllOrderBy(orderBys) + .addAllGroupBy(groupBys) + .setLimit(request.limit()) + .setIncludeRestGroup(request.includeRest()) + .setOffset(request.offset()) + .setFilter(filter) + .setSpaceId(request.spaceId().orElse("")) // String proto default value + .setGroupLimit(request.groupLimit().orElse(0)) // Int proto default value + .setContextOption(contextOptions); + request + .timeRange() + .ifPresent( + timeRangeArgument -> { + builder.setStartTimeMillis(timeRangeArgument.startTime().toEpochMilli()); + builder.setEndTimeMillis(timeRangeArgument.endTime().toEpochMilli()); + }); + + return builder.build(); + }); } private Single> buildAnyAggregations(ExploreRequest exploreRequest) { @@ -100,6 +114,20 @@ private Single> buildAnyTimeAggregations(ExploreRequest exp .flatMap(this.seriesConverter::convert); } + private Single buildContextOptions(ExploreRequest exploreRequest) { + if (exploreRequest.entityContextOptions().isEmpty()) { + return Single.just(ContextOption.newBuilder().build()); + } + EntityContextOptions entityContextOptions = exploreRequest.entityContextOptions().get(); + return Single.just( + ContextOption.newBuilder() + .setEntityOption( + EntityOption.newBuilder() + .setIncludeNonLiveEntities(entityContextOptions.includeNonLiveEntities()) + .build()) + .build()); + } + @Value @Accessors(fluent = true) private static class ExplorerMetricSeriesRequest implements MetricSeriesRequest { diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/deserialization/EntityContextOptionsDeserializationConfig.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/deserialization/EntityContextOptionsDeserializationConfig.java new file mode 100644 index 00000000..e1b1bbaa --- /dev/null +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/deserialization/EntityContextOptionsDeserializationConfig.java @@ -0,0 +1,43 @@ +package org.hypertrace.graphql.explorer.deserialization; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.Module; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.util.List; +import lombok.NoArgsConstructor; +import lombok.Value; +import lombok.experimental.Accessors; +import org.hypertrace.core.graphql.deserialization.ArgumentDeserializationConfig; +import org.hypertrace.graphql.explorer.schema.argument.EntityContextOptions; + +public class EntityContextOptionsDeserializationConfig implements ArgumentDeserializationConfig { + + @Override + public String getArgumentKey() { + return EntityContextOptions.ARGUMENT_NAME; + } + + @Override + public Class getArgumentSchema() { + return EntityContextOptions.class; + } + + @Override + public List jacksonModules() { + return List.of( + new SimpleModule() + .addAbstractTypeMapping( + EntityContextOptions.class, + EntityContextOptionsDeserializationConfig.DefaultEntityContextOptionsArgument + .class)); + } + + @Value + @Accessors(fluent = true) + @NoArgsConstructor(force = true) + private static class DefaultEntityContextOptionsArgument implements EntityContextOptions { + + @JsonProperty(EntityContextOptions.INCLUDE_NON_LIVE_ENTITIES) + boolean includeNonLiveEntities; + } +} diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/deserialization/ExplorerDeserializationModule.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/deserialization/ExplorerDeserializationModule.java index 49342aeb..acfd3622 100644 --- a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/deserialization/ExplorerDeserializationModule.java +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/deserialization/ExplorerDeserializationModule.java @@ -56,5 +56,8 @@ protected void configure() { deserializationConfigMultibinder.addBinding().to(GroupByArgumentDeserializationConfig.class); deserializationConfigMultibinder.addBinding().to(IntervalArgumentDeserializationConfig.class); + deserializationConfigMultibinder + .addBinding() + .to(EntityContextOptionsDeserializationConfig.class); } } diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/fetcher/ExplorerFetcher.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/fetcher/ExplorerFetcher.java index a32e3190..5e473f44 100644 --- a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/fetcher/ExplorerFetcher.java +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/fetcher/ExplorerFetcher.java @@ -1,5 +1,7 @@ package org.hypertrace.graphql.explorer.fetcher; +import static org.hypertrace.core.graphql.context.GraphQlRequestContext.contextFromEnvironment; + import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import java.util.concurrent.CompletableFuture; @@ -31,7 +33,9 @@ static final class ExplorerFetcherImpl public CompletableFuture get(DataFetchingEnvironment environment) { return this.requestBuilder .build( - environment.getContext(), environment.getArguments(), environment.getSelectionSet()) + contextFromEnvironment(environment), + environment.getArguments(), + environment.getSelectionSet()) .flatMap(this.explorerDao::explore) .toCompletionStage() .toCompletableFuture(); diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/DefaultExploreRequestBuilder.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/DefaultExploreRequestBuilder.java index 0d51aa71..2e870635 100644 --- a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/DefaultExploreRequestBuilder.java +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/DefaultExploreRequestBuilder.java @@ -6,6 +6,7 @@ import graphql.schema.DataFetchingFieldSelectionSet; import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.Single; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; @@ -28,6 +29,7 @@ import org.hypertrace.core.graphql.common.utils.attributes.AttributeScopeStringTranslator; import org.hypertrace.core.graphql.context.GraphQlRequestContext; import org.hypertrace.core.graphql.deserialization.ArgumentDeserializer; +import org.hypertrace.graphql.explorer.schema.argument.EntityContextOptions; import org.hypertrace.graphql.explorer.schema.argument.ExplorerContext; import org.hypertrace.graphql.explorer.schema.argument.ExplorerContextArgument; import org.hypertrace.graphql.explorer.schema.argument.ExplorerScopeArgument; @@ -80,15 +82,6 @@ public Single build( .map(this.scopeStringTranslator::fromExternal) .orElseThrow(); - return this.build(requestContext, explorerScope, arguments, selectionSet); - } - - private Single build( - GraphQlRequestContext requestContext, - String explorerScope, - Map arguments, - DataFetchingFieldSelectionSet selectionSet) { - int limit = this.argumentDeserializer .deserializePrimitive(arguments, LimitArgument.class) @@ -99,10 +92,8 @@ private Single build( .deserializePrimitive(arguments, OffsetArgument.class) .orElse(DEFAULT_OFFSET); - TimeRangeArgument timeRange = - this.argumentDeserializer - .deserializeObject(arguments, TimeRangeArgument.class) - .orElseThrow(); + Optional timeRange = + this.argumentDeserializer.deserializeObject(arguments, TimeRangeArgument.class); List requestedOrders = this.argumentDeserializer @@ -120,12 +111,12 @@ private Single build( Optional spaceId = this.argumentDeserializer.deserializePrimitive(arguments, SpaceArgument.class); - Set groupByExpressions = - groupBy.map(this::resolveGroupByExpressions).orElseGet(Collections::emptySet); - Optional intervalArgument = this.argumentDeserializer.deserializeObject(arguments, IntervalArgument.class); + Optional entityContextOptions = + this.argumentDeserializer.deserializeObject(arguments, EntityContextOptions.class); + Single> attributeSelections = this.selectionRequestBuilder.getAttributeSelections( requestContext, explorerScope, selectionSet); @@ -134,6 +125,41 @@ private Single build( this.selectionRequestBuilder.getAggregationSelections( requestContext, explorerScope, selectionSet); + return build( + requestContext, + explorerScope, + timeRange, + spaceId, + limit, + offset, + requestedFilters, + requestedOrders, + groupBy, + intervalArgument, + entityContextOptions, + attributeSelections, + aggregationSelections); + } + + @Override + public Single build( + GraphQlRequestContext requestContext, + String explorerScope, + Optional timeRange, + Optional spaceId, + int limit, + int offset, + List requestedFilters, + List requestedOrders, + Optional groupBy, + Optional intervalArgument, + Optional entityContextOptions, + Single> attributeSelections, + Single> aggregationSelections) { + + Set groupByExpressions = + groupBy.map(this::resolveGroupByExpressions).orElseGet(Collections::emptySet); + Single> orderArguments = this.exploreOrderArgumentBuilder.buildList(requestContext, explorerScope, requestedOrders); @@ -151,19 +177,60 @@ private Single build( requestContext, explorerScope, timeRange, - limit, - offset, + limit > 0 ? limit : DEFAULT_LIMIT, + offset >= 0 ? offset : DEFAULT_OFFSET, attributes, aggregations, orders, filters, groupByAttribute, intervalArgument, + entityContextOptions, groupBy.map(GroupByArgument::includeRest).orElse(false), spaceId, groupBy.map(GroupByArgument::groupLimit))); } + @Override + public Single rebuildWithAdditionalFilters( + ExploreRequest originalRequest, List additionalFilterArguments) { + return this.mergeFilterLists( + originalRequest.context(), + originalRequest.scope(), + originalRequest.filterArguments(), + additionalFilterArguments) + .map( + newFilterArguments -> + new DefaultExploreRequest( + originalRequest.context(), + originalRequest.scope(), + originalRequest.timeRange(), + originalRequest.limit(), + originalRequest.offset(), + originalRequest.attributeRequests(), + originalRequest.aggregationRequests(), + originalRequest.orderArguments(), + newFilterArguments, + originalRequest.groupByAttributeRequests(), + originalRequest.timeInterval(), + originalRequest.entityContextOptions(), + originalRequest.includeRest(), + originalRequest.spaceId(), + originalRequest.groupLimit())); + } + + private Single>> mergeFilterLists( + GraphQlRequestContext requestContext, + String scope, + Collection> original, + Collection additional) { + return this.filterRequestBuilder + .build(requestContext, scope, additional) + .flattenAsObservable(list -> list) + .concatWith(Observable.fromIterable(original)) + .toList(); + } + private Single> buildGroupByAttributes( GraphQlRequestContext context, String explorerScope, @@ -193,7 +260,7 @@ private Set resolveGroupByExpressions(GroupByArgument group private static class DefaultExploreRequest implements ExploreRequest { GraphQlRequestContext context; String scope; - TimeRangeArgument timeRange; + Optional timeRange; int limit; int offset; Set attributeRequests; @@ -202,6 +269,7 @@ private static class DefaultExploreRequest implements ExploreRequest { List> filterArguments; Set groupByAttributeRequests; Optional timeInterval; + Optional entityContextOptions; boolean includeRest; Optional spaceId; Optional groupLimit; diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreRequest.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreRequest.java index f523c707..bfbde218 100644 --- a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreRequest.java +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreRequest.java @@ -8,13 +8,14 @@ import org.hypertrace.core.graphql.common.request.ContextualRequest; import org.hypertrace.core.graphql.common.schema.arguments.TimeRangeArgument; import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; +import org.hypertrace.graphql.explorer.schema.argument.EntityContextOptions; import org.hypertrace.graphql.explorer.schema.argument.IntervalArgument; import org.hypertrace.graphql.metric.request.MetricAggregationRequest; public interface ExploreRequest extends ContextualRequest { String scope(); - TimeRangeArgument timeRange(); + Optional timeRange(); int limit(); @@ -37,4 +38,6 @@ public interface ExploreRequest extends ContextualRequest { Optional spaceId(); Optional groupLimit(); + + Optional entityContextOptions(); } diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreRequestBuilder.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreRequestBuilder.java index 558c35f1..46b5ddb9 100644 --- a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreRequestBuilder.java +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreRequestBuilder.java @@ -2,12 +2,41 @@ import graphql.schema.DataFetchingFieldSelectionSet; import io.reactivex.rxjava3.core.Single; +import java.util.List; import java.util.Map; +import java.util.Optional; +import java.util.Set; +import org.hypertrace.core.graphql.common.request.AttributeRequest; +import org.hypertrace.core.graphql.common.schema.arguments.TimeRangeArgument; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; import org.hypertrace.core.graphql.context.GraphQlRequestContext; +import org.hypertrace.graphql.explorer.schema.argument.EntityContextOptions; +import org.hypertrace.graphql.explorer.schema.argument.GroupByArgument; +import org.hypertrace.graphql.explorer.schema.argument.IntervalArgument; +import org.hypertrace.graphql.metric.request.MetricAggregationRequest; +import org.hypertrace.graphql.metric.schema.argument.AggregatableOrderArgument; public interface ExploreRequestBuilder { Single build( GraphQlRequestContext context, Map arguments, DataFetchingFieldSelectionSet selectionSet); + + Single build( + GraphQlRequestContext requestContext, + String explorerScope, + Optional timeRange, + Optional spaceId, + int limit, + int offset, + List requestedFilters, + List requestedOrders, + Optional groupBy, + Optional intervalArgument, + Optional entityContextOptions, + Single> attributeSelections, + Single> aggregationSelections); + + Single rebuildWithAdditionalFilters( + ExploreRequest originalRequest, List filterArguments); } diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreSelectionRequestBuilder.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreSelectionRequestBuilder.java index 48b31b01..93f9dc0c 100644 --- a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreSelectionRequestBuilder.java +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/request/ExploreSelectionRequestBuilder.java @@ -165,6 +165,7 @@ private List getArguments( case PERCENTILE: return MetricArguments.percentileWithSize(size.orElseThrow()); case DISTINCT_COUNT: + case DISTINCT_ARRAY: case COUNT: case AVG: case SUM: diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/schema/ExplorerSchema.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/schema/ExplorerSchema.java index 961c0620..74b21393 100644 --- a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/schema/ExplorerSchema.java +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/schema/ExplorerSchema.java @@ -12,6 +12,7 @@ import org.hypertrace.core.graphql.common.schema.results.arguments.page.OffsetArgument; import org.hypertrace.core.graphql.common.schema.results.arguments.space.SpaceArgument; import org.hypertrace.graphql.explorer.fetcher.ExplorerFetcher; +import org.hypertrace.graphql.explorer.schema.argument.EntityContextOptions; import org.hypertrace.graphql.explorer.schema.argument.ExplorerContext; import org.hypertrace.graphql.explorer.schema.argument.ExplorerContextArgument; import org.hypertrace.graphql.explorer.schema.argument.ExplorerScopeArgument; @@ -30,12 +31,13 @@ public interface ExplorerSchema { ExploreResultSet explore( @Deprecated @GraphQLName(ExplorerContextArgument.ARGUMENT_NAME) ExplorerContext context, @GraphQLName(ExplorerScopeArgument.ARGUMENT_NAME) String scope, - @GraphQLName(TimeRangeArgument.ARGUMENT_NAME) @GraphQLNonNull TimeRangeArgument timeRange, + @GraphQLName(TimeRangeArgument.ARGUMENT_NAME) TimeRangeArgument timeRange, @GraphQLName(SpaceArgument.ARGUMENT_NAME) String space, @GraphQLName(LimitArgument.ARGUMENT_NAME) int limit, @GraphQLName(OffsetArgument.ARGUMENT_NAME) int offset, @GraphQLName(FilterArgument.ARGUMENT_NAME) List filterBy, @GraphQLName(OrderArgument.ARGUMENT_NAME) List orderBy, @GraphQLName(GroupByArgument.ARGUMENT_NAME) GroupByArgument groupBy, - @GraphQLName(IntervalArgument.ARGUMENT_NAME) IntervalArgument interval); + @GraphQLName(IntervalArgument.ARGUMENT_NAME) IntervalArgument interval, + @GraphQLName(EntityContextOptions.ARGUMENT_NAME) EntityContextOptions entityContextOptions); } diff --git a/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/schema/argument/EntityContextOptions.java b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/schema/argument/EntityContextOptions.java new file mode 100644 index 00000000..1abdf9ed --- /dev/null +++ b/hypertrace-graphql-explorer-schema/src/main/java/org/hypertrace/graphql/explorer/schema/argument/EntityContextOptions.java @@ -0,0 +1,17 @@ +package org.hypertrace.graphql.explorer.schema.argument; + +import graphql.annotations.annotationTypes.GraphQLField; +import graphql.annotations.annotationTypes.GraphQLName; +import graphql.annotations.annotationTypes.GraphQLNonNull; + +@GraphQLName(EntityContextOptions.TYPE_NAME) +public interface EntityContextOptions { + String TYPE_NAME = "EntityContextOptions"; + String ARGUMENT_NAME = "entityContextOptions"; + String INCLUDE_NON_LIVE_ENTITIES = "includeNonLiveEntities"; + + @GraphQLField + @GraphQLNonNull + @GraphQLName(INCLUDE_NON_LIVE_ENTITIES) + boolean includeNonLiveEntities(); +} diff --git a/hypertrace-graphql-gateway-service-metric-utils/build.gradle.kts b/hypertrace-graphql-gateway-service-metric-utils/build.gradle.kts index 68be2964..3795d529 100644 --- a/hypertrace-graphql-gateway-service-metric-utils/build.gradle.kts +++ b/hypertrace-graphql-gateway-service-metric-utils/build.gradle.kts @@ -3,14 +3,14 @@ plugins { } dependencies { - api("com.google.inject:guice") - api("org.hypertrace.gateway.service:gateway-service-api") - api("org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-store") - api("io.reactivex.rxjava3:rxjava") - api("org.hypertrace.core.graphql:hypertrace-core-graphql-common-schema") - api(project(":hypertrace-graphql-metric-schema")) - api("org.hypertrace.core.graphql:hypertrace-core-graphql-gateway-service-utils") + api(commonLibs.guice) + api(commonLibs.hypertrace.gatewayservice.api) + api(localLibs.core.attribute.store) + api(commonLibs.rxjava3) + api(localLibs.core.schema.common) + api(projects.hypertraceGraphqlMetricSchema) + api(localLibs.core.gateway.utils) - annotationProcessor("org.projectlombok:lombok") - compileOnly("org.projectlombok:lombok") + annotationProcessor(commonLibs.lombok) + compileOnly(commonLibs.lombok) } diff --git a/hypertrace-graphql-gateway-service-metric-utils/gradle.lockfile b/hypertrace-graphql-gateway-service-metric-utils/gradle.lockfile new file mode 100644 index 00000000..86b74b4f --- /dev/null +++ b/hypertrace-graphql-gateway-service-metric-utils/gradle.lockfile @@ -0,0 +1,62 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +aopalliance:aopalliance:1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.auth0:java-jwt:4.4.0=runtimeClasspath,testRuntimeClasspath +com.auth0:jwks-rsa:0.22.0=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.android:annotations:4.1.1.4=runtimeClasspath,testRuntimeClasspath +com.google.api.grpc:proto-google-common-protos:2.22.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.findbugs:jsr305:3.0.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.10.1=runtimeClasspath,testRuntimeClasspath +com.google.errorprone:error_prone_annotations:2.20.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:failureaccess:1.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava-parent:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.inject:guice:6.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.j2objc:j2objc-annotations:2.8=compileClasspath,testCompileClasspath +com.google.protobuf:protobuf-java:3.24.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-kickstart:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-servlet:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java-extended-scalars:17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java:19.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:java-dataloader:3.2.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.github.graphql-java:graphql-java-annotations:9.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-api:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-bom:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-context:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-core:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-inprocess:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf-lite:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-stub:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-util:1.60.0=runtimeClasspath,testRuntimeClasspath +io.netty:netty-bom:4.1.108.Final=runtimeClasspath,testRuntimeClasspath +io.perfmark:perfmark-api:0.26.0=runtimeClasspath,testRuntimeClasspath +io.reactivex.rxjava3:rxjava:3.1.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:4.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.websocket:javax.websocket-api:1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.23=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:attribute-service-api:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:caching-attribute-service-client:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.gateway.service:gateway-service-api:0.3.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.projectlombok:lombok:1.18.30=annotationProcessor,compileClasspath +org.reactivestreams:reactive-streams:1.0.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty= diff --git a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/AggregatableOrderByExpressionListConverter.java b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/AggregatableOrderByExpressionListConverter.java index 5790c6a7..6e3089c9 100644 --- a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/AggregatableOrderByExpressionListConverter.java +++ b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/AggregatableOrderByExpressionListConverter.java @@ -5,8 +5,8 @@ import io.reactivex.rxjava3.core.Maybe; import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.Single; +import java.util.Collections; import java.util.List; -import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; import javax.inject.Inject; @@ -19,6 +19,7 @@ import org.hypertrace.gateway.service.v1.common.Expression; import org.hypertrace.gateway.service.v1.common.OrderByExpression; import org.hypertrace.gateway.service.v1.common.SortOrder; +import org.hypertrace.graphql.metric.request.MetricAggregationRequestBuilder; import org.hypertrace.graphql.metric.schema.argument.AggregatableOrderArgument; class AggregatableOrderByExpressionListConverter @@ -31,6 +32,7 @@ class AggregatableOrderByExpressionListConverter private final Converter sortOrderConverter; private final Converter aggregationTypeConverter; + private final MetricAggregationRequestBuilder metricAggregationRequestBuilder; @Inject AggregatableOrderByExpressionListConverter( @@ -38,11 +40,13 @@ class AggregatableOrderByExpressionListConverter MetricAggregationExpressionConverter metricAggregationExpressionConverter, Converter sortOrderConverter, Converter - aggregationTypeConverter) { + aggregationTypeConverter, + MetricAggregationRequestBuilder metricAggregationRequestBuilder) { this.columnExpressionConverter = columnExpressionConverter; this.metricAggregationExpressionConverter = metricAggregationExpressionConverter; this.sortOrderConverter = sortOrderConverter; this.aggregationTypeConverter = aggregationTypeConverter; + this.metricAggregationRequestBuilder = metricAggregationRequestBuilder; } @Override @@ -66,17 +70,20 @@ private Single buildSelectionExpression( AttributeAssociation orderArgument) { AttributeAssociation attributeExpressionAssociation = this.buildAttributeExpressionAssociation(orderArgument); + List aggregationArguments = + Optional.ofNullable(orderArgument.value().size()) + .map(List::of) + .orElseGet(Collections::emptyList); return Maybe.fromOptional(Optional.ofNullable(orderArgument.value().aggregation())) .flatMapSingle(this.aggregationTypeConverter::convert) - .flatMapSingle( + .map( aggregationType -> - orderArgument.value().size() == null - ? this.metricAggregationExpressionConverter.convertForNoArgsOrAlias( - attributeExpressionAssociation, aggregationType) - : this.metricAggregationExpressionConverter.convertForArgsButNoAlias( - attributeExpressionAssociation, - aggregationType, - List.of(Objects.requireNonNull(orderArgument.value().size())))) + this.metricAggregationRequestBuilder.build( + attributeExpressionAssociation, aggregationType, aggregationArguments)) + .flatMapSingle( + aggregationRequest -> + this.metricAggregationExpressionConverter.convert( + aggregationRequest, aggregationRequest.alias())) .switchIfEmpty(this.columnExpressionConverter.convert(attributeExpressionAssociation)); } diff --git a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/BaselinedConvertedAggregationContainer.java b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/BaselinedConvertedAggregationContainer.java index 129d09ba..8c07828c 100644 --- a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/BaselinedConvertedAggregationContainer.java +++ b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/BaselinedConvertedAggregationContainer.java @@ -58,4 +58,9 @@ public BaselinedMetricAggregation percentile(int size) { public @GraphQLNonNull BaselinedMetricAggregation distinctcount() { return this.metricAggregationMap.get(MetricLookupMapKey.basicAggregation(DISTINCT_COUNT)); } + + @Override + public @GraphQLNonNull BaselinedMetricAggregation distinctarray() { + return this.metricAggregationMap.get(MetricLookupMapKey.basicAggregation(DISTINCT_ARRAY)); + } } diff --git a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/ConvertedAggregationContainer.java b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/ConvertedAggregationContainer.java index 503e8bf2..e37d7b7f 100644 --- a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/ConvertedAggregationContainer.java +++ b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/ConvertedAggregationContainer.java @@ -2,6 +2,7 @@ import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.AVG; import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.COUNT; +import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.DISTINCT_ARRAY; import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.DISTINCT_COUNT; import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.MAX; import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.MIN; @@ -59,4 +60,9 @@ public MetricAggregation percentile(int size) { public @GraphQLNonNull MetricAggregation distinctcount() { return this.metricAggregationMap.get(MetricLookupMapKey.basicAggregation(DISTINCT_COUNT)); } + + @Override + public @GraphQLNonNull MetricAggregation distinctarray() { + return this.metricAggregationMap.get(MetricLookupMapKey.basicAggregation(DISTINCT_ARRAY)); + } } diff --git a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/FunctionTypeConverter.java b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/FunctionTypeConverter.java index 92408ab9..6b09a655 100644 --- a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/FunctionTypeConverter.java +++ b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/FunctionTypeConverter.java @@ -27,6 +27,8 @@ public Single convert(AttributeModelMetricAggregationType aggregat return Single.just(FunctionType.PERCENTILE); case DISTINCT_COUNT: return Single.just(FunctionType.DISTINCTCOUNT); + case DISTINCT_ARRAY: + return Single.just(FunctionType.DISTINCT_ARRAY); default: return Single.error( new UnknownFormatConversionException( diff --git a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/GatewayMetricUtilsModule.java b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/GatewayMetricUtilsModule.java index 09ba04a8..6d1144f5 100644 --- a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/GatewayMetricUtilsModule.java +++ b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/GatewayMetricUtilsModule.java @@ -24,6 +24,7 @@ import org.hypertrace.gateway.service.v1.common.Value; import org.hypertrace.gateway.service.v1.entity.Entity; import org.hypertrace.graphql.metric.request.MetricAggregationRequest; +import org.hypertrace.graphql.metric.request.MetricAggregationRequestBuilder; import org.hypertrace.graphql.metric.request.MetricRequest; import org.hypertrace.graphql.metric.request.MetricSeriesRequest; import org.hypertrace.graphql.metric.schema.BaselinedMetricAggregationContainer; @@ -76,5 +77,6 @@ protected void configure() { Key.get( new TypeLiteral< Converter>() {})); + requireBinding(MetricAggregationRequestBuilder.class); } } diff --git a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/MetricAggregationExpressionConverter.java b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/MetricAggregationExpressionConverter.java index 04828c49..2790e15b 100644 --- a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/MetricAggregationExpressionConverter.java +++ b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/MetricAggregationExpressionConverter.java @@ -2,11 +2,9 @@ import static io.reactivex.rxjava3.core.Single.zip; -import com.google.protobuf.StringValue; import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.Single; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -52,25 +50,6 @@ Single convert(MetricAggregationRequest metricAggregation, String al .map(functionExpression -> Expression.newBuilder().setFunction(functionExpression).build()); } - Single convertForNoArgsOrAlias( - AttributeAssociation attributeExpressionAssociation, - AttributeModelMetricAggregationType aggregationType) { - return convertForArgsButNoAlias( - attributeExpressionAssociation, aggregationType, Collections.emptyList()); - } - - Single convertForArgsButNoAlias( - AttributeAssociation attributeExpressionAssociation, - AttributeModelMetricAggregationType aggregationType, - List arguments) { - return this.buildAggregationFunctionExpression( - attributeExpressionAssociation, - aggregationType, - arguments, - StringValue.getDefaultInstance().getValue()) - .map(functionExpression -> Expression.newBuilder().setFunction(functionExpression).build()); - } - private Single buildAggregationFunctionExpression( AttributeAssociation attributeExpressionAssociation, AttributeModelMetricAggregationType aggregationType, diff --git a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/MetricBaselineConvertedAggregationContainer.java b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/MetricBaselineConvertedAggregationContainer.java index 6772cfae..d874d261 100644 --- a/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/MetricBaselineConvertedAggregationContainer.java +++ b/hypertrace-graphql-gateway-service-metric-utils/src/main/java/org/hypertrace/graphql/utils/metrics/gateway/MetricBaselineConvertedAggregationContainer.java @@ -2,6 +2,7 @@ import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.AVG; import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.COUNT; +import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.DISTINCT_ARRAY; import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.DISTINCT_COUNT; import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.MAX; import static org.hypertrace.core.graphql.attributes.AttributeModelMetricAggregationType.MIN; @@ -63,4 +64,9 @@ public MetricBaselineAggregation percentile(int size) { public @GraphQLNonNull MetricBaselineAggregation distinctcount() { return this.metricAggregationMap.get(MetricLookupMapKey.basicAggregation(DISTINCT_COUNT)); } + + @Override + public @GraphQLNonNull MetricBaselineAggregation distinctarray() { + return this.metricAggregationMap.get(MetricLookupMapKey.basicAggregation(DISTINCT_ARRAY)); + } } diff --git a/hypertrace-graphql-impl/build.gradle.kts b/hypertrace-graphql-impl/build.gradle.kts index 8dc2057b..53ba678f 100644 --- a/hypertrace-graphql-impl/build.gradle.kts +++ b/hypertrace-graphql-impl/build.gradle.kts @@ -1,45 +1,46 @@ plugins { `java-library` jacoco - id("org.hypertrace.jacoco-report-plugin") + alias(commonLibs.plugins.hypertrace.jacoco) } dependencies { - api("org.hypertrace.core.graphql:hypertrace-core-graphql-spi") - api("com.graphql-java-kickstart:graphql-java-servlet") - api(project(":hypertrace-graphql-service-config")) + api(localLibs.core.spi) + api(localLibs.graphql.servlet) + api(projects.hypertraceGraphqlServiceConfig) + api(commonLibs.hypertrace.grpcutils.client) - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-schema-registry") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-context") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-deserialization") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-grpc-utils") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-schema-utils") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-gateway-service-utils") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-rx-utils") - implementation(project(":hypertrace-graphql-attribute-scope")) - implementation(project(":hypertrace-graphql-gateway-service-metric-utils")) - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-attribute-store") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-common-schema") - implementation(project(":hypertrace-graphql-metric-schema")) - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-metadata-schema") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-span-schema") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-log-event-schema") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-trace-schema") - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-request-transformation") - implementation(project(":hypertrace-graphql-entity-schema")) - implementation(project(":hypertrace-graphql-explorer-schema")) - implementation(project(":hypertrace-graphql-explorer-context")) - implementation(project(":hypertrace-graphql-entity-type")) - implementation(project(":hypertrace-graphql-spaces-schema")) - implementation(project(":hypertrace-graphql-labels-schema-impl")) + implementation(localLibs.core.schema.registry) + implementation(localLibs.core.context) + implementation(localLibs.core.deserialization) + implementation(localLibs.core.grpc) + implementation(localLibs.core.schema.utils) + implementation(localLibs.core.gateway.utils) + implementation(localLibs.core.rxutils) + implementation(projects.hypertraceGraphqlAttributeScope) + implementation(projects.hypertraceGraphqlGatewayServiceMetricUtils) + implementation(localLibs.core.attribute.store) + implementation(localLibs.core.schema.common) + implementation(projects.hypertraceGraphqlMetricSchema) + implementation(localLibs.core.schema.metadata) + implementation(localLibs.core.schema.spans) + implementation(localLibs.core.schema.logevents) + implementation(localLibs.core.schema.traces) + implementation(localLibs.core.request.transformation) + implementation(projects.hypertraceGraphqlEntitySchema) + implementation(projects.hypertraceGraphqlExplorerSchema) + implementation(projects.hypertraceGraphqlExplorerContext) + implementation(projects.hypertraceGraphqlEntityType) + implementation(projects.hypertraceGraphqlSpacesSchema) + implementation(projects.hypertraceGraphqlLabelsSchemaImpl) + implementation(projects.hypertraceGraphqlSpanProcessingSchema) - implementation("org.slf4j:slf4j-api") - implementation("com.google.inject:guice") - runtimeOnly("io.grpc:grpc-netty") + implementation(commonLibs.slf4j2.api) + implementation(commonLibs.guice) - testImplementation("org.junit.jupiter:junit-jupiter") - testImplementation("org.mockito:mockito-core") - testImplementation("org.mockito:mockito-junit-jupiter") + testImplementation(commonLibs.junit.jupiter) + testImplementation(commonLibs.mockito.core) + testImplementation(commonLibs.mockito.junit) } tasks.test { diff --git a/hypertrace-graphql-impl/gradle.lockfile b/hypertrace-graphql-impl/gradle.lockfile new file mode 100644 index 00000000..894010e3 --- /dev/null +++ b/hypertrace-graphql-impl/gradle.lockfile @@ -0,0 +1,90 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +aopalliance:aopalliance:1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.auth0:java-jwt:4.4.0=runtimeClasspath,testRuntimeClasspath +com.auth0:jwks-rsa:0.22.0=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.android:annotations:4.1.1.4=runtimeClasspath,testRuntimeClasspath +com.google.api.grpc:proto-google-common-protos:2.22.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.findbugs:jsr305:3.0.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.10.1=runtimeClasspath,testRuntimeClasspath +com.google.errorprone:error_prone_annotations:2.20.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:failureaccess:1.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava-parent:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.inject:guice:6.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.j2objc:j2objc-annotations:2.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java-util:3.24.1=runtimeClasspath,testRuntimeClasspath +com.google.protobuf:protobuf-java:3.24.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-kickstart:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-servlet:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java-extended-scalars:17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java:19.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:java-dataloader:3.2.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.github.graphql-java:graphql-java-annotations:9.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-api:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-bom:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-context:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-core:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-inprocess:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf-lite:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-stub:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-util:1.60.0=runtimeClasspath,testRuntimeClasspath +io.netty:netty-bom:4.1.108.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.opentelemetry:opentelemetry-proto:1.1.0-alpha=runtimeClasspath,testRuntimeClasspath +io.perfmark:perfmark-api:0.26.0=runtimeClasspath,testRuntimeClasspath +io.reactivex.rxjava3:rxjava:3.1.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.annotation:javax.annotation-api:1.3.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:4.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.websocket:javax.websocket-api:1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy-agent:1.14.10=testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.14.10=testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.12.0=runtimeClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.10.0=runtimeClasspath,testRuntimeClasspath +org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath +org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.23=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.config.service:label-application-rule-config-service-api:0.1.62=runtimeClasspath,testRuntimeClasspath +org.hypertrace.config.service:labels-config-service-api:0.1.62=runtimeClasspath,testRuntimeClasspath +org.hypertrace.config.service:spaces-config-service-api:0.1.62=runtimeClasspath,testRuntimeClasspath +org.hypertrace.config.service:span-processing-config-service-api:0.1.62=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:attribute-service-api:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:caching-attribute-service-client:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-utils:0.13.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.entity.service:entity-service-api:0.8.86=runtimeClasspath,testRuntimeClasspath +org.hypertrace.entity.service:entity-type-service-rx-client:0.8.86=runtimeClasspath,testRuntimeClasspath +org.hypertrace.gateway.service:gateway-service-api:0.3.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-api:5.10.0=testCompileClasspath +org.junit.jupiter:junit-jupiter-api:5.10.1=testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:5.10.1=testRuntimeClasspath +org.junit.jupiter:junit-jupiter-params:5.10.0=testCompileClasspath +org.junit.jupiter:junit-jupiter-params:5.10.1=testRuntimeClasspath +org.junit.jupiter:junit-jupiter:5.10.0=testCompileClasspath +org.junit.jupiter:junit-jupiter:5.10.1=testRuntimeClasspath +org.junit.platform:junit-platform-commons:1.10.0=testCompileClasspath +org.junit.platform:junit-platform-commons:1.10.1=testRuntimeClasspath +org.junit.platform:junit-platform-engine:1.10.1=testRuntimeClasspath +org.junit:junit-bom:5.10.0=testCompileClasspath +org.junit:junit-bom:5.10.1=testRuntimeClasspath +org.mockito:mockito-core:5.8.0=testCompileClasspath,testRuntimeClasspath +org.mockito:mockito-junit-jupiter:5.8.0=testCompileClasspath,testRuntimeClasspath +org.objenesis:objenesis:3.3=testRuntimeClasspath +org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath +org.reactivestreams:reactive-streams:1.0.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty=annotationProcessor diff --git a/hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlFactory.java b/hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlFactory.java index 8ffe0909..c0c0aec2 100644 --- a/hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlFactory.java +++ b/hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlFactory.java @@ -5,17 +5,25 @@ import graphql.kickstart.servlet.GraphQLConfiguration; import graphql.schema.GraphQLSchema; import org.hypertrace.core.graphql.context.GraphQlRequestContextBuilder; +import org.hypertrace.core.graphql.spi.config.GraphQlEndpointConfig; import org.hypertrace.core.graphql.spi.lifecycle.GraphQlServiceLifecycle; +import org.hypertrace.core.grpcutils.client.GrpcChannelRegistry; import org.hypertrace.graphql.config.HypertraceGraphQlServiceConfig; public class GraphQlFactory { public static GraphQLConfiguration build( - HypertraceGraphQlServiceConfig config, GraphQlServiceLifecycle serviceLifecycle) { - final Injector injector = Guice.createInjector(new GraphQlModule(config, serviceLifecycle)); + HypertraceGraphQlServiceConfig serviceConfig, + GraphQlEndpointConfig endpointConfig, + GraphQlServiceLifecycle serviceLifecycle, + GrpcChannelRegistry grpcChannelRegistry) { + final Injector injector = + Guice.createInjector( + new GraphQlModule( + serviceConfig, endpointConfig, serviceLifecycle, grpcChannelRegistry)); return GraphQLConfiguration.with(injector.getInstance(GraphQLSchema.class)) .with(injector.getInstance(GraphQlRequestContextBuilder.class)) - .asyncTimeout(config.getGraphQlTimeout().toMillis()) + .asyncTimeout(endpointConfig.getTimeout().toMillis()) .build(); } } diff --git a/hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlModule.java b/hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlModule.java index 72e21f4a..d6f8b919 100644 --- a/hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlModule.java +++ b/hypertrace-graphql-impl/src/main/java/org/hypertrace/graphql/impl/GraphQlModule.java @@ -13,12 +13,14 @@ import org.hypertrace.core.graphql.rx.RxUtilModule; import org.hypertrace.core.graphql.schema.registry.GraphQlSchemaRegistryModule; import org.hypertrace.core.graphql.span.SpanSchemaModule; +import org.hypertrace.core.graphql.spi.config.GraphQlEndpointConfig; import org.hypertrace.core.graphql.spi.config.GraphQlServiceConfig; import org.hypertrace.core.graphql.spi.lifecycle.GraphQlServiceLifecycle; import org.hypertrace.core.graphql.trace.TraceSchemaModule; import org.hypertrace.core.graphql.utils.gateway.GatewayUtilsModule; import org.hypertrace.core.graphql.utils.grpc.GraphQlGrpcModule; import org.hypertrace.core.graphql.utils.schema.SchemaUtilsModule; +import org.hypertrace.core.grpcutils.client.GrpcChannelRegistry; import org.hypertrace.graphql.atttribute.scopes.HypertraceAttributeScopeModule; import org.hypertrace.graphql.config.HypertraceGraphQlServiceConfig; import org.hypertrace.graphql.entity.EntityIdModule; @@ -29,24 +31,35 @@ import org.hypertrace.graphql.label.LabelSchemaModule; import org.hypertrace.graphql.metric.MetricModule; import org.hypertrace.graphql.spaces.SpacesSchemaModule; +import org.hypertrace.graphql.spanprocessing.SpanProcessingSchemaModule; import org.hypertrace.graphql.utils.metrics.gateway.GatewayMetricUtilsModule; class GraphQlModule extends AbstractModule { - private final HypertraceGraphQlServiceConfig config; + private final HypertraceGraphQlServiceConfig serviceConfig; + private final GraphQlEndpointConfig endpointConfig; private final GraphQlServiceLifecycle serviceLifecycle; + private final GrpcChannelRegistry grpcChannelRegistry; + public GraphQlModule( - final HypertraceGraphQlServiceConfig config, final GraphQlServiceLifecycle serviceLifecycle) { - this.config = config; + final HypertraceGraphQlServiceConfig serviceConfig, + final GraphQlEndpointConfig endpointConfig, + final GraphQlServiceLifecycle serviceLifecycle, + final GrpcChannelRegistry grpcChannelRegistry) { + this.serviceConfig = serviceConfig; + this.endpointConfig = endpointConfig; this.serviceLifecycle = serviceLifecycle; + this.grpcChannelRegistry = grpcChannelRegistry; } @Override protected void configure() { - bind(GraphQlServiceConfig.class).toInstance(this.config); - bind(HypertraceGraphQlServiceConfig.class).toInstance(this.config); + bind(GraphQlServiceConfig.class).toInstance(this.serviceConfig); + bind(HypertraceGraphQlServiceConfig.class).toInstance(this.serviceConfig); + bind(GraphQlEndpointConfig.class).toInstance(this.endpointConfig); bind(GraphQlServiceLifecycle.class).toInstance(this.serviceLifecycle); + bind(GrpcChannelRegistry.class).toInstance(this.grpcChannelRegistry); bind(Clock.class).toInstance(Clock.systemUTC()); install(new GraphQlRequestContextModule()); install(new GraphQlGrpcModule()); @@ -73,5 +86,6 @@ protected void configure() { install(new SpacesSchemaModule()); install(new RequestTransformationModule()); install(new LabelSchemaModule()); + install(new SpanProcessingSchemaModule()); } } diff --git a/hypertrace-graphql-impl/src/test/java/org/hypertrace/graphql/impl/GraphQlModuleTest.java b/hypertrace-graphql-impl/src/test/java/org/hypertrace/graphql/impl/GraphQlModuleTest.java index 33e28236..360e5488 100644 --- a/hypertrace-graphql-impl/src/test/java/org/hypertrace/graphql/impl/GraphQlModuleTest.java +++ b/hypertrace-graphql-impl/src/test/java/org/hypertrace/graphql/impl/GraphQlModuleTest.java @@ -4,7 +4,10 @@ import static org.mockito.Mockito.mock; import com.google.inject.Guice; +import graphql.schema.GraphQLSchema; +import org.hypertrace.core.graphql.spi.config.GraphQlEndpointConfig; import org.hypertrace.core.graphql.spi.lifecycle.GraphQlServiceLifecycle; +import org.hypertrace.core.grpcutils.client.GrpcChannelRegistry; import org.hypertrace.graphql.config.HypertraceGraphQlServiceConfig; import org.junit.jupiter.api.Test; @@ -17,7 +20,22 @@ public void testResolveBindings() { Guice.createInjector( new GraphQlModule( mock(HypertraceGraphQlServiceConfig.class), - mock(GraphQlServiceLifecycle.class))) + mock(GraphQlEndpointConfig.class), + mock(GraphQlServiceLifecycle.class), + mock(GrpcChannelRegistry.class))) .getAllBindings()); } + + @Test + public void testResolveSchema() { + assertDoesNotThrow( + () -> + Guice.createInjector( + new GraphQlModule( + mock(HypertraceGraphQlServiceConfig.class), + mock(GraphQlEndpointConfig.class), + mock(GraphQlServiceLifecycle.class), + mock(GrpcChannelRegistry.class))) + .getInstance(GraphQLSchema.class)); + } } diff --git a/hypertrace-graphql-labels-schema-api/build.gradle.kts b/hypertrace-graphql-labels-schema-api/build.gradle.kts index 60951475..fc9ee448 100644 --- a/hypertrace-graphql-labels-schema-api/build.gradle.kts +++ b/hypertrace-graphql-labels-schema-api/build.gradle.kts @@ -1,20 +1,20 @@ plugins { `java-library` jacoco - id("org.hypertrace.jacoco-report-plugin") + alias(commonLibs.plugins.hypertrace.jacoco) } dependencies { - api("com.google.inject:guice") - api("com.graphql-java:graphql-java") - api("org.hypertrace.core.graphql:hypertrace-core-graphql-spi") - api("io.github.graphql-java:graphql-java-annotations") - api("org.hypertrace.core.graphql:hypertrace-core-graphql-common-schema") + api(commonLibs.guice) + api(commonLibs.graphql.java) + api(localLibs.core.spi) + api(localLibs.graphql.annotations) + api(localLibs.core.schema.common) - annotationProcessor("org.projectlombok:lombok") - compileOnly("org.projectlombok:lombok") + annotationProcessor(commonLibs.lombok) + compileOnly(commonLibs.lombok) - implementation("org.hypertrace.core.graphql:hypertrace-core-graphql-deserialization") + implementation(localLibs.core.deserialization) } tasks.test { diff --git a/hypertrace-graphql-labels-schema-api/gradle.lockfile b/hypertrace-graphql-labels-schema-api/gradle.lockfile new file mode 100644 index 00000000..c64a5fc4 --- /dev/null +++ b/hypertrace-graphql-labels-schema-api/gradle.lockfile @@ -0,0 +1,62 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +aopalliance:aopalliance:1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.auth0:java-jwt:4.4.0=runtimeClasspath,testRuntimeClasspath +com.auth0:jwks-rsa:0.22.0=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.16.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.android:annotations:4.1.1.4=runtimeClasspath,testRuntimeClasspath +com.google.api.grpc:proto-google-common-protos:2.22.0=runtimeClasspath,testRuntimeClasspath +com.google.code.findbugs:jsr305:3.0.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.10.1=runtimeClasspath,testRuntimeClasspath +com.google.errorprone:error_prone_annotations:2.18.0=compileClasspath,testCompileClasspath +com.google.errorprone:error_prone_annotations:2.20.0=runtimeClasspath,testRuntimeClasspath +com.google.guava:failureaccess:1.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava-parent:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:32.1.2-jre=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.inject:guice:6.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.j2objc:j2objc-annotations:2.8=compileClasspath,testCompileClasspath +com.google.protobuf:protobuf-java:3.24.1=runtimeClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-kickstart:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java-kickstart:graphql-java-servlet:14.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java-extended-scalars:17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:graphql-java:19.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.graphql-java:java-dataloader:3.2.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.github.graphql-java:graphql-java-annotations:9.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-api:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-bom:1.60.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.grpc:grpc-context:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-core:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-inprocess:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf-lite:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-protobuf:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-stub:1.60.0=runtimeClasspath,testRuntimeClasspath +io.grpc:grpc-util:1.60.0=runtimeClasspath,testRuntimeClasspath +io.netty:netty-bom:4.1.108.Final=runtimeClasspath,testRuntimeClasspath +io.perfmark:perfmark-api:0.26.0=runtimeClasspath,testRuntimeClasspath +io.reactivex.rxjava3:rxjava:3.1.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.annotation:javax.annotation-api:1.3.2=runtimeClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:4.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.validation:validation-api:1.1.0.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.websocket:javax.websocket-api:1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.checkerframework:checker-qual:3.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.23=runtimeClasspath,testRuntimeClasspath +org.hypertrace.bom:hypertrace-bom:0.3.23=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:attribute-service-api:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.attribute.service:caching-attribute-service-client:0.14.35=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-rx-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-client-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.grpcutils:grpc-context-utils:0.13.4=runtimeClasspath,testRuntimeClasspath +org.hypertrace.core.kafkastreams.framework:kafka-bom:0.4.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.projectlombok:lombok:1.18.30=annotationProcessor,compileClasspath +org.reactivestreams:reactive-streams:1.0.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty= diff --git a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/fetcher/LabelApplicationRuleFetcher.java b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/fetcher/LabelApplicationRuleFetcher.java index 35d85fdc..669f2819 100644 --- a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/fetcher/LabelApplicationRuleFetcher.java +++ b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/fetcher/LabelApplicationRuleFetcher.java @@ -1,5 +1,7 @@ package org.hypertrace.graphql.label.fetcher; +import static org.hypertrace.core.graphql.context.GraphQlRequestContext.contextFromEnvironment; + import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import java.util.concurrent.CompletableFuture; @@ -31,7 +33,7 @@ static final class LabelApplicationRuleFetcherImpl public CompletableFuture get( DataFetchingEnvironment environment) { return this.labelApplicationRuleDao - .getLabelApplicationRules(this.requestBuilder.build(environment.getContext())) + .getLabelApplicationRules(this.requestBuilder.build(contextFromEnvironment(environment))) .toCompletionStage() .toCompletableFuture(); } diff --git a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/fetcher/LabelFetcher.java b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/fetcher/LabelFetcher.java index 3381db12..98d01cec 100644 --- a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/fetcher/LabelFetcher.java +++ b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/fetcher/LabelFetcher.java @@ -1,10 +1,13 @@ package org.hypertrace.graphql.label.fetcher; +import static org.hypertrace.core.graphql.context.GraphQlRequestContext.contextFromEnvironment; + import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import java.util.concurrent.CompletableFuture; import javax.inject.Inject; import org.hypertrace.core.graphql.common.fetcher.InjectableDataFetcher; +import org.hypertrace.graphql.label.joiner.EntityAndRuleJoiner; import org.hypertrace.graphql.label.joiner.EntityAndRuleJoinerBuilder; import org.hypertrace.graphql.label.schema.LabelResultSet; @@ -25,8 +28,8 @@ static final class LabelFetcherImpl implements DataFetcher get(DataFetchingEnvironment environment) { return this.requestBuilder - .build(environment.getContext(), environment.getSelectionSet()) - .flatMap(request -> request.joinLabelsWithEntitiesAndRules()) + .build(contextFromEnvironment(environment), environment.getSelectionSet()) + .flatMap(EntityAndRuleJoiner::joinLabelsWithEntitiesAndRules) .toCompletionStage() .toCompletableFuture(); } diff --git a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleCreateMutator.java b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleCreateMutator.java index 4de7ccc5..379e6d0c 100644 --- a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleCreateMutator.java +++ b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleCreateMutator.java @@ -1,5 +1,7 @@ package org.hypertrace.graphql.label.mutator; +import static org.hypertrace.core.graphql.context.GraphQlRequestContext.contextFromEnvironment; + import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import java.util.concurrent.CompletableFuture; @@ -33,7 +35,7 @@ public CompletableFuture get(DataFetchingEnvironment envir return this.labelApplicationRuleDao .createLabelApplicationRule( this.requestBuilder.buildCreateLabelApplicationRuleRequest( - environment.getContext(), environment.getArguments())) + contextFromEnvironment(environment), environment.getArguments())) .toCompletionStage() .toCompletableFuture(); } diff --git a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleDeleteMutator.java b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleDeleteMutator.java index 2cd2aa1e..ede47bef 100644 --- a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleDeleteMutator.java +++ b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleDeleteMutator.java @@ -1,5 +1,7 @@ package org.hypertrace.graphql.label.mutator; +import static org.hypertrace.core.graphql.context.GraphQlRequestContext.contextFromEnvironment; + import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import java.util.concurrent.CompletableFuture; @@ -31,7 +33,7 @@ public CompletableFuture get(DataFetchingEnvironment environment) { return this.labelApplicationRuleDao .deleteLabelApplicationRule( this.requestBuilder.buildDeleteLabelApplicationRuleRequest( - environment.getContext(), environment.getArguments())) + contextFromEnvironment(environment), environment.getArguments())) .toCompletionStage() .toCompletableFuture(); } diff --git a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleUpdateMutator.java b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleUpdateMutator.java index eb80dfdf..876888f3 100644 --- a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleUpdateMutator.java +++ b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelApplicationRuleUpdateMutator.java @@ -1,5 +1,7 @@ package org.hypertrace.graphql.label.mutator; +import static org.hypertrace.core.graphql.context.GraphQlRequestContext.contextFromEnvironment; + import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import java.util.concurrent.CompletableFuture; @@ -33,7 +35,7 @@ public CompletableFuture get(DataFetchingEnvironment envir return this.labelApplicationRuleDao .updateLabelApplicationRule( this.requestBuilder.buildUpdateLabelApplicationRuleRequest( - environment.getContext(), environment.getArguments())) + contextFromEnvironment(environment), environment.getArguments())) .toCompletionStage() .toCompletableFuture(); } diff --git a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelCreateMutator.java b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelCreateMutator.java index e4305d31..be273ed6 100644 --- a/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelCreateMutator.java +++ b/hypertrace-graphql-labels-schema-api/src/main/java/org/hypertrace/graphql/label/mutator/LabelCreateMutator.java @@ -1,5 +1,7 @@ package org.hypertrace.graphql.label.mutator; +import static org.hypertrace.core.graphql.context.GraphQlRequestContext.contextFromEnvironment; + import graphql.schema.DataFetcher; import graphql.schema.DataFetchingEnvironment; import java.util.concurrent.CompletableFuture; @@ -30,7 +32,7 @@ public CompletableFuture