Skip to content

Commit

Permalink
chore: apply formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas committed Dec 1, 2022
1 parent dfb059c commit 242b569
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ export function makeGrpcClientRemoteCall(
if (err) {
if (err.code) {
span.setStatus(_grpcStatusCodeToSpanStatus(err.code));
span.setAttribute(
SemanticAttributes.RPC_GRPC_STATUS_CODE,
err.code
);
span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code);
}
span.setAttributes({
[AttributeNames.GRPC_ERROR_NAME]: err.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ function clientStreamAndUnaryHandler<RequestType, ResponseType>(
code: _grpcStatusCodeToOpenTelemetryStatusCode(err.code),
message: err.message,
});
span.setAttribute(
SemanticAttributes.RPC_GRPC_STATUS_CODE,
err.code
);
span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code);
}
span.setAttributes({
[AttributeNames.GRPC_ERROR_NAME]: err.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ import type * as grpcTypes from 'grpc';
import type * as events from 'events';
import { SendUnaryDataCallback, GrpcClientFunc } from './types';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
import {
context,
Span,
SpanStatusCode,
propagation,
} from '@opentelemetry/api';
import { context, Span, SpanStatusCode, propagation } from '@opentelemetry/api';
import {
_grpcStatusCodeToSpanStatus,
_grpcStatusCodeToOpenTelemetryStatusCode,
Expand Down Expand Up @@ -56,10 +51,7 @@ export const makeGrpcClientRemoteCall = function (
if (err) {
if (err.code) {
span.setStatus(_grpcStatusCodeToSpanStatus(err.code));
span.setAttribute(
SemanticAttributes.RPC_GRPC_STATUS_CODE,
err.code
);
span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code);
}
span.setAttributes({
[AttributeNames.GRPC_ERROR_NAME]: err.name,
Expand Down Expand Up @@ -133,8 +125,11 @@ export const makeGrpcClientRemoteCall = function (
[AttributeNames.GRPC_ERROR_NAME]: err.name,
[AttributeNames.GRPC_ERROR_MESSAGE]: err.message,
});
if(err.code != null) {
span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code);
if (err.code != null) {
span.setAttribute(
SemanticAttributes.RPC_GRPC_STATUS_CODE,
err.code
);
}
endSpan();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ export const clientStreamAndUnaryHandler = function <RequestType, ResponseType>(
code: _grpcStatusCodeToOpenTelemetryStatusCode(err.code),
message: err.message,
});
span.setAttribute(
SemanticAttributes.RPC_GRPC_STATUS_CODE,
err.code
);
span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code);
}
span.setAttributes({
[AttributeNames.GRPC_ERROR_NAME]: err.name,
Expand Down Expand Up @@ -114,7 +111,7 @@ export const serverStreamAndBidiHandler = function <RequestType, ResponseType>(
[AttributeNames.GRPC_ERROR_NAME]: err.name,
[AttributeNames.GRPC_ERROR_MESSAGE]: err.message,
});
if(err.code != null) {
if (err.code != null) {
span.setAttribute(SemanticAttributes.RPC_GRPC_STATUS_CODE, err.code);
}
endSpan();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ export const assertSpan = (
span.status.code,
grpcStatusCodeToOpenTelemetryStatusCode(validations.status)
);
assert.strictEqual(span.attributes[SemanticAttributes.RPC_GRPC_STATUS_CODE], validations.status);
assert.strictEqual(
span.attributes[SemanticAttributes.RPC_GRPC_STATUS_CODE],
validations.status
);
};

// Check if sourceSpan was propagated to targetSpan
Expand Down

0 comments on commit 242b569

Please sign in to comment.