@forwardimpact/librpc 0.1.110 → 0.1.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.js CHANGED
@@ -26,20 +26,20 @@ export const clients = exports.clients || {};
26
26
  * This factory should be called at startup in server.js files or when creating clients
27
27
  * @param {string} serviceName - Name of the service being traced
28
28
  * @returns {Promise<Tracer>} Configured tracer instance
29
- * @throws {Error} If trace service configuration cannot be loaded
29
+ * @throws {Error} If span service configuration cannot be loaded
30
30
  */
31
31
  export async function createTracer(serviceName) {
32
- const traceConfig = await createServiceConfig("trace");
33
- const { TraceClient } = clients;
32
+ const spanConfig = await createServiceConfig("span");
33
+ const { SpanClient } = clients;
34
34
  // createTracer is a composition-root factory; it builds the production
35
- // runtime as its DI root, threads it into the TraceClient (so the client's
35
+ // runtime as its DI root, threads it into the SpanClient (so the client's
36
36
  // auth reads SERVICE_SECRET off the bag) and into the Tracer (and thus every
37
37
  // Span) via its clock.
38
38
  const runtime = createDefaultRuntime();
39
- const traceClient = new TraceClient(traceConfig, runtime);
39
+ const spanClient = new SpanClient(spanConfig, runtime);
40
40
  return new Tracer({
41
41
  serviceName,
42
- traceClient,
42
+ spanClient,
43
43
  grpcMetadata: grpc.Metadata,
44
44
  clock: runtime.clock,
45
45
  });
@@ -1,50 +0,0 @@
1
- import { trace } from "@forwardimpact/libtype";
2
-
3
- /**
4
- * Pre-compiled gRPC service definition for Trace
5
- * Generated at build time
6
- */
7
- export const TraceServiceDefinition = {
8
- RecordSpan: {
9
- path: '/trace.Trace/RecordSpan',
10
- requestStream: false,
11
- responseStream: false,
12
- requestSerialize: (value) => {
13
- return Buffer.from(trace.Span.encode(value).finish());
14
- },
15
- requestDeserialize: (value) => {
16
- return trace.Span.toObject(
17
- trace.Span.decode(value)
18
- );
19
- },
20
- responseSerialize: (value) => {
21
- return Buffer.from(trace.RecordResponse.encode(value).finish());
22
- },
23
- responseDeserialize: (value) => {
24
- return trace.RecordResponse.toObject(
25
- trace.RecordResponse.decode(value)
26
- );
27
- },
28
- },
29
- QuerySpans: {
30
- path: '/trace.Trace/QuerySpans',
31
- requestStream: false,
32
- responseStream: false,
33
- requestSerialize: (value) => {
34
- return Buffer.from(trace.QueryRequest.encode(value).finish());
35
- },
36
- requestDeserialize: (value) => {
37
- return trace.QueryRequest.toObject(
38
- trace.QueryRequest.decode(value)
39
- );
40
- },
41
- responseSerialize: (value) => {
42
- return Buffer.from(trace.QueryResponse.encode(value).finish());
43
- },
44
- responseDeserialize: (value) => {
45
- return trace.QueryResponse.toObject(
46
- trace.QueryResponse.decode(value)
47
- );
48
- },
49
- },
50
- };