1
0
mirror of https://github.com/google/nomulus synced 2026-01-05 04:56:03 +00:00

Write GKE metrics with the apprioate labels (#2626)

Also makes preperations to expose the sidecar proxy.
This commit is contained in:
Lai Jiang
2024-12-18 11:15:54 -05:00
committed by GitHub
parent da8df1f4d9
commit c9c61e4f17
30 changed files with 894 additions and 767 deletions

View File

@@ -3,11 +3,11 @@
# This file is expected to be part of source control.
aopalliance:aopalliance:1.0=annotationProcessor,errorprone,testAnnotationProcessor
com.fasterxml.jackson.core:jackson-annotations:2.15.3=testRuntimeClasspath
com.fasterxml.jackson.core:jackson-annotations:2.18.0=testCompileClasspath
com.fasterxml.jackson.core:jackson-annotations:2.18.2=testCompileClasspath
com.fasterxml.jackson.core:jackson-core:2.15.3=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.fasterxml.jackson.core:jackson-core:2.18.0=compileClasspath,testCompileClasspath
com.fasterxml.jackson.core:jackson-core:2.18.2=compileClasspath,testCompileClasspath
com.fasterxml.jackson:jackson-bom:2.15.3=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.fasterxml.jackson:jackson-bom:2.18.0=compileClasspath,testCompileClasspath
com.fasterxml.jackson:jackson-bom:2.18.2=compileClasspath,testCompileClasspath
com.github.ben-manes.caffeine:caffeine:3.0.5=annotationProcessor,errorprone,testAnnotationProcessor
com.github.ben-manes.caffeine:caffeine:3.1.8=deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.github.docker-java:docker-java-api:3.4.0=testCompileClasspath,testRuntimeClasspath
@@ -15,44 +15,53 @@ com.github.docker-java:docker-java-transport-zerodep:3.4.0=testCompileClasspath,
com.github.docker-java:docker-java-transport:3.4.0=testCompileClasspath,testRuntimeClasspath
com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.android:annotations:4.1.1.4=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api-client:google-api-client:2.7.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.api-client:google-api-client:2.7.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api-client:google-api-client:2.7.1=compileClasspath,testCompileClasspath
com.google.api.grpc:gapic-google-cloud-storage-v2:2.29.0-alpha=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api.grpc:gapic-google-cloud-storage-v2:2.45.0-beta=compileClasspath,testCompileClasspath
com.google.api.grpc:gapic-google-cloud-storage-v2:2.46.0-beta=compileClasspath,testCompileClasspath
com.google.api.grpc:grpc-google-cloud-storage-v2:2.29.0-alpha=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api.grpc:grpc-google-cloud-storage-v2:2.45.0-beta=compileClasspath,testCompileClasspath
com.google.api.grpc:proto-google-cloud-monitoring-v3:3.31.0=compileClasspath,testCompileClasspath
com.google.api.grpc:grpc-google-cloud-storage-v2:2.46.0-beta=compileClasspath,testCompileClasspath
com.google.api.grpc:proto-google-cloud-monitoring-v3:3.52.0=compileClasspath,testCompileClasspath
com.google.api.grpc:proto-google-cloud-storage-v2:2.29.0-alpha=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api.grpc:proto-google-cloud-storage-v2:2.45.0-beta=compileClasspath,testCompileClasspath
com.google.api.grpc:proto-google-cloud-storage-v2:2.46.0-beta=compileClasspath,testCompileClasspath
com.google.api.grpc:proto-google-cloud-tasks-v2:2.29.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api.grpc:proto-google-cloud-tasks-v2beta2:0.119.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api.grpc:proto-google-cloud-tasks-v2beta3:0.119.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api.grpc:proto-google-common-protos:2.49.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.api.grpc:proto-google-iam-v1:1.44.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.api:api-common:2.41.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.api.grpc:proto-google-common-protos:2.45.1=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api.grpc:proto-google-common-protos:2.50.0=compileClasspath,testCompileClasspath
com.google.api.grpc:proto-google-iam-v1:1.40.1=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api.grpc:proto-google-iam-v1:1.45.0=compileClasspath,testCompileClasspath
com.google.api:api-common:2.37.1=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api:api-common:2.42.0=compileClasspath,testCompileClasspath
com.google.api:gax-grpc:2.36.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api:gax-grpc:2.58.0=compileClasspath,testCompileClasspath
com.google.api:gax-httpjson:2.58.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.api:gax:2.58.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.api:gax-grpc:2.59.0=compileClasspath,testCompileClasspath
com.google.api:gax-httpjson:2.54.1=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api:gax-httpjson:2.59.0=compileClasspath,testCompileClasspath
com.google.api:gax:2.54.1=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.api:gax:2.59.0=compileClasspath,testCompileClasspath
com.google.apis:google-api-services-cloudkms:v1-rev20241111-2.0.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.apis:google-api-services-monitoring:v3-rev20241017-2.0.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.apis:google-api-services-storage:v1-rev20231012-2.0.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.apis:google-api-services-storage:v1-rev20241008-2.0.0=compileClasspath,testCompileClasspath
com.google.auth:google-auth-library-credentials:1.30.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.auth:google-auth-library-oauth2-http:1.30.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.apis:google-api-services-storage:v1-rev20241206-2.0.0=compileClasspath,testCompileClasspath
com.google.auth:google-auth-library-credentials:1.27.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.auth:google-auth-library-credentials:1.30.1=compileClasspath,testCompileClasspath
com.google.auth:google-auth-library-oauth2-http:1.27.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.auth:google-auth-library-oauth2-http:1.30.1=compileClasspath,testCompileClasspath
com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto.value:auto-value-annotations:1.11.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.auto.value:auto-value-annotations:1.9=annotationProcessor,errorprone,testAnnotationProcessor
com.google.auto.value:auto-value:1.11.0=annotationProcessor,deploy_jar,runtimeClasspath,testAnnotationProcessor,testRuntimeClasspath
com.google.auto:auto-common:1.2.1=annotationProcessor,errorprone,testAnnotationProcessor
com.google.cloud.opentelemetry:exporter-metrics:0.31.0=compileClasspath,testCompileClasspath
com.google.cloud.opentelemetry:exporter-metrics:0.33.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-core-grpc:2.26.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.cloud:google-cloud-core-grpc:2.48.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-core-grpc:2.49.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-core-http:2.26.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.cloud:google-cloud-core-http:2.48.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-core:2.48.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.cloud:google-cloud-monitoring:3.31.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-core-http:2.49.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-core:2.44.1=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.cloud:google-cloud-core:2.49.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-monitoring:3.52.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-storage:2.29.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.cloud:google-cloud-storage:2.45.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-storage:2.46.0=compileClasspath,testCompileClasspath
com.google.cloud:google-cloud-tasks:2.29.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.code.findbugs:jsr305:3.0.2=annotationProcessor,checkstyle,compileClasspath,deploy_jar,errorprone,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.code.gson:gson:2.11.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -62,7 +71,8 @@ com.google.dagger:dagger:2.51.1=annotationProcessor,compileClasspath,deploy_jar,
com.google.devtools.ksp:symbol-processing-api:1.9.20-1.0.14=annotationProcessor,testAnnotationProcessor
com.google.errorprone:error_prone_annotation:2.23.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotations:2.23.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_annotations:2.35.1=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.errorprone:error_prone_annotations:2.32.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.errorprone:error_prone_annotations:2.36.0=compileClasspath,testCompileClasspath
com.google.errorprone:error_prone_annotations:2.7.1=checkstyle
com.google.errorprone:error_prone_check_api:2.23.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.errorprone:error_prone_core:2.23.0=annotationProcessor,errorprone,testAnnotationProcessor
@@ -78,15 +88,19 @@ com.google.guava:guava-parent:32.1.1-jre=errorprone
com.google.guava:guava:31.0.1-jre=checkstyle
com.google.guava:guava:32.1.1-jre=errorprone
com.google.guava:guava:33.0.0-jre=annotationProcessor,testAnnotationProcessor
com.google.guava:guava:33.3.1-jre=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.guava:guava:33.3.0-jre=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.guava:guava:33.3.1-jre=compileClasspath,testCompileClasspath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,checkstyle,compileClasspath,deploy_jar,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
com.google.http-client:google-http-client-apache-v2:1.45.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.http-client:google-http-client-apache-v2:1.45.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.http-client:google-http-client-apache-v2:1.45.3=compileClasspath,testCompileClasspath
com.google.http-client:google-http-client-appengine:1.43.3=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.http-client:google-http-client-appengine:1.45.0=compileClasspath,testCompileClasspath
com.google.http-client:google-http-client-gson:1.45.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.http-client:google-http-client-appengine:1.45.3=compileClasspath,testCompileClasspath
com.google.http-client:google-http-client-gson:1.45.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.http-client:google-http-client-gson:1.45.3=compileClasspath,testCompileClasspath
com.google.http-client:google-http-client-jackson2:1.43.3=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.http-client:google-http-client-jackson2:1.45.0=compileClasspath,testCompileClasspath
com.google.http-client:google-http-client:1.45.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
com.google.http-client:google-http-client-jackson2:1.45.3=compileClasspath,testCompileClasspath
com.google.http-client:google-http-client:1.45.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
com.google.http-client:google-http-client:1.45.3=compileClasspath,testCompileClasspath
com.google.inject:guice:5.1.0=annotationProcessor,errorprone,testAnnotationProcessor
com.google.j2objc:j2objc-annotations:1.3=checkstyle
com.google.j2objc:j2objc-annotations:3.0.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -114,56 +128,54 @@ io.github.eisop:dataflow-errorprone:3.34.0-eisop1=annotationProcessor,errorprone
io.github.java-diff-utils:java-diff-utils:4.12=annotationProcessor,errorprone,testAnnotationProcessor
io.github.java-diff-utils:java-diff-utils:4.15=deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.grpc:grpc-alts:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-alts:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-alts:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-api:1.66.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-api:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-api:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-auth:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-auth:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-auth:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-context:1.66.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-context:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-context:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-core:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-core:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-core:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-googleapis:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-grpclb:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-grpclb:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-grpclb:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-inprocess:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-inprocess:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-inprocess:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-netty-shaded:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-opentelemetry:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-opentelemetry:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-protobuf-lite:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-protobuf-lite:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-protobuf:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-protobuf:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-protobuf:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-rls:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-s2a:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-services:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-stub:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-stub:1.68.1=compileClasspath,testCompileClasspath
io.grpc:grpc-stub:1.69.0=compileClasspath,testCompileClasspath
io.grpc:grpc-util:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.grpc:grpc-xds:1.58.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.netty:netty-buffer:4.1.115.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-codec-http:4.1.115.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-codec:4.1.115.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-common:4.1.115.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-handler:4.1.115.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-resolver:4.1.115.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-buffer:4.1.116.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-codec-http:4.1.116.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-codec:4.1.116.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-common:4.1.116.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-handler:4.1.116.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-resolver:4.1.116.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-tcnative-boringssl-static:2.0.69.Final=deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-tcnative-classes:2.0.69.Final=deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-transport-native-unix-common:4.1.115.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-transport:4.1.115.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-transport-native-unix-common:4.1.116.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.netty:netty-transport:4.1.116.Final=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.opencensus:opencensus-api:0.31.1=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.opencensus:opencensus-contrib-http-util:0.31.1=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
io.opencensus:opencensus-proto:0.2.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
io.opentelemetry.contrib:opentelemetry-gcp-resources:1.37.0-alpha=compileClasspath,testCompileClasspath
io.opentelemetry.semconv:opentelemetry-semconv:1.25.0-alpha=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-api:1.42.1=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-context:1.42.1=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-common:1.42.1=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi:1.42.1=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-logs:1.42.1=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-metrics:1.42.1=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-trace:1.42.1=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk:1.42.1=compileClasspath,testCompileClasspath
io.opentelemetry.semconv:opentelemetry-semconv:1.27.0-alpha=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-api:1.45.0=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-context:1.45.0=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-common:1.45.0=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi:1.45.0=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-logs:1.45.0=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-metrics:1.45.0=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk-trace:1.45.0=compileClasspath,testCompileClasspath
io.opentelemetry:opentelemetry-sdk:1.45.0=compileClasspath,testCompileClasspath
io.perfmark:perfmark-api:0.26.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
jakarta.activation:jakarta.activation-api:2.1.3=deploy_jar,runtimeClasspath,testRuntimeClasspath
jakarta.inject:jakarta.inject-api:1.0.5=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -193,7 +205,7 @@ org.checkerframework:checker-qual:3.12.0=checkstyle
org.checkerframework:checker-qual:3.33.0=errorprone
org.checkerframework:checker-qual:3.41.0=annotationProcessor,testAnnotationProcessor
org.checkerframework:checker-qual:3.43.0=deploy_jar,runtimeClasspath,testRuntimeClasspath
org.checkerframework:checker-qual:3.47.0=compileClasspath,testCompileClasspath
org.checkerframework:checker-qual:3.48.3=compileClasspath,testCompileClasspath
org.codehaus.mojo:animal-sniffer-annotations:1.23=deploy_jar,runtimeClasspath,testRuntimeClasspath
org.conscrypt:conscrypt-openjdk-uber:2.5.2=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.eclipse.angus:angus-activation:2.0.2=deploy_jar,runtimeClasspath,testRuntimeClasspath
@@ -212,16 +224,16 @@ org.jetbrains.kotlin:kotlin-stdlib:1.9.20=annotationProcessor,testAnnotationProc
org.jetbrains:annotations:13.0=annotationProcessor,testAnnotationProcessor
org.jetbrains:annotations:17.0.0=testCompileClasspath,testRuntimeClasspath
org.jspecify:jspecify:0.3.0=deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-api:5.11.3=testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-engine:5.11.3=testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-params:5.11.3=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-commons:1.11.3=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-engine:1.11.3=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-launcher:1.11.3=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-runner:1.11.3=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-suite-api:1.11.3=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-suite-commons:1.11.3=testRuntimeClasspath
org.junit:junit-bom:5.11.3=testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-api:5.11.4=testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-engine:5.11.4=testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-params:5.11.4=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-commons:1.11.4=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-engine:1.11.4=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-launcher:1.11.4=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-runner:1.11.4=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-suite-api:1.11.4=testCompileClasspath,testRuntimeClasspath
org.junit.platform:junit-platform-suite-commons:1.11.4=testRuntimeClasspath
org.junit:junit-bom:5.11.4=testCompileClasspath,testRuntimeClasspath
org.mockito:mockito-core:5.14.2=testCompileClasspath,testRuntimeClasspath
org.objenesis:objenesis:3.3=testRuntimeClasspath
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath
@@ -231,7 +243,8 @@ org.ow2.asm:asm:9.7=deploy_jar,jacocoAnt,runtimeClasspath,testCompileClasspath,t
org.pcollections:pcollections:3.1.4=annotationProcessor,errorprone,testAnnotationProcessor
org.reflections:reflections:0.10.2=checkstyle
org.rnorth.duct-tape:duct-tape:1.0.8=testCompileClasspath,testRuntimeClasspath
org.slf4j:slf4j-api:2.0.9=compileClasspath,testCompileClasspath,testRuntimeClasspath
org.slf4j:slf4j-api:2.0.16=compileClasspath,testCompileClasspath
org.slf4j:slf4j-api:2.0.9=testRuntimeClasspath
org.testcontainers:junit-jupiter:1.20.4=testCompileClasspath,testRuntimeClasspath
org.testcontainers:testcontainers:1.20.4=testCompileClasspath,testRuntimeClasspath
org.threeten:threetenbp:1.7.0=compileClasspath,deploy_jar,runtimeClasspath,testCompileClasspath,testRuntimeClasspath

View File

@@ -26,8 +26,8 @@ import dagger.Component;
import dagger.Module;
import dagger.Provides;
import google.registry.proxy.ProxyConfig.Environment;
import google.registry.proxy.metric.MetricParameters;
import google.registry.util.GoogleCredentialsBundle;
import google.registry.util.MetricParameters;
import javax.inject.Singleton;
/** Module that provides necessary bindings to instantiate a {@link MetricReporter} */

View File

@@ -33,6 +33,7 @@ public class ProxyConfig {
QA,
QA_CANARY,
ALPHA,
ALPHA_CANARY,
LOCAL,
}

View File

@@ -1,148 +0,0 @@
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.proxy.metric;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.api.services.monitoring.v3.model.MonitoredResource;
import com.google.common.collect.ImmutableMap;
import com.google.common.flogger.FluentLogger;
import com.google.common.io.CharStreams;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
import java.util.function.Function;
import javax.inject.Inject;
/**
* Utility class to obtain labels for monitored resource of type {@code gke_container}.
*
* <p>Custom metrics collected by the proxy need to be associated with a {@link MonitoredResource}.
* When running on GKE, the type is {@code gke_container}. The labels for this type are used to
* group related metrics together, and to avoid out-of-order metrics writes. This class provides a
* map of the labels where the values are either read from environment variables (pod and container
* related labels) or queried from GCE metadata server (cluster and instance related labels).
*
* @see <a
* href="https://cloud.google.com/monitoring/custom-metrics/creating-metrics#which-resource">
* Creating Custom Metrics - Choosing a monitored resource type</a>
* @see <a href="https://cloud.google.com/monitoring/api/resources#tag_gke_container">Monitored
* Resource Types - gke_container</a>
* @see <a href="https://cloud.google.com/compute/docs/storing-retrieving-metadata#querying">Storing
* and Retrieving Instance Metadata - Getting metadata</a>
* @see <a
* href="https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/">
* Expose Pod Information to Containers Through Environment Variables </a>
*/
public class MetricParameters {
// Environment variable names, defined in the GKE deployment pod spec.
static final String NAMESPACE_ID_ENV = "NAMESPACE_ID";
static final String POD_ID_ENV = "POD_ID";
static final String CONTAINER_NAME_ENV = "CONTAINER_NAME";
// GCE metadata server URLs to retrieve instance related information.
private static final String GCE_METADATA_URL_BASE = "http://metadata.google.internal/";
static final String PROJECT_ID_PATH = "computeMetadata/v1/project/project-id";
static final String CLUSTER_NAME_PATH = "computeMetadata/v1/instance/attributes/cluster-name";
static final String INSTANCE_ID_PATH = "computeMetadata/v1/instance/id";
static final String ZONE_PATH = "computeMetadata/v1/instance/zone";
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private final Map<String, String> envVarMap;
private final Function<String, HttpURLConnection> connectionFactory;
MetricParameters(
Map<String, String> envVarMap, Function<String, HttpURLConnection> connectionFactory) {
this.envVarMap = envVarMap;
this.connectionFactory = connectionFactory;
}
@Inject
MetricParameters() {
this(ImmutableMap.copyOf(System.getenv()), MetricParameters::gceConnectionFactory);
}
private static HttpURLConnection gceConnectionFactory(String path) {
String url = GCE_METADATA_URL_BASE + path;
try {
HttpURLConnection connection = (HttpURLConnection) new URI(url).toURL().openConnection();
connection.setRequestMethod("GET");
// The metadata server requires this header to be set when querying from a GCE instance.
connection.setRequestProperty("Metadata-Flavor", "Google");
connection.setDoOutput(true);
return connection;
} catch (URISyntaxException | MalformedURLException e) {
throw new RuntimeException(String.format("Incorrect GCE metadata server URL: %s", url), e);
} catch (IOException e) {
throw new RuntimeException(
String.format("Cannot connect to GCE metadata server: %s", url), e);
}
}
private String readEnvVar(String envVar) {
return envVarMap.getOrDefault(envVar, "");
}
private String readGceMetadata(String path) {
String value = "";
HttpURLConnection connection = connectionFactory.apply(path);
try {
connection.connect();
int responseCode = connection.getResponseCode();
if (responseCode < 200 || responseCode > 299) {
logger.atWarning().log(
"Got an error response: %d\n%s",
responseCode,
CharStreams.toString(new InputStreamReader(connection.getErrorStream(), UTF_8)));
} else {
value = CharStreams.toString(new InputStreamReader(connection.getInputStream(), UTF_8));
}
} catch (IOException e) {
logger.atWarning().withCause(e).log("Cannot obtain GCE metadata from path %s", path);
}
return value;
}
public ImmutableMap<String, String> makeLabelsMap() {
// The zone metadata is in the form of "projects/<PROJECT_NUMERICAL_ID>/zones/<ZONE_NAME>".
// We only need the last part after the slash.
String fullZone = readGceMetadata(ZONE_PATH);
String zone;
String[] fullZoneArray = fullZone.split("/", -1);
if (fullZoneArray.length < 4) {
logger.atWarning().log("Zone %s is valid.", fullZone);
// This will make the metric report throw, but it happens in a different thread and will not
// kill the whole application.
zone = "";
} else {
zone = fullZoneArray[3];
}
return new ImmutableMap.Builder<String, String>()
.put("project_id", readGceMetadata(PROJECT_ID_PATH))
.put("cluster_name", readGceMetadata(CLUSTER_NAME_PATH))
.put("namespace_id", readEnvVar(NAMESPACE_ID_ENV))
.put("instance_id", readGceMetadata(INSTANCE_ID_PATH))
.put("pod_id", readEnvVar(POD_ID_ENV))
.put("container_name", readEnvVar(CONTAINER_NAME_ENV))
.put("zone", zone)
.build();
}
}

View File

@@ -1,133 +0,0 @@
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.proxy.metric;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.proxy.metric.MetricParameters.CLUSTER_NAME_PATH;
import static google.registry.proxy.metric.MetricParameters.CONTAINER_NAME_ENV;
import static google.registry.proxy.metric.MetricParameters.INSTANCE_ID_PATH;
import static google.registry.proxy.metric.MetricParameters.NAMESPACE_ID_ENV;
import static google.registry.proxy.metric.MetricParameters.POD_ID_ENV;
import static google.registry.proxy.metric.MetricParameters.PROJECT_ID_PATH;
import static google.registry.proxy.metric.MetricParameters.ZONE_PATH;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableMap;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.function.Function;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/** Unit tests for {@link MetricParameters}. */
class MetricParametersTest {
private static final HashMap<String, String> RESULTS = new HashMap<>();
private final HttpURLConnection projectIdConnection = mock(HttpURLConnection.class);
private final HttpURLConnection clusterNameConnection = mock(HttpURLConnection.class);
private final HttpURLConnection instanceIdConnection = mock(HttpURLConnection.class);
private final HttpURLConnection zoneConnection = mock(HttpURLConnection.class);
private final ImmutableMap<String, HttpURLConnection> mockConnections =
ImmutableMap.of(
PROJECT_ID_PATH,
projectIdConnection,
CLUSTER_NAME_PATH,
clusterNameConnection,
INSTANCE_ID_PATH,
instanceIdConnection,
ZONE_PATH,
zoneConnection);
private final HashMap<String, String> fakeEnvVarMap = new HashMap<>();
private final Function<String, HttpURLConnection> fakeConnectionFactory = mockConnections::get;
private final MetricParameters metricParameters =
new MetricParameters(fakeEnvVarMap, fakeConnectionFactory);
private static InputStream makeInputStreamFromString(String input) {
return new ByteArrayInputStream(input.getBytes(UTF_8));
}
@BeforeEach
void beforeEach() throws Exception {
fakeEnvVarMap.put(NAMESPACE_ID_ENV, "some-namespace");
fakeEnvVarMap.put(POD_ID_ENV, "some-pod");
fakeEnvVarMap.put(CONTAINER_NAME_ENV, "some-container");
when(projectIdConnection.getInputStream())
.thenReturn(makeInputStreamFromString("some-project"));
when(clusterNameConnection.getInputStream())
.thenReturn(makeInputStreamFromString("some-cluster"));
when(instanceIdConnection.getInputStream())
.thenReturn(makeInputStreamFromString("some-instance"));
when(zoneConnection.getInputStream())
.thenReturn(makeInputStreamFromString("projects/some-project/zones/some-zone"));
for (Entry<String, HttpURLConnection> entry : mockConnections.entrySet()) {
when(entry.getValue().getResponseCode()).thenReturn(200);
}
RESULTS.put("project_id", "some-project");
RESULTS.put("cluster_name", "some-cluster");
RESULTS.put("namespace_id", "some-namespace");
RESULTS.put("instance_id", "some-instance");
RESULTS.put("pod_id", "some-pod");
RESULTS.put("container_name", "some-container");
RESULTS.put("zone", "some-zone");
}
@Test
void testSuccess() {
assertThat(metricParameters.makeLabelsMap()).isEqualTo(ImmutableMap.copyOf(RESULTS));
}
@Test
void testSuccess_missingEnvVar() {
fakeEnvVarMap.remove(POD_ID_ENV);
RESULTS.put("pod_id", "");
assertThat(metricParameters.makeLabelsMap()).isEqualTo(ImmutableMap.copyOf(RESULTS));
}
@Test
void testSuccess_malformedZone() throws Exception {
when(zoneConnection.getInputStream()).thenReturn(makeInputStreamFromString("some-zone"));
RESULTS.put("zone", "");
assertThat(metricParameters.makeLabelsMap()).isEqualTo(ImmutableMap.copyOf(RESULTS));
}
@Test
void testSuccess_errorResponseCode() throws Exception {
when(projectIdConnection.getResponseCode()).thenReturn(404);
when(projectIdConnection.getErrorStream())
.thenReturn(makeInputStreamFromString("some error message"));
RESULTS.put("project_id", "");
assertThat(metricParameters.makeLabelsMap()).isEqualTo(ImmutableMap.copyOf(RESULTS));
}
@Test
void testSuccess_connectionError() throws Exception {
InputStream fakeInputStream = mock(InputStream.class);
when(projectIdConnection.getInputStream()).thenReturn(fakeInputStream);
when(fakeInputStream.read(any(byte[].class), anyInt(), anyInt()))
.thenThrow(new IOException("some exception"));
RESULTS.put("project_id", "");
assertThat(metricParameters.makeLabelsMap()).isEqualTo(ImmutableMap.copyOf(RESULTS));
}
}