@replit/river 0.19.3 → 0.20.1
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/README.md +2 -0
- package/dist/{chunk-XAG3SC7R.js → chunk-3AW3IXVD.js} +4 -2
- package/dist/chunk-3AW3IXVD.js.map +1 -0
- package/dist/{chunk-2Z2NE47H.js → chunk-5WFL722S.js} +15 -2
- package/dist/chunk-5WFL722S.js.map +1 -0
- package/dist/{chunk-SLYSDRLE.js → chunk-DP5X7CCT.js} +517 -260
- package/dist/chunk-DP5X7CCT.js.map +1 -0
- package/dist/{chunk-YHKIWQOC.js → chunk-FNK44ZN3.js} +2 -2
- package/dist/{chunk-LDCCELCJ.js → chunk-MJR36SUY.js} +8 -3
- package/dist/{chunk-LDCCELCJ.js.map → chunk-MJR36SUY.js.map} +1 -1
- package/dist/{chunk-QZD2UTDJ.js → chunk-QU2EE6YU.js} +384 -246
- package/dist/chunk-QU2EE6YU.js.map +1 -0
- package/dist/codec/index.cjs +3 -1
- package/dist/codec/index.cjs.map +1 -1
- package/dist/codec/index.js +1 -1
- package/dist/{connection-cfec12e6.d.ts → connection-d49d5d56.d.ts} +1 -1
- package/dist/{connection-aa0ea000.d.ts → connection-dba95bc8.d.ts} +1 -1
- package/dist/{index-e2513701.d.ts → index-3ac92295.d.ts} +12 -0
- package/dist/logging/index.d.cts +1 -1
- package/dist/logging/index.d.ts +1 -1
- package/dist/router/index.cjs +514 -257
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +4 -4
- package/dist/router/index.d.ts +4 -4
- package/dist/router/index.js +2 -2
- package/dist/{services-5fc5712d.d.ts → services-8496d6e8.d.ts} +1 -1
- package/dist/{services-4bba42d8.d.ts → services-abc077db.d.ts} +1 -1
- package/dist/transport/impls/uds/client.cjs +156 -75
- package/dist/transport/impls/uds/client.cjs.map +1 -1
- package/dist/transport/impls/uds/client.d.cts +2 -2
- package/dist/transport/impls/uds/client.d.ts +2 -2
- package/dist/transport/impls/uds/client.js +4 -4
- package/dist/transport/impls/uds/server.cjs +255 -170
- package/dist/transport/impls/uds/server.cjs.map +1 -1
- package/dist/transport/impls/uds/server.d.cts +2 -2
- package/dist/transport/impls/uds/server.d.ts +2 -2
- package/dist/transport/impls/uds/server.js +4 -4
- package/dist/transport/impls/ws/client.cjs +150 -74
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +2 -2
- package/dist/transport/impls/ws/client.d.ts +2 -2
- package/dist/transport/impls/ws/client.js +4 -4
- package/dist/transport/impls/ws/server.cjs +249 -169
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +2 -2
- package/dist/transport/impls/ws/server.d.ts +2 -2
- package/dist/transport/impls/ws/server.js +4 -4
- package/dist/transport/index.cjs +387 -243
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +3 -2
- package/dist/transport/index.d.ts +3 -2
- package/dist/transport/index.js +3 -3
- package/dist/util/testHelpers.cjs +1 -0
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +2 -2
- package/dist/util/testHelpers.d.ts +2 -2
- package/dist/util/testHelpers.js +4 -4
- package/package.json +2 -1
- package/dist/chunk-2Z2NE47H.js.map +0 -1
- package/dist/chunk-QZD2UTDJ.js.map +0 -1
- package/dist/chunk-SLYSDRLE.js.map +0 -1
- package/dist/chunk-XAG3SC7R.js.map +0 -1
- /package/dist/{chunk-YHKIWQOC.js.map → chunk-FNK44ZN3.js.map} +0 -0
package/dist/router/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError, S as ServiceContext } from '../services-
|
|
2
|
-
export { C as Client, E as Err, O as Ok, B as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l as ProcType, a as Procedure, o as ProcedureMap, d as ProcedureResult, p as RPCProcedure, z as ResultUnwrapErr, y as ResultUnwrapOk, x as RiverErrorSchema, c as RiverUncaughtSchema, n as SerializedServerSchema, e as Service, f as ServiceConfiguration, u as ServiceContextWithState, v as ServiceContextWithTransportInfo, m as ServiceSchema, r as StreamProcedure, q as SubscriptionProcedure, w as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, t as createClient, s as serializeSchema } from '../services-
|
|
1
|
+
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError, S as ServiceContext } from '../services-abc077db.js';
|
|
2
|
+
export { C as Client, E as Err, O as Ok, B as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l as ProcType, a as Procedure, o as ProcedureMap, d as ProcedureResult, p as RPCProcedure, z as ResultUnwrapErr, y as ResultUnwrapOk, x as RiverErrorSchema, c as RiverUncaughtSchema, n as SerializedServerSchema, e as Service, f as ServiceConfiguration, u as ServiceContextWithState, v as ServiceContextWithTransportInfo, m as ServiceSchema, r as StreamProcedure, q as SubscriptionProcedure, w as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, t as createClient, s as serializeSchema } from '../services-abc077db.js';
|
|
3
3
|
import { Static } from '@sinclair/typebox';
|
|
4
4
|
import { ServerTransport } from '../transport/index.cjs';
|
|
5
5
|
import { Pushable } from 'it-pushable';
|
|
6
|
-
import { C as Connection } from '../index-
|
|
6
|
+
import { C as Connection } from '../index-3ac92295.js';
|
|
7
7
|
import '../types-3e5768ec.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -36,6 +36,6 @@ interface ProcStream {
|
|
|
36
36
|
*/
|
|
37
37
|
declare function createServer<Services extends AnyServiceSchemaMap>(transport: ServerTransport<Connection>, services: Services, extendedContext?: Omit<ServiceContext, 'state'>): Server<Services>;
|
|
38
38
|
|
|
39
|
-
var version = "0.
|
|
39
|
+
var version = "0.20.1";
|
|
40
40
|
|
|
41
41
|
export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError, S as ServiceContext } from '../services-
|
|
2
|
-
export { C as Client, E as Err, O as Ok, B as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l as ProcType, a as Procedure, o as ProcedureMap, d as ProcedureResult, p as RPCProcedure, z as ResultUnwrapErr, y as ResultUnwrapOk, x as RiverErrorSchema, c as RiverUncaughtSchema, n as SerializedServerSchema, e as Service, f as ServiceConfiguration, u as ServiceContextWithState, v as ServiceContextWithTransportInfo, m as ServiceSchema, r as StreamProcedure, q as SubscriptionProcedure, w as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, t as createClient, s as serializeSchema } from '../services-
|
|
1
|
+
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError, S as ServiceContext } from '../services-8496d6e8.js';
|
|
2
|
+
export { C as Client, E as Err, O as Ok, B as Output, k as ProcErrors, g as ProcHandler, h as ProcInit, i as ProcInput, j as ProcOutput, l as ProcType, a as Procedure, o as ProcedureMap, d as ProcedureResult, p as RPCProcedure, z as ResultUnwrapErr, y as ResultUnwrapOk, x as RiverErrorSchema, c as RiverUncaughtSchema, n as SerializedServerSchema, e as Service, f as ServiceConfiguration, u as ServiceContextWithState, v as ServiceContextWithTransportInfo, m as ServiceSchema, r as StreamProcedure, q as SubscriptionProcedure, w as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, t as createClient, s as serializeSchema } from '../services-8496d6e8.js';
|
|
3
3
|
import { Static } from '@sinclair/typebox';
|
|
4
4
|
import { ServerTransport } from '../transport/index.js';
|
|
5
5
|
import { Pushable } from 'it-pushable';
|
|
6
|
-
import { C as Connection } from '../index-
|
|
6
|
+
import { C as Connection } from '../index-3ac92295.js';
|
|
7
7
|
import '../types-3e5768ec.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -36,6 +36,6 @@ interface ProcStream {
|
|
|
36
36
|
*/
|
|
37
37
|
declare function createServer<Services extends AnyServiceSchemaMap>(transport: ServerTransport<Connection>, services: Services, extendedContext?: Omit<ServiceContext, 'state'>): Server<Services>;
|
|
38
38
|
|
|
39
|
-
var version = "0.
|
|
39
|
+
var version = "0.20.1";
|
|
40
40
|
|
|
41
41
|
export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
|
package/dist/router/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Static, TObject, TUnion, TString, TSchema, TNever, TLiteral } from '@sinclair/typebox';
|
|
2
2
|
import { ClientTransport } from './transport/index.js';
|
|
3
3
|
import { Pushable } from 'it-pushable';
|
|
4
|
-
import { C as Connection, T as TransportClientId, a as Session, b as ParsedHandshakeMetadata } from './index-
|
|
4
|
+
import { C as Connection, T as TransportClientId, a as Session, b as ParsedHandshakeMetadata } from './index-3ac92295.js';
|
|
5
5
|
|
|
6
6
|
type AsyncIter<T> = AsyncGenerator<T, T>;
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Static, TObject, TUnion, TString, TSchema, TNever, TLiteral } from '@sinclair/typebox';
|
|
2
2
|
import { ClientTransport } from './transport/index.cjs';
|
|
3
3
|
import { Pushable } from 'it-pushable';
|
|
4
|
-
import { C as Connection, T as TransportClientId, a as Session, b as ParsedHandshakeMetadata } from './index-
|
|
4
|
+
import { C as Connection, T as TransportClientId, a as Session, b as ParsedHandshakeMetadata } from './index-3ac92295.js';
|
|
5
5
|
|
|
6
6
|
type AsyncIter<T> = AsyncGenerator<T, T>;
|
|
7
7
|
/**
|
|
@@ -44,6 +44,12 @@ var TransportMessageSchema = (t) => import_typebox.Type.Object({
|
|
|
44
44
|
procedureName: import_typebox.Type.Optional(import_typebox.Type.String()),
|
|
45
45
|
streamId: import_typebox.Type.String(),
|
|
46
46
|
controlFlags: import_typebox.Type.Integer(),
|
|
47
|
+
tracing: import_typebox.Type.Optional(
|
|
48
|
+
import_typebox.Type.Object({
|
|
49
|
+
traceparent: import_typebox.Type.String(),
|
|
50
|
+
tracestate: import_typebox.Type.String()
|
|
51
|
+
})
|
|
52
|
+
),
|
|
47
53
|
payload: t
|
|
48
54
|
});
|
|
49
55
|
var ControlMessageAckSchema = import_typebox.Type.Object({
|
|
@@ -81,7 +87,7 @@ var ControlMessagePayloadSchema = import_typebox.Type.Union([
|
|
|
81
87
|
var OpaqueTransportMessageSchema = TransportMessageSchema(
|
|
82
88
|
import_typebox.Type.Unknown()
|
|
83
89
|
);
|
|
84
|
-
function handshakeRequestMessage(from, to, sessionId, metadata) {
|
|
90
|
+
function handshakeRequestMessage(from, to, sessionId, metadata, tracing) {
|
|
85
91
|
return {
|
|
86
92
|
id: (0, import_nanoid.nanoid)(),
|
|
87
93
|
from,
|
|
@@ -90,6 +96,7 @@ function handshakeRequestMessage(from, to, sessionId, metadata) {
|
|
|
90
96
|
ack: 0,
|
|
91
97
|
streamId: (0, import_nanoid.nanoid)(),
|
|
92
98
|
controlFlags: 0,
|
|
99
|
+
tracing,
|
|
93
100
|
payload: {
|
|
94
101
|
type: "HANDSHAKE_REQ",
|
|
95
102
|
protocolVersion: PROTOCOL_VERSION,
|
|
@@ -419,7 +426,12 @@ var UdsConnection = class extends Connection {
|
|
|
419
426
|
this.sock.on("close", cb);
|
|
420
427
|
}
|
|
421
428
|
addErrorListener(cb) {
|
|
422
|
-
this.sock.on("error",
|
|
429
|
+
this.sock.on("error", (err) => {
|
|
430
|
+
if (err instanceof Error && "code" in err && err.code === "EPIPE") {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
cb(err);
|
|
434
|
+
});
|
|
423
435
|
}
|
|
424
436
|
send(payload) {
|
|
425
437
|
if (this.framer.destroyed || !this.sock.writable)
|
|
@@ -434,6 +446,7 @@ var UdsConnection = class extends Connection {
|
|
|
434
446
|
|
|
435
447
|
// transport/transport.ts
|
|
436
448
|
var import_value = require("@sinclair/typebox/value");
|
|
449
|
+
var import_api2 = require("@opentelemetry/api");
|
|
437
450
|
|
|
438
451
|
// transport/events.ts
|
|
439
452
|
var ProtocolError = {
|
|
@@ -469,6 +482,11 @@ var EventDispatcher = class {
|
|
|
469
482
|
}
|
|
470
483
|
};
|
|
471
484
|
|
|
485
|
+
// tracing/index.ts
|
|
486
|
+
var import_api = require("@opentelemetry/api");
|
|
487
|
+
var tracer = import_api.trace.getTracer("river");
|
|
488
|
+
var tracing_default = tracer;
|
|
489
|
+
|
|
472
490
|
// util/stringify.ts
|
|
473
491
|
function coerceErrorString(err) {
|
|
474
492
|
if (err instanceof Error) {
|
|
@@ -1028,82 +1046,142 @@ var ClientTransport = class extends Transport {
|
|
|
1028
1046
|
* @param to The client ID of the node to connect to.
|
|
1029
1047
|
*/
|
|
1030
1048
|
async connect(to) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
}
|
|
1053
|
-
log?.info(`attempting connection to ${to} (${backoffMs}ms backoff)`, {
|
|
1054
|
-
clientId: this.clientId,
|
|
1055
|
-
connectedTo: to
|
|
1056
|
-
});
|
|
1057
|
-
this.retryBudget.consumeBudget(to);
|
|
1058
|
-
reconnectPromise = sleep.then(() => {
|
|
1059
|
-
if (!canProceedWithConnection()) {
|
|
1060
|
-
throw new Error("transport state is no longer open");
|
|
1049
|
+
return tracing_default.startActiveSpan(
|
|
1050
|
+
"connect",
|
|
1051
|
+
{
|
|
1052
|
+
attributes: {
|
|
1053
|
+
component: "river",
|
|
1054
|
+
"span.kind": "client"
|
|
1055
|
+
},
|
|
1056
|
+
kind: import_api2.SpanKind.CLIENT
|
|
1057
|
+
},
|
|
1058
|
+
async (span) => {
|
|
1059
|
+
try {
|
|
1060
|
+
await this.connectAttempt(to);
|
|
1061
|
+
} catch (e) {
|
|
1062
|
+
if (e instanceof Error) {
|
|
1063
|
+
span.recordException(e);
|
|
1064
|
+
} else {
|
|
1065
|
+
span.recordException(coerceErrorString(e));
|
|
1066
|
+
}
|
|
1067
|
+
span.setStatus({ code: import_api2.SpanStatusCode.ERROR });
|
|
1068
|
+
} finally {
|
|
1069
|
+
span.end();
|
|
1061
1070
|
}
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1071
|
+
}
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1074
|
+
async connectAttempt(to, attempt = 0) {
|
|
1075
|
+
const retry = await tracing_default.startActiveSpan(
|
|
1076
|
+
"connect",
|
|
1077
|
+
{
|
|
1078
|
+
attributes: {
|
|
1079
|
+
component: "river",
|
|
1080
|
+
"river.attempt": attempt,
|
|
1081
|
+
"span.kind": "client"
|
|
1082
|
+
},
|
|
1083
|
+
kind: import_api2.SpanKind.CLIENT
|
|
1084
|
+
},
|
|
1085
|
+
async (span) => {
|
|
1086
|
+
try {
|
|
1087
|
+
const canProceedWithConnection = () => this.state === "open";
|
|
1088
|
+
if (!canProceedWithConnection()) {
|
|
1089
|
+
log?.info(
|
|
1090
|
+
`transport state is no longer open, cancelling attempt to connect to ${to}`,
|
|
1091
|
+
{ clientId: this.clientId, connectedTo: to }
|
|
1092
|
+
);
|
|
1093
|
+
return false;
|
|
1094
|
+
}
|
|
1095
|
+
let reconnectPromise = this.inflightConnectionPromises.get(to);
|
|
1096
|
+
if (!reconnectPromise) {
|
|
1097
|
+
const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
|
|
1098
|
+
if (!this.retryBudget.hasBudget(to)) {
|
|
1099
|
+
const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
|
|
1100
|
+
log?.warn(errMsg, { clientId: this.clientId, connectedTo: to });
|
|
1101
|
+
this.protocolError(ProtocolError.RetriesExceeded, errMsg);
|
|
1102
|
+
return false;
|
|
1070
1103
|
}
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1104
|
+
let sleep = Promise.resolve();
|
|
1105
|
+
const backoffMs = this.retryBudget.getBackoffMs(to);
|
|
1106
|
+
if (backoffMs > 0) {
|
|
1107
|
+
sleep = new Promise((resolve) => setTimeout(resolve, backoffMs));
|
|
1108
|
+
}
|
|
1109
|
+
log?.info(
|
|
1110
|
+
`attempting connection to ${to} (${backoffMs}ms backoff)`,
|
|
1111
|
+
{
|
|
1112
|
+
clientId: this.clientId,
|
|
1113
|
+
connectedTo: to
|
|
1114
|
+
}
|
|
1115
|
+
);
|
|
1116
|
+
this.retryBudget.consumeBudget(to);
|
|
1117
|
+
reconnectPromise = sleep.then(() => {
|
|
1118
|
+
if (!canProceedWithConnection()) {
|
|
1119
|
+
throw new Error("transport state is no longer open");
|
|
1120
|
+
}
|
|
1121
|
+
}).then(() => this.createNewOutgoingConnection(to)).then((conn) => {
|
|
1122
|
+
if (!canProceedWithConnection()) {
|
|
1123
|
+
log?.info(
|
|
1124
|
+
`transport state is no longer open, closing pre-handshake connection to ${to}`,
|
|
1125
|
+
{
|
|
1126
|
+
clientId: this.clientId,
|
|
1127
|
+
connectedTo: to,
|
|
1128
|
+
connId: conn.debugId
|
|
1129
|
+
}
|
|
1130
|
+
);
|
|
1131
|
+
conn.close();
|
|
1132
|
+
throw new Error("transport state is no longer open");
|
|
1133
|
+
}
|
|
1134
|
+
return this.sendHandshake(to, conn).then((ok) => {
|
|
1135
|
+
if (!ok) {
|
|
1136
|
+
conn.close();
|
|
1137
|
+
throw new Error("failed to send handshake");
|
|
1138
|
+
}
|
|
1139
|
+
return conn;
|
|
1140
|
+
});
|
|
1141
|
+
});
|
|
1142
|
+
this.inflightConnectionPromises.set(to, reconnectPromise);
|
|
1143
|
+
} else {
|
|
1144
|
+
log?.info(
|
|
1145
|
+
`attempting connection to ${to} (reusing previous attempt)`,
|
|
1146
|
+
{
|
|
1147
|
+
clientId: this.clientId,
|
|
1148
|
+
connectedTo: to
|
|
1149
|
+
}
|
|
1150
|
+
);
|
|
1079
1151
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1152
|
+
try {
|
|
1153
|
+
await reconnectPromise;
|
|
1154
|
+
} catch (error) {
|
|
1155
|
+
this.inflightConnectionPromises.delete(to);
|
|
1156
|
+
const errStr = coerceErrorString(error);
|
|
1157
|
+
if (!this.reconnectOnConnectionDrop || !canProceedWithConnection()) {
|
|
1158
|
+
log?.warn(`connection to ${to} failed (${errStr})`, {
|
|
1159
|
+
clientId: this.clientId,
|
|
1160
|
+
connectedTo: to
|
|
1161
|
+
});
|
|
1162
|
+
} else {
|
|
1163
|
+
log?.warn(`connection to ${to} failed (${errStr}), retrying`, {
|
|
1164
|
+
clientId: this.clientId,
|
|
1165
|
+
connectedTo: to
|
|
1166
|
+
});
|
|
1167
|
+
return true;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
} catch (e) {
|
|
1171
|
+
if (e instanceof Error) {
|
|
1172
|
+
span.recordException(e);
|
|
1173
|
+
} else {
|
|
1174
|
+
span.recordException(coerceErrorString(e));
|
|
1175
|
+
}
|
|
1176
|
+
span.setStatus({ code: import_api2.SpanStatusCode.ERROR });
|
|
1177
|
+
} finally {
|
|
1178
|
+
span.end();
|
|
1179
|
+
}
|
|
1180
|
+
return false;
|
|
1106
1181
|
}
|
|
1182
|
+
);
|
|
1183
|
+
if (retry) {
|
|
1184
|
+
return this.connectAttempt(to, attempt + 1);
|
|
1107
1185
|
}
|
|
1108
1186
|
}
|
|
1109
1187
|
deleteSession(session) {
|
|
@@ -1111,6 +1189,8 @@ var ClientTransport = class extends Transport {
|
|
|
1111
1189
|
super.deleteSession(session);
|
|
1112
1190
|
}
|
|
1113
1191
|
async sendHandshake(to, conn) {
|
|
1192
|
+
const tracing = { traceparent: "", tracestate: "" };
|
|
1193
|
+
import_api2.propagation.inject(import_api2.context.active(), tracing);
|
|
1114
1194
|
let metadata;
|
|
1115
1195
|
if (this.options.handshake) {
|
|
1116
1196
|
metadata = await this.options.handshake.get();
|
|
@@ -1131,7 +1211,8 @@ var ClientTransport = class extends Transport {
|
|
|
1131
1211
|
this.clientId,
|
|
1132
1212
|
to,
|
|
1133
1213
|
session.id,
|
|
1134
|
-
metadata
|
|
1214
|
+
metadata,
|
|
1215
|
+
tracing
|
|
1135
1216
|
);
|
|
1136
1217
|
log?.debug(`sending handshake request to ${to}`, {
|
|
1137
1218
|
clientId: this.clientId,
|