Skip to content

Comments

feat(obs): introduce gpc.client.repo span attribute#4111

Draft
diegomarquezp wants to merge 61 commits intomainfrom
observability/tracing-attr/repo
Draft

feat(obs): introduce gpc.client.repo span attribute#4111
diegomarquezp wants to merge 61 commits intomainfrom
observability/tracing-attr/repo

Conversation

@diegomarquezp
Copy link
Contributor

  • feat(obs): generate gapic.properties file with repo property
  • feat: implement repo handling in gax
  • test: add tests for repo property
  • chore: speed up image building
  • build: introduce repo property to generation config
  • chore: update showcase module

diegomarquezp and others added 30 commits February 4, 2026 14:34
 - Rename SpanHandle to GaxSpan
 - Simplify adding op and attempt attributes
 - Use HashMap instead of ConcurrentHashMap
 - Remove error handling (for now)
…icTracer.java

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new gpc.client.repo span attribute for observability, propagating repository information from build configuration to tracing spans. However, a significant logic error exists where telemetry keys are swapped, leading to data corruption in audit logs. Furthermore, vulnerabilities related to insecure data handling (property injection and option injection) have been identified in the code processing repository information. There is also a high-severity bug in a build script and a medium-severity opportunity for code simplification using modern Java features.

Comment on lines +57 to +59
static Optional<String> parseRepo(CodeGeneratorRequest request) {
return parseConfigArgument(request.getParameter(), KEY_REPO);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The parseRepo method uses parseConfigArgument, which parses plugin arguments by splitting the input string by commas. If the repo value contains a comma, it will be split, potentially allowing an attacker to inject additional plugin flags or options (e.g., injecting ,metadata to enable metadata generation).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's how the argument parser will work. If repo contains a comma then what's after the comma will be ignored and treated as a sperate flag not handled by the generator.

Base automatically changed from observability/initial-tracing-impl to main February 17, 2026 17:01
@diegomarquezp
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new span attribute gpc.client.repo to include repository information in traces. This is achieved by adding a --repo flag to the generator, which is then passed through the build process and used to generate a service-specific ApiTracerContext class. The GAX library is updated to use this new context. The changes are well-implemented and include necessary tests and updates to golden files. I've found one minor issue with a type hint in a Python script, which I've commented on.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'java_showcase_integration_tests'

Failed conditions
65.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: l Pull request size is large. wip Work in Progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants