File tree Expand file tree Collapse file tree
gax-java/gax/src/test/java/com/google/api/gax/tracing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,6 +74,17 @@ void testGetAttemptAttributes_artifact() {
7474 .containsEntry (ObservabilityAttributes .ARTIFACT_ATTRIBUTE , "test-artifact" );
7575 }
7676
77+ @ Test
78+ void testGetAttemptAttributes_version () {
79+ LibraryMetadata libraryMetadata =
80+ LibraryMetadata .newBuilder ().setLibraryVersion ("1.2.3" ).build ();
81+ ApiTracerContext context =
82+ ApiTracerContext .newBuilder ().setLibraryMetadata (libraryMetadata ).build ();
83+ Map <String , Object > attributes = context .getAttemptAttributes ();
84+
85+ assertThat (attributes ).containsEntry (ObservabilityAttributes .VERSION_ATTRIBUTE , "1.2.3" );
86+ }
87+
7788 @ Test
7889 void testGetAttemptAttributes_fullMethodName_noTransport_notPresent () {
7990 ApiTracerContext context =
@@ -125,7 +136,11 @@ void testGetAttemptAttributes_empty() {
125136 @ Test
126137 void testGetAttemptAttributes_emptyStrings () {
127138 LibraryMetadata libraryMetadata =
128- LibraryMetadata .newBuilder ().setRepository ("" ).setArtifactName ("" ).build ();
139+ LibraryMetadata .newBuilder ()
140+ .setRepository ("" )
141+ .setArtifactName ("" )
142+ .setLibraryVersion ("" )
143+ .build ();
129144 ApiTracerContext context =
130145 ApiTracerContext .newBuilder ()
131146 .setLibraryMetadata (libraryMetadata )
You can’t perform that action at this time.
0 commit comments