GoogleCloudPlatform / spring-cloud-gcp

New home for Spring Cloud GCP development starting with version 2.0.
Apache License 2.0
418 stars 311 forks source link

Stackdriver Logging: reorganize dependency structure to have minimal set of dependencies for logging via console #2207

Open amarkevich opened 1 year ago

amarkevich commented 1 year ago

Is your feature request related to a problem? Please describe. Project which uses Log via Console have a huge bunch of unused dependencies [1] (about 46 Mb)

1.

 com.google.cloud:spring-cloud-gcp-logging:jar:4.8.0:compile
+- com.google.cloud:spring-cloud-gcp-core:jar:4.8.0:compile
|  +- com.google.cloud:google-cloud-core:jar:2.23.0:compile
|  +- org.springframework:spring-core:jar:5.3.30:compile
|  |  \- org.springframework:spring-jcl:jar:5.3.30:compile
|  \- org.springframework:spring-context:jar:5.3.30:compile
|     +- org.springframework:spring-aop:jar:5.3.30:compile
|     +- org.springframework:spring-beans:jar:5.3.30:compile
|     \- org.springframework:spring-expression:jar:5.3.30:compile
+- ch.qos.logback.contrib:logback-json-classic:jar:0.1.5:compile
|  +- ch.qos.logback:logback-classic:jar:1.2.12:compile
|  \- ch.qos.logback.contrib:logback-json-core:jar:0.1.5:compile
+- com.google.cloud:google-cloud-logging-logback:jar:0.130.22-alpha:compile
|  +- ch.qos.logback:logback-core:jar:1.2.12:compile
|  +- com.google.cloud:google-cloud-logging:jar:3.15.9:compile
|  +- com.google.guava:failureaccess:jar:1.0.1:compile
|  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
|  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
|  +- org.checkerframework:checker-qual:jar:3.33.0:compile
|  +- com.google.j2objc:j2objc-annotations:jar:2.8:compile
|  +- com.google.code.gson:gson:jar:2.9.1:compile
|  +- io.grpc:grpc-api:jar:1.56.1:compile
|  +- io.grpc:grpc-context:jar:1.56.1:compile
|  +- io.grpc:grpc-stub:jar:1.56.1:compile
|  +- io.grpc:grpc-protobuf:jar:1.56.1:compile
|  +- io.grpc:grpc-protobuf-lite:jar:1.56.1:compile
|  +- com.google.auto.value:auto-value-annotations:jar:1.10.2:compile
|  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
|  +- com.google.protobuf:protobuf-java-util:jar:3.24.3:compile
|  +- com.google.api.grpc:proto-google-common-protos:jar:2.24.0:compile
|  +- com.google.api.grpc:proto-google-cloud-logging-v2:jar:0.104.9:compile
|  +- com.google.auth:google-auth-library-credentials:jar:1.19.0:compile
|  +- io.opencensus:opencensus-api:jar:0.31.1:compile
|  +- com.google.api:gax-grpc:jar:2.33.0:compile
|  +- io.grpc:grpc-alts:jar:1.56.1:compile
|  +- io.grpc:grpc-grpclb:jar:1.56.1:compile
|  +- org.conscrypt:conscrypt-openjdk-uber:jar:2.5.2:compile
|  +- io.grpc:grpc-auth:jar:1.56.1:compile
|  +- io.grpc:grpc-netty-shaded:jar:1.56.1:compile
|  +- io.grpc:grpc-googleapis:jar:1.56.1:runtime
|  +- io.grpc:grpc-xds:jar:1.56.1:runtime
|  +- io.opencensus:opencensus-proto:jar:0.2.0:runtime
|  +- io.grpc:grpc-services:jar:1.56.1:runtime
|  +- com.google.re2j:re2j:jar:1.7:runtime
|  +- com.google.cloud:google-cloud-core-grpc:jar:2.23.0:compile
|  +- com.google.http-client:google-http-client-gson:jar:1.43.3:compile
|  +- com.google.http-client:google-http-client:jar:1.43.3:compile
|  +- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
|  +- commons-logging:commons-logging:jar:1.2:compile
|  +- commons-codec:commons-codec:jar:1.15:compile
|  +- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
|  +- io.opencensus:opencensus-contrib-http-util:jar:0.31.1:compile
|  +- io.grpc:grpc-core:jar:1.56.1:compile
|  +- com.google.android:annotations:jar:4.1.1.4:runtime
|  +- org.codehaus.mojo:animal-sniffer-annotations:jar:1.23:runtime
|  +- io.perfmark:perfmark-api:jar:0.26.0:runtime
|  +- com.google.api.grpc:proto-google-iam-v1:jar:1.19.0:compile
|  +- com.google.errorprone:error_prone_annotations:jar:2.18.0:compile
|  +- com.google.api:api-common:jar:2.16.0:compile
|  +- com.google.auth:google-auth-library-oauth2-http:jar:1.19.0:compile
|  +- com.google.guava:guava:jar:32.1.2-jre:compile
|  +- com.google.protobuf:protobuf-java:jar:3.24.3:compile
|  +- com.google.api:gax:jar:2.33.0:compile
|  \- org.threeten:threetenbp:jar:1.6.8:compile
\- org.slf4j:slf4j-api:jar:1.7.36:compile

Describe the solution you'd like Provide a direct dependency which allow to configure logger using logback-json-appender.xml/StackdriverJsonLayout with minimal set of dependencies

meltsufin commented 1 year ago

Which specific dependencies would you make optional? Most of these are transitive.

amarkevich commented 1 year ago

Like

+- com.google.cloud:spring-cloud-gcp-logging
|  +- [API logger deps]
|  +- com.google.cloud:spring-cloud-gcp-logging-console
|  |  \- [console logger deps]

In case console-only logger spring-cloud-gcp-logging-console used to avoid unnecessary deps