@gitpod/gitpod-protocol 0.1.5-v0.6.0-beta4 → 0.1.5-vn-6525.75
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/data/gitpod-schema.json +68 -26
- package/lib/accounting-protocol.d.ts +155 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +100 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +33 -4
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +15 -0
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +44 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/auth.d.ts +25 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +16 -0
- package/lib/auth.js.map +1 -0
- package/lib/context-url.d.ts +31 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +102 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +14 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +109 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/email-protocol.d.ts +1 -2
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +4 -4
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +5 -4
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +25 -26
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +30 -44
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +31 -38
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +2 -3
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +24 -25
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +26 -42
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +145 -142
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +172 -33
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +187 -267
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +9 -11
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +6 -8
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +5 -1
- package/lib/ide-frontend-service.d.ts.map +1 -1
- package/lib/ide-protocol.d.ts +105 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/{util/without.js → ide-protocol.js} +2 -2
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +16 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +27 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +30 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +5 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +184 -34
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +4 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +42 -59
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +35 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +83 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/error.d.ts +5 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +10 -2
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +24 -60
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +3 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +75 -162
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +14 -0
- package/lib/oss-allowlist.d.ts.map +1 -0
- package/lib/oss-allowlist.js +8 -0
- package/lib/oss-allowlist.js.map +1 -0
- package/lib/payment-protocol.d.ts +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +10 -5
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +41 -35
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +210 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +605 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +164 -88
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +184 -199
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +75 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +63 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +113 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +30 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/util/analytics.d.ts +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +88 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +57 -135
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js +17 -59
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +11 -11
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deferred.js +10 -12
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -40
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +63 -77
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -0
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +27 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +4 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +487 -0
- package/lib/util/generate-workspace-id.js.map +1 -0
- package/{src/theia-plugins.ts → lib/util/generate-workspace-id.spec.d.ts} +2 -6
- package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.spec.js +91 -0
- package/lib/util/generate-workspace-id.spec.js.map +1 -0
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +2 -2
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +109 -106
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +8 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +114 -22
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/{theia-plugins.js → util/jaeger-client-types.js} +1 -1
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +49 -33
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +125 -129
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +5 -5
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +13 -3
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +37 -8
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +8 -0
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +127 -47
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.js +16 -55
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.js +147 -288
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +15 -0
- package/lib/util/repeat.d.ts.map +1 -0
- package/lib/util/repeat.js +55 -0
- package/lib/util/repeat.js.map +1 -0
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +28 -16
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +21 -24
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +52 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +199 -64
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.d.ts +7 -0
- package/lib/util/tracing.spec.d.ts.map +1 -0
- package/lib/util/tracing.spec.js +121 -0
- package/lib/util/tracing.spec.js.map +1 -0
- package/lib/util/workspace-port-authentication.d.ts +7 -7
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +10 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +76 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +31 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +28 -4
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +2 -2
- package/package.json +33 -17
- package/pkg-yarn.lock +18 -9
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +231 -0
- package/src/admin-protocol.ts +71 -19
- package/src/analytics.ts +52 -0
- package/src/auth.ts +27 -0
- package/src/context-url.spec.ts +67 -0
- package/src/context-url.ts +109 -0
- package/src/email-protocol.ts +5 -7
- package/src/encryption/container-module.ts +2 -3
- package/src/encryption/encryption-engine.spec.ts +9 -8
- package/src/encryption/encryption-engine.ts +14 -14
- package/src/encryption/encryption-service.ts +4 -5
- package/src/encryption/key-provider.ts +16 -19
- package/src/env.ts +18 -18
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +327 -102
- package/src/headless-workspace-log.ts +12 -14
- package/src/ide-frontend-service.ts +6 -2
- package/src/ide-protocol.ts +119 -0
- package/src/index.ts +16 -10
- package/src/installation-admin-protocol.ts +42 -0
- package/src/license-protocol.ts +5 -6
- package/src/messaging/browser/connection.ts +197 -18
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +96 -0
- package/src/messaging/error.ts +15 -5
- package/src/messaging/handler.ts +13 -1
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +35 -34
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +42 -38
- package/src/plans.ts +679 -0
- package/src/protocol.ts +384 -279
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +123 -0
- package/src/teams-projects-protocol.ts +147 -0
- package/src/typings/globals.ts +4 -4
- package/src/util/analytics.ts +109 -0
- package/src/util/async-iterator.ts +4 -5
- package/src/util/cancelable.ts +3 -3
- package/src/util/date-time.ts +8 -8
- package/src/util/deferred.ts +6 -6
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +11 -8
- package/src/util/generate-workspace-id.spec.ts +51 -0
- package/src/util/generate-workspace-id.ts +475 -0
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +63 -7
- package/src/util/gitpod-host-url.ts +55 -38
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +145 -71
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +60 -10
- package/src/util/parse-workspace-id.ts +38 -8
- package/src/util/queue.spec.ts +28 -26
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +6 -8
- package/src/util/skip-if.ts +10 -7
- package/src/util/timeutil.spec.ts +14 -15
- package/src/util/timeutil.ts +19 -15
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +202 -31
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +107 -0
- package/src/workspace-instance.ts +72 -30
- package/src/wsready.ts +3 -3
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -46
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -34
- package/lib/util/safe-promise.js.map +0 -1
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
package/lib/util/tracing.js
CHANGED
|
@@ -12,55 +12,192 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.PerOperationSampler = exports.TracingManager = exports.TraceContext = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const opentracing = require("opentracing");
|
|
16
|
+
const jaeger_client_1 = require("jaeger-client");
|
|
17
|
+
const opentracing_1 = require("opentracing");
|
|
18
|
+
const inversify_1 = require("inversify");
|
|
19
|
+
const logging_1 = require("./logging");
|
|
19
20
|
var TraceContext;
|
|
20
21
|
(function (TraceContext) {
|
|
21
|
-
function startSpan(operation,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
function startSpan(operation, parentCtx) {
|
|
23
|
+
const options = {};
|
|
24
|
+
if (parentCtx && parentCtx.span && !!parentCtx.span.context().toSpanId()) {
|
|
25
|
+
options.childOf = parentCtx.span;
|
|
26
|
+
}
|
|
27
|
+
// TODO(gpl) references lead to a huge amount of errors in prod logs. Avoid those until we have time to figure out how to fix it.
|
|
28
|
+
// if (referencedSpans) {
|
|
29
|
+
// // note: allthough followsForm's type says it takes 'opentracing.Span | opentracing.SpanContext', it only works with SpanContext (typing mismatch)
|
|
30
|
+
// // note2: we need to filter out debug spans (spanId === "")
|
|
31
|
+
// options.references = referencedSpans.filter(s => s !== undefined)
|
|
32
|
+
// .filter(s => !!s!.context().toSpanId())
|
|
33
|
+
// .map(s => followsFrom(s!.context()));
|
|
34
|
+
// }
|
|
25
35
|
return opentracing.globalTracer().startSpan(operation, options);
|
|
26
36
|
}
|
|
27
37
|
TraceContext.startSpan = startSpan;
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
function childContext(operation, parentCtx) {
|
|
39
|
+
const span = startSpan(operation, parentCtx);
|
|
40
|
+
return { span };
|
|
41
|
+
}
|
|
42
|
+
TraceContext.childContext = childContext;
|
|
43
|
+
function withSpan(operation, callback, ctx) {
|
|
44
|
+
// if we don't have a parent span, don't create a trace here as those <trace-without-root-spans> are not useful.
|
|
45
|
+
if (!ctx || !ctx.span || !ctx.span.context()) {
|
|
46
|
+
callback({});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const span = TraceContext.startSpan(operation, ctx);
|
|
50
|
+
try {
|
|
51
|
+
callback({ span });
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
TraceContext.setError({ span }, e);
|
|
55
|
+
throw e;
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
span.finish();
|
|
32
59
|
}
|
|
33
|
-
return opentracing.globalTracer().startSpan(operation, options);
|
|
34
60
|
}
|
|
35
|
-
TraceContext.
|
|
36
|
-
function
|
|
61
|
+
TraceContext.withSpan = withSpan;
|
|
62
|
+
function setError(ctx, err) {
|
|
37
63
|
if (!ctx.span) {
|
|
38
64
|
return;
|
|
39
65
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
66
|
+
TraceContext.addNestedTags(ctx, {
|
|
67
|
+
error: {
|
|
68
|
+
message: err.message,
|
|
69
|
+
stacktrace: err.stack,
|
|
70
|
+
},
|
|
43
71
|
});
|
|
44
72
|
ctx.span.setTag("error", true);
|
|
45
73
|
}
|
|
46
|
-
TraceContext.
|
|
74
|
+
TraceContext.setError = setError;
|
|
75
|
+
function setJsonRPCMetadata(ctx, method) {
|
|
76
|
+
if (!ctx.span) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const tags = {
|
|
80
|
+
rpc: {
|
|
81
|
+
system: "jsonrpc",
|
|
82
|
+
// version,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
if (method) {
|
|
86
|
+
tags.rpc.method = method;
|
|
87
|
+
}
|
|
88
|
+
addNestedTags(ctx, tags);
|
|
89
|
+
}
|
|
90
|
+
TraceContext.setJsonRPCMetadata = setJsonRPCMetadata;
|
|
91
|
+
function setJsonRPCError(ctx, method, err, withStatusCode = false) {
|
|
92
|
+
if (!ctx.span) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// not use setError bc this is (most likely) a working operation
|
|
96
|
+
setJsonRPCMetadata(ctx, method);
|
|
97
|
+
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md#json-rpc
|
|
98
|
+
addNestedTags(ctx, {
|
|
99
|
+
rpc: {
|
|
100
|
+
jsonrpc: {
|
|
101
|
+
error_code: err.code,
|
|
102
|
+
error_message: err.message,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
// the field "status_code" is used by honeycomb to derive insights like success rate, etc. Defaults to "0".
|
|
107
|
+
if (withStatusCode) {
|
|
108
|
+
ctx.span.setTag("status_code", err.code);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
TraceContext.setJsonRPCError = setJsonRPCError;
|
|
112
|
+
function addJsonRPCParameters(ctx, params) {
|
|
113
|
+
if (!ctx.span) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
setJsonRPCMetadata(ctx);
|
|
117
|
+
addNestedTags(ctx, {
|
|
118
|
+
rpc: {
|
|
119
|
+
jsonrpc: {
|
|
120
|
+
parameters: params,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
TraceContext.addJsonRPCParameters = addJsonRPCParameters;
|
|
126
|
+
/**
|
|
127
|
+
* Does what one would expect from `span.addTags`: Calls `span.addTag` for all keys in map, recursively for objects.
|
|
128
|
+
* Example:
|
|
129
|
+
* ```
|
|
130
|
+
* TraceContext.addNestedTags(ctx, {
|
|
131
|
+
* rpc: {
|
|
132
|
+
* system: "jsonrpc",
|
|
133
|
+
* jsonrpc: {
|
|
134
|
+
* version: "1.0",
|
|
135
|
+
* method: "test",
|
|
136
|
+
* parameters: ["abc", "def"],
|
|
137
|
+
* },
|
|
138
|
+
* },
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
* gives
|
|
142
|
+
* rpc.system = "jsonrpc"
|
|
143
|
+
* rpc.jsonrpc.version = "1.0"
|
|
144
|
+
* rpc.jsonrpc.method = "test"
|
|
145
|
+
* rpc.jsonrpc.parameters.0 = "abc"
|
|
146
|
+
* rpc.jsonrpc.parameters.1 = "def"
|
|
147
|
+
* @param ctx
|
|
148
|
+
* @param keyValueMap
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
151
|
+
function addNestedTags(ctx, keyValueMap, _namespace) {
|
|
152
|
+
if (!ctx.span) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const namespace = _namespace ? `${_namespace}.` : "";
|
|
156
|
+
try {
|
|
157
|
+
for (const k of Object.keys(keyValueMap)) {
|
|
158
|
+
const v = keyValueMap[k];
|
|
159
|
+
if (v instanceof Object) {
|
|
160
|
+
addNestedTags(ctx, v, `${namespace}${k}`);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
ctx.span.setTag(`${namespace}${k}`, v);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
// general resilience against odd shapes/parameters
|
|
169
|
+
logging_1.log.error("Tracing.addNestedTags", err, { namespace });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
TraceContext.addNestedTags = addNestedTags;
|
|
173
|
+
function setOWI(ctx, owi) {
|
|
174
|
+
if (!ctx.span) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
addNestedTags(ctx, {
|
|
178
|
+
context: owi,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
TraceContext.setOWI = setOWI;
|
|
47
182
|
})(TraceContext = exports.TraceContext || (exports.TraceContext = {}));
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
TracingManager.prototype.getTracerForService = function (serviceName, opts) {
|
|
55
|
-
var config = {
|
|
183
|
+
let TracingManager = class TracingManager {
|
|
184
|
+
setup(serviceName, opts) {
|
|
185
|
+
(0, opentracing_1.initGlobalTracer)(this.getTracerForService(serviceName, opts));
|
|
186
|
+
}
|
|
187
|
+
getTracerForService(serviceName, opts) {
|
|
188
|
+
const config = {
|
|
56
189
|
disable: false,
|
|
57
190
|
reporter: {
|
|
58
|
-
logSpans: false
|
|
191
|
+
logSpans: false,
|
|
59
192
|
},
|
|
60
|
-
serviceName
|
|
193
|
+
serviceName,
|
|
61
194
|
};
|
|
62
|
-
|
|
63
|
-
logger: console
|
|
195
|
+
const t = (0, jaeger_client_1.initTracerFromEnv)(config, {
|
|
196
|
+
logger: console,
|
|
197
|
+
tags: {
|
|
198
|
+
"service.build.commit": process.env.GITPOD_BUILD_GIT_COMMIT,
|
|
199
|
+
"service.build.version": process.env.GITPOD_BUILD_VERSION,
|
|
200
|
+
},
|
|
64
201
|
});
|
|
65
202
|
if (opts) {
|
|
66
203
|
if (opts.perOpSampling) {
|
|
@@ -68,26 +205,25 @@ var TracingManager = /** @class */ (function () {
|
|
|
68
205
|
}
|
|
69
206
|
}
|
|
70
207
|
return t;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}());
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
TracingManager = __decorate([
|
|
211
|
+
(0, inversify_1.injectable)()
|
|
212
|
+
], TracingManager);
|
|
77
213
|
exports.TracingManager = TracingManager;
|
|
78
|
-
|
|
79
|
-
|
|
214
|
+
class PerOperationSampler {
|
|
215
|
+
constructor(fallback, strategies) {
|
|
80
216
|
this.fallback = fallback;
|
|
81
217
|
this.strategies = strategies;
|
|
82
218
|
}
|
|
83
|
-
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
219
|
+
name() {
|
|
220
|
+
return "PerOperationSampler";
|
|
221
|
+
}
|
|
222
|
+
toString() {
|
|
223
|
+
return `${this.name()}`;
|
|
224
|
+
}
|
|
225
|
+
isSampled(operation, tags) {
|
|
226
|
+
let shouldSample = this.strategies[operation];
|
|
91
227
|
if (shouldSample === undefined) {
|
|
92
228
|
if (!this.fallback.isSampled) {
|
|
93
229
|
return false;
|
|
@@ -95,31 +231,30 @@ var PerOperationSampler = /** @class */ (function () {
|
|
|
95
231
|
return this.fallback.isSampled(operation, tags);
|
|
96
232
|
}
|
|
97
233
|
return shouldSample;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
234
|
+
}
|
|
235
|
+
onCreateSpan(span) {
|
|
236
|
+
const outTags = {};
|
|
237
|
+
const isSampled = this.isSampled(span.operationName, outTags);
|
|
102
238
|
// NB: return retryable=true here since we can change decision after setOperationName().
|
|
103
239
|
return { sample: isSampled, retryable: true, tags: outTags };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
240
|
+
}
|
|
241
|
+
onSetOperationName(span, operationName) {
|
|
242
|
+
const outTags = {};
|
|
243
|
+
const isSampled = this.isSampled(span.operationName, outTags);
|
|
108
244
|
return { sample: isSampled, retryable: false, tags: outTags };
|
|
109
|
-
}
|
|
110
|
-
|
|
245
|
+
}
|
|
246
|
+
onSetTag(span, key, value) {
|
|
111
247
|
return { sample: false, retryable: true, tags: null };
|
|
112
|
-
}
|
|
113
|
-
|
|
248
|
+
}
|
|
249
|
+
equal(other) {
|
|
114
250
|
return false; // TODO equal should be removed
|
|
115
|
-
}
|
|
116
|
-
|
|
251
|
+
}
|
|
252
|
+
close(callback) {
|
|
117
253
|
// all nested samplers are of simple types, so we do not need to Close them
|
|
118
254
|
if (callback) {
|
|
119
255
|
callback();
|
|
120
256
|
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
}());
|
|
257
|
+
}
|
|
258
|
+
}
|
|
124
259
|
exports.PerOperationSampler = PerOperationSampler;
|
|
125
260
|
//# sourceMappingURL=tracing.js.map
|
package/lib/util/tracing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/util/tracing.ts"],"names":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vE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAClE,CAAC;IAED,QAAQ,CAAC,IAAsB,EAAE,GAAW,EAAE,KAAU;QACpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,KAAc;QAChB,OAAO,KAAK,CAAC,CAAC,+BAA+B;IACjD,CAAC;IAED,KAAK,CAAC,QAAoB;QACtB,2EAA2E;QAC3E,IAAI,QAAQ,EAAE;YACV,QAAQ,EAAE,CAAC;SACd;IACL,CAAC;CACJ;AAlDD,kDAkDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing.spec.d.ts","sourceRoot":"","sources":["../../src/util/tracing.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
4
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
|
+
* See License-AGPL.txt in the project root for license information.
|
|
6
|
+
*/
|
|
7
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
8
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12
|
+
};
|
|
13
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
15
|
+
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const mocha_typescript_1 = require("mocha-typescript");
|
|
27
|
+
const chai = require("chai");
|
|
28
|
+
const tracing_1 = require("./tracing");
|
|
29
|
+
const opentracing_1 = require("opentracing");
|
|
30
|
+
const expect = chai.expect;
|
|
31
|
+
let TestTracing = class TestTracing {
|
|
32
|
+
testTracingContext_addNestedTags() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const tracer = new opentracing_1.MockTracer();
|
|
35
|
+
const span = tracer.startSpan("testTracingContext_addNestedTags");
|
|
36
|
+
tracing_1.TraceContext.addNestedTags({ span }, {
|
|
37
|
+
rpc: {
|
|
38
|
+
system: "jsonrpc",
|
|
39
|
+
jsonrpc: {
|
|
40
|
+
version: "1.0",
|
|
41
|
+
method: "test",
|
|
42
|
+
parameters: ["abc", "def"],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const mockSpan = tracer.report().spans[0];
|
|
47
|
+
expect(mockSpan.tags()).to.deep.equal({
|
|
48
|
+
"rpc.system": "jsonrpc",
|
|
49
|
+
"rpc.jsonrpc.version": "1.0",
|
|
50
|
+
"rpc.jsonrpc.method": "test",
|
|
51
|
+
"rpc.jsonrpc.parameters.0": "abc",
|
|
52
|
+
"rpc.jsonrpc.parameters.1": "def",
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
testTracingContext_addNestedTags_null() {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const tracer = new opentracing_1.MockTracer();
|
|
59
|
+
const span = tracer.startSpan("testTracingContext_addNestedTags_null");
|
|
60
|
+
tracing_1.TraceContext.addNestedTags({ span }, {
|
|
61
|
+
someShape: {
|
|
62
|
+
thisIsNull: null,
|
|
63
|
+
thisIsUndefined: undefined,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const mockSpan = tracer.report().spans[0];
|
|
67
|
+
expect(mockSpan.tags()).to.deep.equal({
|
|
68
|
+
"someShape.thisIsNull": null,
|
|
69
|
+
"someShape.thisIsUndefined": undefined,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
testTracingContext_addJsonRPCParameters() {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const tracer = new opentracing_1.MockTracer();
|
|
76
|
+
const span = tracer.startSpan("testTracingContext_addJsonRPCParameters");
|
|
77
|
+
const ctx = { span };
|
|
78
|
+
tracing_1.TraceContext.addJsonRPCParameters(ctx, {
|
|
79
|
+
one: "one",
|
|
80
|
+
two: {
|
|
81
|
+
name: "two",
|
|
82
|
+
some: "shape",
|
|
83
|
+
containing: "PII",
|
|
84
|
+
},
|
|
85
|
+
three: "three",
|
|
86
|
+
});
|
|
87
|
+
const mockSpan = tracer.report().spans[0];
|
|
88
|
+
expect(mockSpan.tags()).to.deep.equal({
|
|
89
|
+
"rpc.jsonrpc.parameters.one": "one",
|
|
90
|
+
"rpc.jsonrpc.parameters.two.containing": "PII",
|
|
91
|
+
"rpc.jsonrpc.parameters.two.name": "two",
|
|
92
|
+
"rpc.jsonrpc.parameters.two.some": "shape",
|
|
93
|
+
"rpc.jsonrpc.parameters.three": "three",
|
|
94
|
+
"rpc.system": "jsonrpc",
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
__decorate([
|
|
100
|
+
mocha_typescript_1.test,
|
|
101
|
+
__metadata("design:type", Function),
|
|
102
|
+
__metadata("design:paramtypes", []),
|
|
103
|
+
__metadata("design:returntype", Promise)
|
|
104
|
+
], TestTracing.prototype, "testTracingContext_addNestedTags", null);
|
|
105
|
+
__decorate([
|
|
106
|
+
mocha_typescript_1.test,
|
|
107
|
+
__metadata("design:type", Function),
|
|
108
|
+
__metadata("design:paramtypes", []),
|
|
109
|
+
__metadata("design:returntype", Promise)
|
|
110
|
+
], TestTracing.prototype, "testTracingContext_addNestedTags_null", null);
|
|
111
|
+
__decorate([
|
|
112
|
+
mocha_typescript_1.test,
|
|
113
|
+
__metadata("design:type", Function),
|
|
114
|
+
__metadata("design:paramtypes", []),
|
|
115
|
+
__metadata("design:returntype", Promise)
|
|
116
|
+
], TestTracing.prototype, "testTracingContext_addJsonRPCParameters", null);
|
|
117
|
+
TestTracing = __decorate([
|
|
118
|
+
mocha_typescript_1.suite
|
|
119
|
+
], TestTracing);
|
|
120
|
+
module.exports = new TestTracing();
|
|
121
|
+
//# sourceMappingURL=tracing.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing.spec.js","sourceRoot":"","sources":["../../src/util/tracing.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;AAEH,uDAA+C;AAC/C,6BAA6B;AAC7B,uCAAyC;AACzC,6CAAyC;AAEzC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAG3B,IAAM,WAAW,GAAjB,MAAM,WAAW;IACM,gCAAgC;;YAC/C,MAAM,MAAM,GAAG,IAAI,wBAAU,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,kCAAkC,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,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;YACzE,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC;YACrB,sBAAY,CAAC,oBAAoB,CAAC,GAAG,EAAE;gBACnC,GAAG,EAAE,KAAK;gBACV,GAAG,EAAE;oBACD,IAAI,EAAE,KAAK;oBACX,IAAI,EAAE,OAAO;oBACb,UAAU,EAAE,KAAK;iBACpB;gBACD,KAAK,EAAE,OAAO;aACjB,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC1C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;gBAClC,4BAA4B,EAAE,KAAK;gBACnC,uCAAuC,EAAE,KAAK;gBAC9C,iCAAiC,EAAE,KAAK;gBACxC,iCAAiC,EAAE,OAAO;gBAC1C,8BAA8B,EAAE,OAAO;gBACvC,YAAY,EAAE,SAAS;aAC1B,CAAC,CAAC;QACP,CAAC;KAAA;CACJ,CAAA;AAvES;IAAL,uBAAI;;;;mEAyBJ;AAEK;IAAL,uBAAI;;;;wEAkBJ;AAEK;IAAL,uBAAI;;;;0EAuBJ;AAvEC,WAAW;IADhB,wBAAK;GACA,WAAW,CAwEhB;AACD,MAAM,CAAC,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* These cookies are set in the Theia frontend. This pattern is relied upon in:
|
|
8
|
-
* - proxy:
|
|
9
|
-
* - to filter it out on port locations
|
|
10
|
-
* - to forward it to the server for authentication
|
|
11
|
-
* - server:
|
|
12
|
-
* - to authenticate access to port locations
|
|
13
|
-
*/
|
|
7
|
+
* These cookies are set in the Theia frontend. This pattern is relied upon in:
|
|
8
|
+
* - proxy:
|
|
9
|
+
* - to filter it out on port locations
|
|
10
|
+
* - to forward it to the server for authentication
|
|
11
|
+
* - server:
|
|
12
|
+
* - to authenticate access to port locations
|
|
13
|
+
*/
|
|
14
14
|
export declare const worspacePortAuthCookieName: (host: string, workspaceId: string) => string;
|
|
15
15
|
//# sourceMappingURL=workspace-port-authentication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-port-authentication.d.ts","sourceRoot":"","sources":["../../src/util/workspace-port-authentication.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;
|
|
1
|
+
{"version":3,"file":"workspace-port-authentication.d.ts","sourceRoot":"","sources":["../../src/util/workspace-port-authentication.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,SAAmB,MAAM,eAAe,MAAM,KAAG,MAEvF,CAAC"}
|
|
@@ -7,17 +7,15 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.worspacePortAuthCookieName = void 0;
|
|
9
9
|
/**
|
|
10
|
-
* These cookies are set in the Theia frontend. This pattern is relied upon in:
|
|
11
|
-
* - proxy:
|
|
12
|
-
* - to filter it out on port locations
|
|
13
|
-
* - to forward it to the server for authentication
|
|
14
|
-
* - server:
|
|
15
|
-
* - to authenticate access to port locations
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
return host
|
|
19
|
-
.replace(/https?/, '')
|
|
20
|
-
.replace(/[\W_]+/g, "_")
|
|
21
|
-
+ ("_ws_" + workspaceId + "_port_auth_");
|
|
10
|
+
* These cookies are set in the Theia frontend. This pattern is relied upon in:
|
|
11
|
+
* - proxy:
|
|
12
|
+
* - to filter it out on port locations
|
|
13
|
+
* - to forward it to the server for authentication
|
|
14
|
+
* - server:
|
|
15
|
+
* - to authenticate access to port locations
|
|
16
|
+
*/
|
|
17
|
+
const worspacePortAuthCookieName = function (host, workspaceId) {
|
|
18
|
+
return host.replace(/https?/, "").replace(/[\W_]+/g, "_") + `_ws_${workspaceId}_port_auth_`;
|
|
22
19
|
};
|
|
20
|
+
exports.worspacePortAuthCookieName = worspacePortAuthCookieName;
|
|
23
21
|
//# sourceMappingURL=workspace-port-authentication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-port-authentication.js","sourceRoot":"","sources":["../../src/util/workspace-port-authentication.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;
|
|
1
|
+
{"version":3,"file":"workspace-port-authentication.js","sourceRoot":"","sources":["../../src/util/workspace-port-authentication.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;;;;GAOG;AACI,MAAM,0BAA0B,GAAG,UAAU,IAAY,EAAE,WAAmB;IACjF,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,OAAO,WAAW,aAAa,CAAC;AAChG,CAAC,CAAC;AAFW,QAAA,0BAA0B,8BAErC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
import { DeepPartial } from "./util/deep-partial";
|
|
7
|
+
import { PermissionName } from "./permission";
|
|
8
|
+
export interface WorkspaceCluster {
|
|
9
|
+
name: string;
|
|
10
|
+
url: string;
|
|
11
|
+
tls?: TLSConfig;
|
|
12
|
+
state: WorkspaceClusterState;
|
|
13
|
+
maxScore: number;
|
|
14
|
+
score: number;
|
|
15
|
+
govern: boolean;
|
|
16
|
+
admissionConstraints?: AdmissionConstraint[];
|
|
17
|
+
}
|
|
18
|
+
export declare type WorkspaceClusterState = "available" | "cordoned" | "draining";
|
|
19
|
+
export interface TLSConfig {
|
|
20
|
+
ca: string;
|
|
21
|
+
key: string;
|
|
22
|
+
crt: string;
|
|
23
|
+
}
|
|
24
|
+
export declare namespace TLSConfig {
|
|
25
|
+
const loadFromBase64File: (path: string) => string;
|
|
26
|
+
}
|
|
27
|
+
export declare type WorkspaceClusterWoTLS = Omit<WorkspaceCluster, "tls">;
|
|
28
|
+
export declare type WorkspaceManagerConnectionInfo = Pick<WorkspaceCluster, "name" | "url" | "tls">;
|
|
29
|
+
export declare type AdmissionConstraint = AdmissionConstraintFeaturePreview | AdmissionConstraintHasPermission | AdmissionConstraintHasUserLevel | AdmissionConstraintHasMoreResources;
|
|
30
|
+
export declare type AdmissionConstraintFeaturePreview = {
|
|
31
|
+
type: "has-feature-preview";
|
|
32
|
+
};
|
|
33
|
+
export declare type AdmissionConstraintHasPermission = {
|
|
34
|
+
type: "has-permission";
|
|
35
|
+
permission: PermissionName;
|
|
36
|
+
};
|
|
37
|
+
export declare type AdmissionConstraintHasUserLevel = {
|
|
38
|
+
type: "has-user-level";
|
|
39
|
+
level: string;
|
|
40
|
+
};
|
|
41
|
+
export declare type AdmissionConstraintHasMoreResources = {
|
|
42
|
+
type: "has-more-resources";
|
|
43
|
+
};
|
|
44
|
+
export declare namespace AdmissionConstraint {
|
|
45
|
+
function is(o: any): o is AdmissionConstraint;
|
|
46
|
+
function isHasPermissionConstraint(o: any): o is AdmissionConstraintHasPermission;
|
|
47
|
+
function hasPermission(ac: AdmissionConstraint, permission: PermissionName): boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare const WorkspaceClusterDB: unique symbol;
|
|
50
|
+
export interface WorkspaceClusterDB {
|
|
51
|
+
/**
|
|
52
|
+
* Stores the given WorkspaceCluster to the cluster-local DB in a consistent manner.
|
|
53
|
+
* If there already is an entry with the same name it's merged and updated with the given state.
|
|
54
|
+
* @param cluster
|
|
55
|
+
*/
|
|
56
|
+
save(cluster: WorkspaceCluster): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Deletes the cluster identified by this name, if any.
|
|
59
|
+
* @param name
|
|
60
|
+
*/
|
|
61
|
+
deleteByName(name: string): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Finds a WorkspaceCluster with the given name. If there is none, `undefined` is returned.
|
|
64
|
+
* @param name
|
|
65
|
+
*/
|
|
66
|
+
findByName(name: string): Promise<WorkspaceCluster | undefined>;
|
|
67
|
+
/**
|
|
68
|
+
* Lists all WorkspaceClusterWoTls for which the given predicate is true (does not return TLS for size/speed concerns)
|
|
69
|
+
* @param predicate
|
|
70
|
+
*/
|
|
71
|
+
findFiltered(predicate: DeepPartial<WorkspaceClusterFilter>): Promise<WorkspaceClusterWoTLS[]>;
|
|
72
|
+
}
|
|
73
|
+
export interface WorkspaceClusterFilter extends Pick<WorkspaceCluster, "state" | "govern" | "url"> {
|
|
74
|
+
minScore: number;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=workspace-cluster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-cluster.d.ts","sourceRoot":"","sources":["../src/workspace-cluster.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAI7B,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,EAAE,MAAM,CAAC;IAGZ,GAAG,CAAC,EAAE,SAAS,CAAC;IAGhB,KAAK,EAAE,qBAAqB,CAAC;IAG7B,QAAQ,EAAE,MAAM,CAAC;IAGjB,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,OAAO,CAAC;IAGhB,oBAAoB,CAAC,EAAE,mBAAmB,EAAE,CAAC;CAChD;AAED,oBAAY,qBAAqB,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAC1E,MAAM,WAAW,SAAS;IAEtB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ACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IAEhE;;;OAGG;IACH,YAAY,CAAC,SAAS,EAAE,WAAW,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;CAClG;AACD,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC9F,QAAQ,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
|
+
* See License-AGPL.txt in the project root for license information.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.WorkspaceClusterDB = exports.AdmissionConstraint = exports.TLSConfig = void 0;
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
const env_1 = require("./env");
|
|
11
|
+
var TLSConfig;
|
|
12
|
+
(function (TLSConfig) {
|
|
13
|
+
TLSConfig.loadFromBase64File = (path) => fs.readFileSync((0, env_1.filePathTelepresenceAware)(path)).toString("base64");
|
|
14
|
+
})(TLSConfig = exports.TLSConfig || (exports.TLSConfig = {}));
|
|
15
|
+
var AdmissionConstraint;
|
|
16
|
+
(function (AdmissionConstraint) {
|
|
17
|
+
function is(o) {
|
|
18
|
+
return !!o && "type" in o;
|
|
19
|
+
}
|
|
20
|
+
AdmissionConstraint.is = is;
|
|
21
|
+
function isHasPermissionConstraint(o) {
|
|
22
|
+
return is(o) && o.type === "has-permission";
|
|
23
|
+
}
|
|
24
|
+
AdmissionConstraint.isHasPermissionConstraint = isHasPermissionConstraint;
|
|
25
|
+
function hasPermission(ac, permission) {
|
|
26
|
+
return isHasPermissionConstraint(ac) && ac.permission === permission;
|
|
27
|
+
}
|
|
28
|
+
AdmissionConstraint.hasPermission = hasPermission;
|
|
29
|
+
})(AdmissionConstraint = exports.AdmissionConstraint || (exports.AdmissionConstraint = {}));
|
|
30
|
+
exports.WorkspaceClusterDB = Symbol("WorkspaceClusterDB");
|
|
31
|
+
//# sourceMappingURL=workspace-cluster.js.map
|