Skip to content

Commit f33bbdd

Browse files
committed
fix: rename
1 parent 944d05c commit f33bbdd

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/tracing/GoldenSignalsMetricsTracer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,22 @@ class GoldenSignalsMetricsTracer implements ApiTracer {
7575
*/
7676
@Override
7777
public void operationSucceeded() {
78-
recordError(null);
78+
recordMetric(null);
7979
}
8080

8181
@Override
8282
public void operationCancelled() {
83-
recordError(new CancellationException());
83+
recordMetric(new CancellationException());
8484
}
8585

8686
@Override
8787
public void operationFailed(Throwable error) {
88-
recordError(error);
88+
recordMetric(error);
8989
}
9090

91-
private void recordError(Throwable error) {
91+
private void recordMetric(Throwable error) {
9292
Map<String, Object> errorAttributes =
93-
ObservabilityUtils.getErrorAttributes(error, transport);
93+
ObservabilityUtils.getResponseAttributes(error, transport);
9494
attributes.putAll(errorAttributes);
9595
metricsRecorder.recordOperationLatency(
9696
clientRequestTimer.elapsed(TimeUnit.NANOSECONDS) / 1_000_000_000.0, attributes);

sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/tracing/ObservabilityUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private static String redactSensitiveQueryValues(final String rawQuery) {
171171
return Joiner.on('&').join(redactedParams);
172172
}
173173

174-
static Map<String, Object> getErrorAttributes(
174+
static Map<String, Object> getResponseAttributes(
175175
@Nullable Throwable error, ApiTracerContext.Transport transport) {
176176
Map<String, Object> attributes = new HashMap<>();
177177
StatusCode.Code code = extractStatus(error);

sdk-platform-java/gax-java/gax/src/main/java/com/google/api/gax/tracing/SpanTracer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ private void recordErrorAndEndAttempt(Throwable error) {
218218
return;
219219
}
220220
Map<String, Object> errorAttributes =
221-
ObservabilityUtils.getErrorAttributes(error, this.apiTracerContext.transport());
221+
ObservabilityUtils.getResponseAttributes(error, this.apiTracerContext.transport());
222222
if (!errorAttributes.isEmpty()) {
223223
attemptSpan.setAllAttributes(ObservabilityUtils.toOtelAttributes(errorAttributes));
224224
}

sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/tracing/ObservabilityUtilsTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,44 +115,44 @@ void testToOtelAttributes_shouldMapIntAttributes() {
115115
}
116116

117117
@Test
118-
void testGetErrorAttributes_grpc_success() {
118+
void testGetResponseAttributes_grpc_success() {
119119
Map<String, Object> attributes =
120-
ObservabilityUtils.getErrorAttributes(null, ApiTracerContext.Transport.GRPC);
120+
ObservabilityUtils.getResponseAttributes(null, ApiTracerContext.Transport.GRPC);
121121
assertThat(attributes)
122122
.containsEntry(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE, "OK");
123123
}
124124

125125
@Test
126-
void testGetErrorAttributes_grpc_apiException() {
126+
void testGetResponseAttributes_grpc_apiException() {
127127
ApiException error =
128128
new ApiException("fake_error", null, new FakeStatusCode(StatusCode.Code.NOT_FOUND), false);
129129
Map<String, Object> attributes =
130-
ObservabilityUtils.getErrorAttributes(error, ApiTracerContext.Transport.GRPC);
130+
ObservabilityUtils.getResponseAttributes(error, ApiTracerContext.Transport.GRPC);
131131
assertThat(attributes)
132132
.containsEntry(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE, "NOT_FOUND");
133133
}
134134

135135
@Test
136-
void testGetErrorAttributes_grpc_cancellationException() {
136+
void testGetResponseAttributes_grpc_cancellationException() {
137137
Throwable error = new java.util.concurrent.CancellationException();
138138
Map<String, Object> attributes =
139-
ObservabilityUtils.getErrorAttributes(error, ApiTracerContext.Transport.GRPC);
139+
ObservabilityUtils.getResponseAttributes(error, ApiTracerContext.Transport.GRPC);
140140
assertThat(attributes)
141141
.containsEntry(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE, "CANCELLED");
142142
}
143143

144144
@Test
145-
void testGetErrorAttributes_http_success() {
145+
void testGetResponseAttributes_http_success() {
146146
Map<String, Object> attributes =
147-
ObservabilityUtils.getErrorAttributes(null, ApiTracerContext.Transport.HTTP);
147+
ObservabilityUtils.getResponseAttributes(null, ApiTracerContext.Transport.HTTP);
148148
assertThat(attributes)
149149
.containsEntry(
150150
ObservabilityAttributes.HTTP_RESPONSE_STATUS_ATTRIBUTE,
151151
(long) StatusCode.Code.OK.getHttpStatusCode());
152152
}
153153

154154
@Test
155-
void testGetErrorAttributes_http_apiExceptionWithIntegerTransportCode() {
155+
void testGetResponseAttributes_http_apiExceptionWithIntegerTransportCode() {
156156
ApiException error =
157157
new ApiException(
158158
"fake_error",
@@ -170,15 +170,15 @@ public Object getTransportCode() {
170170
},
171171
false);
172172
Map<String, Object> attributes =
173-
ObservabilityUtils.getErrorAttributes(error, ApiTracerContext.Transport.HTTP);
173+
ObservabilityUtils.getResponseAttributes(error, ApiTracerContext.Transport.HTTP);
174174
assertThat(attributes)
175175
.containsEntry(
176176
ObservabilityAttributes.HTTP_RESPONSE_STATUS_ATTRIBUTE,
177177
(long) StatusCode.Code.NOT_FOUND.getHttpStatusCode());
178178
}
179179

180180
@Test
181-
void testGetErrorAttributes_http_apiExceptionWithNonIntegerTransportCode() {
181+
void testGetResponseAttributes_http_apiExceptionWithNonIntegerTransportCode() {
182182
ApiException error =
183183
new ApiException(
184184
"fake_error",
@@ -196,18 +196,18 @@ public Object getTransportCode() {
196196
},
197197
false);
198198
Map<String, Object> attributes =
199-
ObservabilityUtils.getErrorAttributes(error, ApiTracerContext.Transport.HTTP);
199+
ObservabilityUtils.getResponseAttributes(error, ApiTracerContext.Transport.HTTP);
200200
assertThat(attributes)
201201
.containsEntry(
202202
ObservabilityAttributes.HTTP_RESPONSE_STATUS_ATTRIBUTE,
203203
(long) StatusCode.Code.NOT_FOUND.getHttpStatusCode());
204204
}
205205

206206
@Test
207-
void testGetErrorAttributes_http_cancellationException() {
207+
void testGetResponseAttributes_http_cancellationException() {
208208
Throwable error = new java.util.concurrent.CancellationException();
209209
Map<String, Object> attributes =
210-
ObservabilityUtils.getErrorAttributes(error, ApiTracerContext.Transport.HTTP);
210+
ObservabilityUtils.getResponseAttributes(error, ApiTracerContext.Transport.HTTP);
211211
assertThat(attributes)
212212
.containsEntry(
213213
ObservabilityAttributes.HTTP_RESPONSE_STATUS_ATTRIBUTE,

0 commit comments

Comments
 (0)