refactor: reuse main java/proto sources from base modules in *-otel-* examples - #458
Merged
Merged
Conversation
Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
…modules All 4 gRPC otel modules (gcp-grpc-spring-otel-agent-example, gcp-grpc-spring-otel-starter-example, gcp-grpc-spring-without-test-artifacts-otel-agent-example, gcp-grpc-spring-without-test-artifacts-otel-starter-example) now import their main java/proto/resources from gcp-grpc-spring-without-test-artifacts-example via sourceSets, removing duplicate sources. Both web without-test-artifacts otel modules now import their main java from gcp-web-without-test-artifacts-example. The otel-agent module also imports resources (they are identical to base). The otel-starter module keeps its own resources/application.properties (contains otel-specific management.tracing properties). gcp-web-without-test-artifacts-example DocumentEndpoint.java updated to include MDC logging (logger.info with MDC.getCopyOfContextMap()) which is present in all otel variants and is useful generally. Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
skjolber
August 15, 2026 23:54
View session
Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
…e-java-proto-sources # Conflicts: # examples/gcp-grpc-spring-otel-agent-example/build.gradle # examples/gcp-grpc-spring-otel-starter-example/build.gradle # examples/gcp-grpc-spring-without-test-artifacts-otel-agent-example/build.gradle # examples/gcp-grpc-spring-without-test-artifacts-otel-starter-example/build.gradle # examples/gcp-web-otel-agent-example/src/main/java/org/entur/example/web/rest/DocumentEndpoint.java # examples/gcp-web-otel-starter-example/src/main/java/org/entur/example/web/rest/DocumentEndpoint.java # examples/gcp-web-without-test-artifacts-example/build.gradle # examples/gcp-web-without-test-artifacts-otel-agent-example/build.gradle # examples/gcp-web-without-test-artifacts-otel-starter-example/build.gradle Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
…s after merge Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 6 new
*-otel-*example modules introduced in PR #450 duplicated theirsrc/mainsources verbatim fromgcp-grpc-spring-without-test-artifacts-exampleandgcp-web-without-test-artifacts-example. This replaces those copies with cross-projectsourceSetsimports.gRPC otel modules (×4) — full import
All four modules had sources 100% identical to
gcp-grpc-spring-without-test-artifacts-example.src/main/{java,proto,resources}deleted; imported viasourceSets:Applies to:
gcp-grpc-spring-otel-{agent,starter}-exampleandgcp-grpc-spring-without-test-artifacts-otel-{agent,starter}-example.Web without-test-artifacts otel modules (×2) — java import
gcp-web-without-test-artifacts-otel-agent-example: imports main java + resources from base (identical after the fix below)gcp-web-without-test-artifacts-otel-starter-example: imports main java; keeps its ownapplication.properties(addsmanagement.tracing.*properties required by the OTel Spring Boot starter)Base web module alignment
gcp-web-without-test-artifacts-example/DocumentEndpoint.javaupdated to log the MDC context map — a line already present in all otel variants, useful regardless of OTel. Uses SLF4J parameterised logging ({}); same fix applied to the two remaining web otelDocumentEndpointcopies that are not yet deduplicated.Not included
gcp-web-otel-{agent,starter}-examplehave extra classes (RestClientConfig,UserIdEnricherFilter,DummyEndpoint, etc.) and diverged versions ofWebSecurityConfig/DocumentEndpointvs the base — a clean import would require restructuring those source trees and is deferred.