nice-grpc-opentelemetry
Advanced tools
Comparing version 0.1.13 to 0.1.14
@@ -15,5 +15,5 @@ "use strict"; | ||
return { | ||
[semantic_conventions_1.SemanticAttributes.RPC_SYSTEM]: 'grpc', | ||
[semantic_conventions_1.SemanticAttributes.RPC_SERVICE]: service, | ||
[semantic_conventions_1.SemanticAttributes.RPC_METHOD]: method, | ||
[semantic_conventions_1.SEMATTRS_RPC_SYSTEM]: 'grpc', | ||
[semantic_conventions_1.SEMATTRS_RPC_SERVICE]: service, | ||
[semantic_conventions_1.SEMATTRS_RPC_METHOD]: method, | ||
}; | ||
@@ -27,3 +27,3 @@ } | ||
return { | ||
[semantic_conventions_1.SemanticAttributes.RPC_GRPC_STATUS_CODE]: status, | ||
[semantic_conventions_1.SEMATTRS_RPC_GRPC_STATUS_CODE]: status, | ||
'rpc.grpc.status_text': nice_grpc_common_1.Status[status], | ||
@@ -42,3 +42,3 @@ }; | ||
return { | ||
[semantic_conventions_1.SemanticAttributes.NET_PEER_NAME]: peer, | ||
[semantic_conventions_1.SEMATTRS_NET_PEER_NAME]: peer, | ||
}; | ||
@@ -50,3 +50,3 @@ } | ||
return { | ||
[semantic_conventions_1.SemanticAttributes.NET_PEER_NAME]: peer, | ||
[semantic_conventions_1.SEMATTRS_NET_PEER_NAME]: peer, | ||
}; | ||
@@ -56,9 +56,9 @@ } | ||
return { | ||
[semantic_conventions_1.SemanticAttributes.NET_PEER_IP]: host, | ||
[semantic_conventions_1.SemanticAttributes.NET_PEER_PORT]: port, | ||
[semantic_conventions_1.SEMATTRS_NET_PEER_IP]: host, | ||
[semantic_conventions_1.SEMATTRS_NET_PEER_PORT]: port, | ||
}; | ||
} | ||
return { | ||
[semantic_conventions_1.SemanticAttributes.NET_PEER_NAME]: host, | ||
[semantic_conventions_1.SemanticAttributes.NET_PEER_PORT]: port, | ||
[semantic_conventions_1.SEMATTRS_NET_PEER_NAME]: host, | ||
[semantic_conventions_1.SEMATTRS_NET_PEER_PORT]: port, | ||
}; | ||
@@ -65,0 +65,0 @@ } |
@@ -37,3 +37,3 @@ "use strict"; | ||
else { | ||
request = (0, traces_1.emitSpanEvents)(call.request, span, semantic_conventions_1.MessageTypeValues.SENT); | ||
request = (0, traces_1.emitSpanEvents)(call.request, span, semantic_conventions_1.MESSAGETYPEVALUES_SENT); | ||
} | ||
@@ -46,3 +46,3 @@ if (!call.responseStream) { | ||
else { | ||
yield* (0, traces_1.emitSpanEvents)(call.next(request, options), span, semantic_conventions_1.MessageTypeValues.RECEIVED); | ||
yield* (0, traces_1.emitSpanEvents)(call.next(request, options), span, semantic_conventions_1.MESSAGETYPEVALUES_RECEIVED); | ||
settled = true; | ||
@@ -49,0 +49,0 @@ return; |
@@ -10,7 +10,6 @@ "use strict"; | ||
const propagation_1 = require("./propagation"); | ||
const traces_1 = require("./traces"); | ||
const bindAsyncGenerator_1 = require("./utils/bindAsyncGenerator"); | ||
const traces_1 = require("./traces"); | ||
const traces_2 = require("./traces"); | ||
function openTelemetryServerMiddleware() { | ||
return (call, context) => traces_1.tracer.startActiveSpan((0, traces_2.getSpanName)(call.method.path), { | ||
return (call, context) => traces_1.tracer.startActiveSpan((0, traces_1.getSpanName)(call.method.path), { | ||
kind: api_1.SpanKind.SERVER, | ||
@@ -34,3 +33,3 @@ }, api_1.propagation.extract(api_1.ROOT_CONTEXT, context.metadata, propagation_1.metadataGetter), span => (0, bindAsyncGenerator_1.bindAsyncGenerator)(api_1.context.active(), openTelemetryServerMiddlewareGenerator(span, call, context))); | ||
else { | ||
request = (0, traces_2.emitSpanEvents)(call.request, span, semantic_conventions_1.MessageTypeValues.RECEIVED); | ||
request = (0, traces_1.emitSpanEvents)(call.request, span, semantic_conventions_1.MESSAGETYPEVALUES_RECEIVED); | ||
} | ||
@@ -41,3 +40,3 @@ if (!call.responseStream) { | ||
else { | ||
yield* (0, traces_2.emitSpanEvents)(call.next(request, context), span, semantic_conventions_1.MessageTypeValues.SENT); | ||
yield* (0, traces_1.emitSpanEvents)(call.next(request, context), span, semantic_conventions_1.MESSAGETYPEVALUES_SENT); | ||
return; | ||
@@ -44,0 +43,0 @@ } |
import { Span } from '@opentelemetry/api'; | ||
import { MessageTypeValues } from '@opentelemetry/semantic-conventions'; | ||
import { MESSAGETYPEVALUES_RECEIVED, MESSAGETYPEVALUES_SENT } from '@opentelemetry/semantic-conventions'; | ||
export declare const tracer: import("@opentelemetry/api").Tracer; | ||
@@ -20,2 +20,2 @@ /** | ||
*/ | ||
export declare function emitSpanEvents<T>(iterable: AsyncIterable<T>, span: Span, type: MessageTypeValues): AsyncIterable<T>; | ||
export declare function emitSpanEvents<T>(iterable: AsyncIterable<T>, span: Span, type: typeof MESSAGETYPEVALUES_SENT | typeof MESSAGETYPEVALUES_RECEIVED): AsyncIterable<T>; |
@@ -31,4 +31,4 @@ "use strict"; | ||
span.addEvent('message', { | ||
[semantic_conventions_1.SemanticAttributes.MESSAGE_TYPE]: type, | ||
[semantic_conventions_1.SemanticAttributes.MESSAGE_ID]: nextId++, | ||
[semantic_conventions_1.SEMATTRS_MESSAGE_TYPE]: type, | ||
[semantic_conventions_1.SEMATTRS_MESSAGE_ID]: nextId++, | ||
}); | ||
@@ -35,0 +35,0 @@ yield item; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "0.1.13"; | ||
export declare const VERSION = "0.1.14"; |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Generated by scripts/version.js | ||
exports.VERSION = '0.1.13'; | ||
exports.VERSION = '0.1.14'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "nice-grpc-opentelemetry", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"description": "OpenTelemetry instrumentation for nice-grpc", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@opentelemetry/sdk-node": "^0.41.1", | ||
"@opentelemetry/sdk-node": "^0.49.1", | ||
"@tsconfig/recommended": "^1.0.1", | ||
@@ -38,3 +38,3 @@ "@types/defer-promise": "^1.0.0", | ||
"grpc-tools": "^1.10.0", | ||
"nice-grpc": "^2.1.7", | ||
"nice-grpc": "^2.1.8", | ||
"protobufjs": "^7.1.2", | ||
@@ -44,4 +44,4 @@ "ts-proto": "^1.112.0" | ||
"dependencies": { | ||
"@opentelemetry/api": "^1.3.0", | ||
"@opentelemetry/semantic-conventions": "^1.5.0", | ||
"@opentelemetry/api": "^1.8.0", | ||
"@opentelemetry/semantic-conventions": "^1.22.0", | ||
"abort-controller-x": "^0.4.0", | ||
@@ -51,3 +51,3 @@ "ipaddr.js": "^2.0.1", | ||
}, | ||
"gitHead": "fa26b226f2ab9f5cdaae1773b0064d7d4c84544a" | ||
"gitHead": "2d8eccc332adbf869b6450efe5de14125d7cb4e6" | ||
} |
import {Attributes} from '@opentelemetry/api'; | ||
import {SemanticAttributes} from '@opentelemetry/semantic-conventions'; | ||
import { | ||
SEMATTRS_RPC_SYSTEM, | ||
SEMATTRS_RPC_SERVICE, | ||
SEMATTRS_RPC_METHOD, | ||
SEMATTRS_RPC_GRPC_STATUS_CODE, | ||
SEMATTRS_NET_PEER_NAME, | ||
SEMATTRS_NET_PEER_IP, | ||
SEMATTRS_NET_PEER_PORT, | ||
} from '@opentelemetry/semantic-conventions'; | ||
import * as ipaddr from 'ipaddr.js'; | ||
@@ -15,5 +23,5 @@ import {Status} from 'nice-grpc-common'; | ||
return { | ||
[SemanticAttributes.RPC_SYSTEM]: 'grpc', | ||
[SemanticAttributes.RPC_SERVICE]: service, | ||
[SemanticAttributes.RPC_METHOD]: method, | ||
[SEMATTRS_RPC_SYSTEM]: 'grpc', | ||
[SEMATTRS_RPC_SERVICE]: service, | ||
[SEMATTRS_RPC_METHOD]: method, | ||
}; | ||
@@ -27,3 +35,3 @@ } | ||
return { | ||
[SemanticAttributes.RPC_GRPC_STATUS_CODE]: status, | ||
[SEMATTRS_RPC_GRPC_STATUS_CODE]: status, | ||
'rpc.grpc.status_text': Status[status], | ||
@@ -43,3 +51,3 @@ }; | ||
return { | ||
[SemanticAttributes.NET_PEER_NAME]: peer, | ||
[SEMATTRS_NET_PEER_NAME]: peer, | ||
}; | ||
@@ -53,3 +61,3 @@ } | ||
return { | ||
[SemanticAttributes.NET_PEER_NAME]: peer, | ||
[SEMATTRS_NET_PEER_NAME]: peer, | ||
}; | ||
@@ -60,4 +68,4 @@ } | ||
return { | ||
[SemanticAttributes.NET_PEER_IP]: host, | ||
[SemanticAttributes.NET_PEER_PORT]: port, | ||
[SEMATTRS_NET_PEER_IP]: host, | ||
[SEMATTRS_NET_PEER_PORT]: port, | ||
}; | ||
@@ -67,5 +75,5 @@ } | ||
return { | ||
[SemanticAttributes.NET_PEER_NAME]: host, | ||
[SemanticAttributes.NET_PEER_PORT]: port, | ||
[SEMATTRS_NET_PEER_NAME]: host, | ||
[SEMATTRS_NET_PEER_PORT]: port, | ||
}; | ||
} |
@@ -8,3 +8,6 @@ import { | ||
} from '@opentelemetry/api'; | ||
import {MessageTypeValues} from '@opentelemetry/semantic-conventions'; | ||
import { | ||
MESSAGETYPEVALUES_RECEIVED, | ||
MESSAGETYPEVALUES_SENT, | ||
} from '@opentelemetry/semantic-conventions'; | ||
import {isAbortError} from 'abort-controller-x'; | ||
@@ -66,3 +69,3 @@ import { | ||
} else { | ||
request = emitSpanEvents(call.request, span, MessageTypeValues.SENT); | ||
request = emitSpanEvents(call.request, span, MESSAGETYPEVALUES_SENT); | ||
} | ||
@@ -80,3 +83,3 @@ | ||
span, | ||
MessageTypeValues.RECEIVED, | ||
MESSAGETYPEVALUES_RECEIVED, | ||
); | ||
@@ -83,0 +86,0 @@ |
@@ -9,3 +9,6 @@ import { | ||
} from '@opentelemetry/api'; | ||
import {MessageTypeValues} from '@opentelemetry/semantic-conventions'; | ||
import { | ||
MESSAGETYPEVALUES_RECEIVED, | ||
MESSAGETYPEVALUES_SENT, | ||
} from '@opentelemetry/semantic-conventions'; | ||
import {isAbortError} from 'abort-controller-x'; | ||
@@ -25,5 +28,4 @@ import { | ||
import {metadataGetter} from './propagation'; | ||
import {emitSpanEvents, getSpanName, tracer} from './traces'; | ||
import {bindAsyncGenerator} from './utils/bindAsyncGenerator'; | ||
import {tracer} from './traces'; | ||
import {emitSpanEvents, getSpanName} from './traces'; | ||
@@ -67,3 +69,3 @@ export function openTelemetryServerMiddleware(): ServerMiddleware { | ||
} else { | ||
request = emitSpanEvents(call.request, span, MessageTypeValues.RECEIVED); | ||
request = emitSpanEvents(call.request, span, MESSAGETYPEVALUES_RECEIVED); | ||
} | ||
@@ -77,3 +79,3 @@ | ||
span, | ||
MessageTypeValues.SENT, | ||
MESSAGETYPEVALUES_SENT, | ||
); | ||
@@ -80,0 +82,0 @@ |
import {Span, trace} from '@opentelemetry/api'; | ||
import { | ||
MessageTypeValues, | ||
SemanticAttributes, | ||
MESSAGETYPEVALUES_RECEIVED, | ||
MESSAGETYPEVALUES_SENT, | ||
SEMATTRS_MESSAGE_ID, | ||
SEMATTRS_MESSAGE_TYPE, | ||
} from '@opentelemetry/semantic-conventions'; | ||
@@ -32,3 +34,3 @@ import {VERSION} from './version'; | ||
span: Span, | ||
type: MessageTypeValues, | ||
type: typeof MESSAGETYPEVALUES_SENT | typeof MESSAGETYPEVALUES_RECEIVED, | ||
): AsyncIterable<T> { | ||
@@ -39,4 +41,4 @@ let nextId = 1; | ||
span.addEvent('message', { | ||
[SemanticAttributes.MESSAGE_TYPE]: type, | ||
[SemanticAttributes.MESSAGE_ID]: nextId++, | ||
[SEMATTRS_MESSAGE_TYPE]: type, | ||
[SEMATTRS_MESSAGE_ID]: nextId++, | ||
}); | ||
@@ -43,0 +45,0 @@ |
// Generated by scripts/version.js | ||
export const VERSION = '0.1.13'; | ||
export const VERSION = '0.1.14'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37298
680