-
Notifications
You must be signed in to change notification settings - Fork 73
feat(obs): introduce gpc.client.repo and gcp.client.artifact span attributes #4111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
diegomarquezp
wants to merge
87
commits into
main
Choose a base branch
from
observability/tracing-attr/repo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
7082247
feat: introduce minimal implementation of OTel tracing
diegomarquezp bfe6a6d
chore: avoid new public methods
diegomarquezp ea6cb18
feat: add api tracer context
diegomarquezp 97bec08
Merge remote-tracking branch 'origin/main' into observability/initial…
diegomarquezp 097f701
chore: concise comment
diegomarquezp f547e5a
fix: use internal span kind for operations
diegomarquezp b7b9e31
chore: remove unnecessary inScope implementation
diegomarquezp 556c84c
Revert "chore: remove unnecessary inScope implementation"
diegomarquezp 0359b7d
test: add test for inScope()
diegomarquezp 402cb89
Merge remote-tracking branch 'origin/main' into observability/initial…
diegomarquezp 420278b
chore: use suggested server address resolution impl
diegomarquezp 6de9fb6
fix: use concurrent hash map
diegomarquezp a61dacf
chore: remove default impl for startSpan with parent
diegomarquezp b000d52
chore: add opentelemery-context to tests
diegomarquezp 9ce0c34
test: increase coverage for TracingTracerTest
diegomarquezp 9c6c737
deps: include opentelemetry context in gax
diegomarquezp e77de58
chore: simplify and remove error handling
diegomarquezp 8f07f61
chore: review refactor
diegomarquezp 2cfcd68
chore: make TracingTracerFactory(recorder, opAtts, atAtts) package pr…
diegomarquezp 2415c6b
chore: remove unnecessary inScope
diegomarquezp 0f5e9b5
chore: rename startSpan to createSpan
diegomarquezp 0c3bd22
chore: use server address instead of endpoint context
diegomarquezp bdeb291
chore: rename classes
diegomarquezp 5c07a3c
chore: add javadoc for tracer
diegomarquezp ff1d45d
chore: rename to TraceSpan, improve javadocs
diegomarquezp 043ce62
chore: format
diegomarquezp dbc5f41
Update gax-java/gax/src/main/java/com/google/api/gax/tracing/AppCentr…
diegomarquezp b4bce0d
chore: handle ipv6 in endpoint context
diegomarquezp 6e95cf4
Merge branch 'observability/initial-tracing-impl' of https://github.c…
diegomarquezp e873904
chore: add language tests
diegomarquezp 68943b0
chore: AppCentricTracer to implement interface
diegomarquezp ba3c080
feat(obs): generate gapic.properties file with repo property
diegomarquezp caead0d
feat: implement repo handling in gax
diegomarquezp 58f72d2
test: add tests for repo property
diegomarquezp 5a5d9d6
chore: speed up image building
diegomarquezp 015aa88
build: introduce repo property to generation config
diegomarquezp 0907e93
chore: update showcase module
diegomarquezp cd4d4d0
chore: revert operation implementation
diegomarquezp 5b76e40
chore: extract common span attributes to separate class
diegomarquezp c783d68
chore: remove unused var
diegomarquezp 1eeb197
Merge branch 'observability/initial-tracing-impl' into observability/…
diegomarquezp d2bd03c
chore(obs): use `Span` instead of `AppCentric` prefix for tracing
diegomarquezp 13f9bb3
Merge branch 'observability/rename-to-span' into observability/tracin…
diegomarquezp beee741
chore: use ApiTracerContext for this
diegomarquezp c2acaaf
feat: add ApiTracerContext client specific subclass generation
diegomarquezp c60da4c
chore: update goldens
diegomarquezp e3be9f4
chore: fix ApiTraceContext subclass generation
diegomarquezp da35f97
chore: regenerate showcase
diegomarquezp 2983e30
chore: fix default var in generate_library.sh
diegomarquezp f0e17ac
chore: infer server address directly from StubSettings
diegomarquezp 55e4be1
chore: adapt to stubsettings inferring server address
diegomarquezp 4aa17c4
chore: revert changes and pass server address from ClientContext
diegomarquezp 079d1f5
chore: update goldens
diegomarquezp 8601b76
chore: generate libraries at Fri Feb 20 18:31:23 UTC 2026
cloud-java-bot a0fcd28
chore: regenerate showcase
diegomarquezp 4b6e9ae
Merge branch 'observability/tracing-attr/repo' of https://github.com/…
diegomarquezp c413fbf
chore: fix type hint
diegomarquezp 63e6ee6
chore: optimize for reliability scanner
diegomarquezp bac45b3
chore: delete old class
diegomarquezp f3f14c9
chore: simplify apitracercontext
diegomarquezp 2357560
chore: simplify apitracercontext
diegomarquezp d3546de
chore: initial impl of GapicProperties
diegomarquezp 575069d
chore: use abstract class approach
diegomarquezp 8665e44
chore: adapt generator
diegomarquezp ef26cd5
chore: update goldens
diegomarquezp 3f88605
chore: add golden test for gapic properties
diegomarquezp 954d195
chore: introduce artifact name
diegomarquezp cb76dfc
chore: rename AppCentricAttributes to ObservabilityAttributes
diegomarquezp 282d1f5
chore: format
diegomarquezp 47fc594
Merge branch 'observability/rename-to-span' into observability/tracin…
diegomarquezp 121da5e
chore: include artifact in hermetic build
diegomarquezp f5eeec9
chore: use artifact and group id
diegomarquezp 0d048c2
chore: reformat
diegomarquezp 7d68462
chore: update showcase
diegomarquezp 7856db6
chore: remove unused class
diegomarquezp 8eb7495
chore: remove unused class
diegomarquezp 2762873
chore: rename fn arg
diegomarquezp e1d62b7
chore: flatten class name logic
diegomarquezp a68cbba
chore: generate libraries at Mon Feb 23 21:54:25 UTC 2026
cloud-java-bot 66f0566
chore: fix copyright year
diegomarquezp fd4829f
chore: simplify ApiTracerContext
diegomarquezp 39c2014
test: test artifact in plugin argument parser
diegomarquezp 4df72b3
chore: remove unused class
diegomarquezp 55a9076
chore: remove old goldens
diegomarquezp 36991a2
Merge branch 'observability/tracing-attr/repo' of https://github.com/…
diegomarquezp fc34de5
chore: update goldens
diegomarquezp 9a35625
Merge branch 'main' into observability/tracing-attr/repo
diegomarquezp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
121 changes: 121 additions & 0 deletions
121
...ain/java/com/google/api/generator/gapic/composer/common/GapicPropertiesClassComposer.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * 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 com.google.api.generator.gapic.composer.common; | ||
|
|
||
| import com.google.api.core.InternalApi; | ||
| import com.google.api.gax.core.GaxProperties; | ||
| import com.google.api.gax.rpc.AbstractGapicProperties; | ||
| import com.google.api.generator.engine.ast.AnnotationNode; | ||
| import com.google.api.generator.engine.ast.ClassDefinition; | ||
| import com.google.api.generator.engine.ast.Expr; | ||
| import com.google.api.generator.engine.ast.MethodDefinition; | ||
| import com.google.api.generator.engine.ast.ScopeNode; | ||
| import com.google.api.generator.engine.ast.StringObjectValue; | ||
| import com.google.api.generator.engine.ast.TypeNode; | ||
| import com.google.api.generator.engine.ast.ValueExpr; | ||
| import com.google.api.generator.gapic.composer.store.TypeStore; | ||
| import com.google.api.generator.gapic.model.GapicClass; | ||
| import com.google.api.generator.gapic.model.GapicContext; | ||
| import com.google.api.generator.gapic.model.Service; | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import javax.annotation.Generated; | ||
|
|
||
| public class GapicPropertiesClassComposer implements ClassComposer { | ||
| private static final GapicPropertiesClassComposer INSTANCE = new GapicPropertiesClassComposer(); | ||
|
|
||
| private static final TypeStore FIXED_TYPESTORE = createStaticTypes(); | ||
|
|
||
| private GapicPropertiesClassComposer() {} | ||
|
|
||
| public static GapicPropertiesClassComposer instance() { | ||
| return INSTANCE; | ||
| } | ||
|
|
||
| @Override | ||
| public GapicClass generate(GapicContext context, Service service) { | ||
| String pakkage = service.pakkage(); | ||
| String className = "GapicProperties"; | ||
|
|
||
| ClassDefinition classDef = | ||
| ClassDefinition.builder() | ||
| .setPackageString(pakkage) | ||
| .setAnnotations(createClassAnnotations()) | ||
| .setScope(ScopeNode.PUBLIC) | ||
| .setName(className) | ||
| .setExtendsType(FIXED_TYPESTORE.get("AbstractGapicProperties")) | ||
| .setMethods(createClassMethods(context)) | ||
| .build(); | ||
|
|
||
| return GapicClass.create(GapicClass.Kind.MAIN, classDef); | ||
| } | ||
|
|
||
| private static List<AnnotationNode> createClassAnnotations() { | ||
| return Arrays.asList( | ||
| AnnotationNode.withType(FIXED_TYPESTORE.get("InternalApi")), | ||
| AnnotationNode.builder() | ||
| .setType(FIXED_TYPESTORE.get("Generated")) | ||
| .setDescription("by gapic-generator-java") | ||
| .build()); | ||
| } | ||
|
|
||
| private List<MethodDefinition> createClassMethods(GapicContext context) { | ||
| List<MethodDefinition> methods = new ArrayList<>(); | ||
| methods.add(createGetRepositoryMethod(context)); | ||
| methods.add(createGetArtifactNameMethod(context)); | ||
| return methods; | ||
| } | ||
|
|
||
| private MethodDefinition createGetRepositoryMethod(GapicContext context) { | ||
| Expr returnExpr = ValueExpr.createNullExpr(); | ||
| if (context.repo().isPresent()) { | ||
| returnExpr = ValueExpr.withValue(StringObjectValue.withValue(context.repo().orElse(null))); | ||
| } | ||
| return MethodDefinition.builder() | ||
| .setIsOverride(true) | ||
| .setScope(ScopeNode.PUBLIC) | ||
| .setReturnType(TypeNode.STRING) | ||
| .setName("getRepository") | ||
| .setReturnExpr(returnExpr) | ||
| .build(); | ||
| } | ||
|
|
||
| private MethodDefinition createGetArtifactNameMethod(GapicContext context) { | ||
| Expr returnExpr = ValueExpr.createNullExpr(); | ||
| if (context.artifact().isPresent()) { | ||
| returnExpr = | ||
| ValueExpr.withValue(StringObjectValue.withValue(context.artifact().orElse(null))); | ||
| } | ||
| return MethodDefinition.builder() | ||
| .setIsOverride(true) | ||
| .setScope(ScopeNode.PUBLIC) | ||
| .setReturnType(TypeNode.STRING) | ||
| .setName("getArtifactName") | ||
| .setReturnExpr(returnExpr) | ||
| .build(); | ||
| } | ||
|
|
||
| private static TypeStore createStaticTypes() { | ||
| return new TypeStore( | ||
| Arrays.asList( | ||
| InternalApi.class, | ||
| Generated.class, | ||
| AbstractGapicProperties.class, | ||
| GaxProperties.class)); | ||
| } | ||
| } |
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
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
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
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
35 changes: 35 additions & 0 deletions
35
...java/com/google/api/generator/gapic/composer/common/GapicPropertiesClassComposerTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Copyright 2026 Google LLC | ||
| * | ||
| * 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 com.google.api.generator.gapic.composer.common; | ||
|
|
||
| import com.google.api.generator.gapic.model.GapicClass; | ||
| import com.google.api.generator.gapic.model.GapicContext; | ||
| import com.google.api.generator.gapic.model.Service; | ||
| import com.google.api.generator.test.framework.Assert; | ||
| import com.google.api.generator.test.protoloader.GrpcTestProtoLoader; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class GapicPropertiesClassComposerTest { | ||
| @Test | ||
| void generateGapicPropertiesClass() { | ||
| GapicContext context = GrpcTestProtoLoader.instance().parseShowcaseEcho(); | ||
| Service service = context.services().get(0); | ||
| GapicClass clazz = GapicPropertiesClassComposer.instance().generate(context, service); | ||
|
|
||
| Assert.assertGoldenClass(this.getClass(), clazz, "GapicProperties.golden"); | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
...c/test/java/com/google/api/generator/gapic/composer/common/goldens/GapicProperties.golden
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.google.showcase.v1beta1; | ||
|
|
||
| import com.google.api.core.InternalApi; | ||
| import com.google.api.gax.rpc.AbstractGapicProperties; | ||
| import javax.annotation.Generated; | ||
|
|
||
| @InternalApi | ||
| @Generated("by gapic-generator-java") | ||
| public class GapicProperties extends AbstractGapicProperties { | ||
|
|
||
| @Override | ||
| public String getRepository() { | ||
| return "googleapis/sdk-platform-java"; | ||
| } | ||
|
|
||
| @Override | ||
| public String getArtifactName() { | ||
| return "com.google.cloud:gapic-showcase"; | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.