@gitpod/gitpod-protocol 0.1.5-sje-installation-admin-dashboard.22 → 0.1.5-sje-installer-fun.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/data/gitpod-schema.json +181 -4
- package/lib/accounting-protocol.d.ts +17 -10
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +30 -32
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +9 -0
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +4 -5
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/blocked-repositories-protocol.d.ts +13 -0
- package/lib/blocked-repositories-protocol.d.ts.map +1 -0
- package/lib/blocked-repositories-protocol.js +8 -0
- package/lib/blocked-repositories-protocol.js.map +1 -0
- package/lib/context-url.d.ts +17 -5
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +57 -6
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +2 -0
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +40 -4
- package/lib/context-url.spec.js.map +1 -1
- package/lib/email-protocol.d.ts +1 -1
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +1 -1
- 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 +7 -7
- 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 +2 -3
- 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 +1 -1
- 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 +7 -9
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +0 -5
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +1 -20
- package/lib/env.js.map +1 -1
- package/lib/experiments/always-default.d.ts +8 -0
- package/lib/experiments/always-default.d.ts.map +1 -0
- package/lib/experiments/always-default.js +20 -0
- package/lib/experiments/always-default.js.map +1 -0
- package/lib/experiments/configcat-server.d.ts +8 -0
- package/lib/experiments/configcat-server.d.ts.map +1 -0
- package/lib/experiments/configcat-server.js +34 -0
- package/lib/experiments/configcat-server.js.map +1 -0
- package/lib/experiments/configcat.d.ts +21 -0
- package/lib/experiments/configcat.d.ts.map +1 -0
- package/lib/experiments/configcat.js +47 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +19 -0
- package/lib/experiments/types.d.ts.map +1 -0
- package/lib/{theia-plugins.js → experiments/types.js} +2 -2
- package/lib/experiments/types.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +6 -6
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +42 -39
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +45 -26
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +39 -32
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +1 -0
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +2 -1
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +1 -1
- package/lib/ide-protocol.d.ts +10 -6
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +16 -16
- package/lib/installation-admin-protocol.d.ts +9 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -1
- package/lib/installation-admin-protocol.js +3 -2
- package/lib/installation-admin-protocol.js.map +1 -1
- package/lib/license-protocol.d.ts +7 -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 +1 -1
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +19 -19
- 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 +9 -6
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +2 -2
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +20 -20
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +3 -0
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +6 -0
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.js +8 -8
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +1 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +7 -9
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +1 -1
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +9 -3
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +34 -25
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +3 -3
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +206 -171
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +88 -38
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +166 -88
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +21 -3
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +16 -5
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +12 -3
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +8 -1
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +12 -3
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +3 -3
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +6 -6
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/debug-app.d.ts +25 -0
- package/lib/util/debug-app.d.ts.map +1 -0
- package/lib/util/debug-app.js +100 -0
- package/lib/util/debug-app.js.map +1 -0
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +2 -2
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +5 -3
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +1 -1
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +5 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +446 -442
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +18 -7
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +1 -1
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +0 -3
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +31 -29
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +15 -5
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js.map +1 -1
- package/lib/util/jaeger-client-types.d.ts.map +1 -1
- package/lib/util/logging.d.ts +1 -1
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +31 -25
- 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.map +1 -1
- package/lib/util/parse-workspace-id.js +1 -2
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.spec.js +9 -6
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +1 -0
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +9 -3
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +8 -8
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +19 -20
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.js +3 -3
- package/lib/util/tracing.spec.js.map +1 -1
- 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 +8 -11
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +10 -8
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +16 -1
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +37 -3
- 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 +10 -7
- package/pkg-yarn.lock +8 -6
- package/provenance-bundle.jsonl +1 -1
- package/src/accounting-protocol.ts +63 -51
- package/src/admin-protocol.ts +33 -20
- package/src/analytics.ts +26 -28
- package/src/auth.ts +2 -2
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +37 -9
- package/src/context-url.ts +96 -40
- package/src/email-protocol.ts +5 -6
- 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 +0 -22
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +37 -0
- package/src/experiments/configcat.ts +53 -0
- package/src/experiments/types.ts +32 -0
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +166 -108
- package/src/headless-workspace-log.ts +6 -4
- package/src/ide-frontend-service.ts +2 -2
- package/src/ide-protocol.ts +13 -8
- package/src/index.ts +16 -16
- package/src/installation-admin-protocol.ts +14 -4
- package/src/license-protocol.ts +12 -6
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +70 -71
- package/src/messaging/error.ts +10 -3
- package/src/messaging/handler.ts +6 -6
- package/src/messaging/node/connection.ts +8 -8
- package/src/messaging/proxy-factory.ts +23 -30
- package/src/oss-allowlist.ts +3 -3
- package/src/payment-protocol.ts +2 -2
- package/src/permission.ts +40 -32
- package/src/plans.ts +236 -189
- package/src/protocol.ts +352 -242
- package/src/snapshot-url.spec.ts +9 -7
- package/src/team-subscription-protocol.ts +57 -23
- package/src/teams-projects-protocol.ts +22 -9
- package/src/typings/globals.ts +4 -4
- package/src/util/analytics.ts +46 -24
- 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/debug-app.ts +81 -0
- 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 +3 -6
- package/src/util/generate-workspace-id.spec.ts +26 -16
- package/src/util/generate-workspace-id.ts +460 -454
- package/src/util/gitpod-cookie.ts +8 -9
- package/src/util/gitpod-host-url.spec.ts +40 -13
- package/src/util/gitpod-host-url.ts +37 -34
- package/src/util/grpc.ts +1 -1
- package/src/util/jaeger-client-types.ts +2 -2
- package/src/util/logging.ts +60 -42
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +17 -8
- package/src/util/parse-workspace-id.ts +5 -6
- package/src/util/queue.spec.ts +27 -25
- package/src/util/repeat.ts +1 -1
- package/src/util/semaphore.ts +4 -6
- package/src/util/skip-if.ts +9 -6
- package/src/util/timeutil.spec.ts +14 -15
- package/src/util/timeutil.ts +21 -11
- package/src/util/tracing.spec.ts +28 -23
- package/src/util/tracing.ts +58 -54
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +26 -15
- package/src/workspace-instance.ts +68 -20
- 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 -34
- 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/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -31
- package/lib/util/safe-promise.js.map +0 -1
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/theia-plugins.ts +0 -11
- package/src/util/safe-promise.ts +0 -26
package/src/util/tracing.ts
CHANGED
|
@@ -4,35 +4,32 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { log, LogContext } from './logging';
|
|
7
|
+
import * as opentracing from "opentracing";
|
|
8
|
+
import { TracingConfig, initTracerFromEnv } from "jaeger-client";
|
|
9
|
+
import { Sampler, SamplingDecision } from "./jaeger-client-types";
|
|
10
|
+
import { initGlobalTracer } from "opentracing";
|
|
11
|
+
import { injectable } from "inversify";
|
|
12
|
+
import { ResponseError } from "vscode-jsonrpc";
|
|
13
|
+
import { log, LogContext } from "./logging";
|
|
15
14
|
|
|
16
15
|
export interface TraceContext {
|
|
17
|
-
span?: opentracing.Span
|
|
16
|
+
span?: opentracing.Span;
|
|
18
17
|
}
|
|
19
18
|
export type TraceContextWithSpan = TraceContext & {
|
|
20
|
-
span: opentracing.Span
|
|
21
|
-
}
|
|
22
|
-
|
|
19
|
+
span: opentracing.Span;
|
|
20
|
+
};
|
|
23
21
|
|
|
24
22
|
export namespace TraceContext {
|
|
25
|
-
export function startSpan(operation: string, parentCtx?: TraceContext
|
|
23
|
+
export function startSpan(operation: string, parentCtx?: TraceContext): opentracing.Span {
|
|
26
24
|
const options: opentracing.SpanOptions = {};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
.map(s => followsFrom(s!.context()));
|
|
25
|
+
|
|
26
|
+
// references should contain span id.
|
|
27
|
+
// cf. https://github.com/jaegertracing/jaeger-client-node/issues/432
|
|
28
|
+
if (!!parentCtx?.span) {
|
|
29
|
+
const ctx = parentCtx?.span?.context();
|
|
30
|
+
if (ctx && !!ctx.toTraceId() && !!ctx.toSpanId()) {
|
|
31
|
+
options.references = [opentracing.followsFrom(ctx)];
|
|
32
|
+
}
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
return opentracing.globalTracer().startSpan(operation, options);
|
|
@@ -43,18 +40,18 @@ export namespace TraceContext {
|
|
|
43
40
|
return { span };
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
export function withSpan(operation: string, callback: () => void, ctx?: TraceContext
|
|
43
|
+
export function withSpan(operation: string, callback: (ctx: TraceContext) => void, ctx?: TraceContext): void {
|
|
47
44
|
// if we don't have a parent span, don't create a trace here as those <trace-without-root-spans> are not useful.
|
|
48
45
|
if (!ctx || !ctx.span || !ctx.span.context()) {
|
|
49
|
-
callback();
|
|
46
|
+
callback({});
|
|
50
47
|
return;
|
|
51
48
|
}
|
|
52
49
|
|
|
53
|
-
const span = TraceContext.startSpan(operation, ctx
|
|
50
|
+
const span = TraceContext.startSpan(operation, ctx);
|
|
54
51
|
try {
|
|
55
|
-
callback();
|
|
52
|
+
callback({ span });
|
|
56
53
|
} catch (e) {
|
|
57
|
-
TraceContext.setError({span}, e);
|
|
54
|
+
TraceContext.setError({ span }, e);
|
|
58
55
|
throw e;
|
|
59
56
|
} finally {
|
|
60
57
|
span.finish();
|
|
@@ -92,7 +89,12 @@ export namespace TraceContext {
|
|
|
92
89
|
addNestedTags(ctx, tags);
|
|
93
90
|
}
|
|
94
91
|
|
|
95
|
-
export function setJsonRPCError(
|
|
92
|
+
export function setJsonRPCError(
|
|
93
|
+
ctx: TraceContext,
|
|
94
|
+
method: string,
|
|
95
|
+
err: ResponseError<any>,
|
|
96
|
+
withStatusCode: boolean = false,
|
|
97
|
+
) {
|
|
96
98
|
if (!ctx.span) {
|
|
97
99
|
return;
|
|
98
100
|
}
|
|
@@ -159,7 +161,7 @@ export namespace TraceContext {
|
|
|
159
161
|
if (!ctx.span) {
|
|
160
162
|
return;
|
|
161
163
|
}
|
|
162
|
-
const namespace = _namespace ? `${_namespace}.` :
|
|
164
|
+
const namespace = _namespace ? `${_namespace}.` : "";
|
|
163
165
|
|
|
164
166
|
try {
|
|
165
167
|
for (const k of Object.keys(keyValueMap)) {
|
|
@@ -188,7 +190,6 @@ export namespace TraceContext {
|
|
|
188
190
|
|
|
189
191
|
@injectable()
|
|
190
192
|
export class TracingManager {
|
|
191
|
-
|
|
192
193
|
public setup(serviceName: string, opts?: CustomTracerOpts) {
|
|
193
194
|
initGlobalTracer(this.getTracerForService(serviceName, opts));
|
|
194
195
|
}
|
|
@@ -197,16 +198,16 @@ export class TracingManager {
|
|
|
197
198
|
const config: TracingConfig = {
|
|
198
199
|
disable: false,
|
|
199
200
|
reporter: {
|
|
200
|
-
logSpans: false
|
|
201
|
+
logSpans: false,
|
|
201
202
|
},
|
|
202
203
|
serviceName,
|
|
203
|
-
}
|
|
204
|
+
};
|
|
204
205
|
const t = initTracerFromEnv(config, {
|
|
205
206
|
logger: console,
|
|
206
207
|
tags: {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
208
|
+
"service.build.commit": process.env.GITPOD_BUILD_GIT_COMMIT,
|
|
209
|
+
"service.build.version": process.env.GITPOD_BUILD_VERSION,
|
|
210
|
+
},
|
|
210
211
|
});
|
|
211
212
|
|
|
212
213
|
if (opts) {
|
|
@@ -216,24 +217,22 @@ export class TracingManager {
|
|
|
216
217
|
}
|
|
217
218
|
return t;
|
|
218
219
|
}
|
|
219
|
-
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
export interface CustomTracerOpts {
|
|
223
|
-
perOpSampling?: PerOperationSampling
|
|
223
|
+
perOpSampling?: PerOperationSampling;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
|
|
227
226
|
// has to conform to https://github.com/jaegertracing/jaeger-client-node/blob/0042b1c0a0796bb655eb93e77ff76ab5e94c2bb6/src/_flow/sampler-thrift.js#L32
|
|
228
227
|
export interface PerOperationSampling {
|
|
229
|
-
[key: string]: boolean
|
|
228
|
+
[key: string]: boolean;
|
|
230
229
|
}
|
|
231
230
|
|
|
232
231
|
export class PerOperationSampler implements Sampler {
|
|
233
232
|
constructor(protected readonly fallback: Sampler, protected readonly strategies: PerOperationSampling) {}
|
|
234
233
|
|
|
235
234
|
name(): string {
|
|
236
|
-
return
|
|
235
|
+
return "PerOperationSampler";
|
|
237
236
|
}
|
|
238
237
|
|
|
239
238
|
toString(): string {
|
|
@@ -273,7 +272,7 @@ export class PerOperationSampler implements Sampler {
|
|
|
273
272
|
return false; // TODO equal should be removed
|
|
274
273
|
}
|
|
275
274
|
|
|
276
|
-
close(callback: ()=>void): void {
|
|
275
|
+
close(callback: () => void): void {
|
|
277
276
|
// all nested samplers are of simple types, so we do not need to Close them
|
|
278
277
|
if (callback) {
|
|
279
278
|
callback();
|
|
@@ -282,18 +281,23 @@ export class PerOperationSampler implements Sampler {
|
|
|
282
281
|
}
|
|
283
282
|
|
|
284
283
|
// Augment interfaces with an leading parameter "TraceContext" on every method
|
|
285
|
-
type IsValidArg<T> = T extends object ? keyof T extends never ? false : true : true;
|
|
286
|
-
type AddTraceContext<T> =
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
IsValidArg<E> extends true
|
|
290
|
-
|
|
291
|
-
IsValidArg<
|
|
292
|
-
|
|
293
|
-
IsValidArg<
|
|
294
|
-
(ctx: TraceContextWithSpan) =>
|
|
295
|
-
|
|
284
|
+
type IsValidArg<T> = T extends object ? (keyof T extends never ? false : true) : true;
|
|
285
|
+
type AddTraceContext<T> = T extends (a: infer A, b: infer B, c: infer C, d: infer D, e: infer E, f: infer F) => infer R
|
|
286
|
+
? IsValidArg<F> extends true
|
|
287
|
+
? (ctx: TraceContextWithSpan, a: A, b: B, c: C, d: D, e: E, f: F) => R
|
|
288
|
+
: IsValidArg<E> extends true
|
|
289
|
+
? (ctx: TraceContextWithSpan, a: A, b: B, c: C, d: D, e: E) => R
|
|
290
|
+
: IsValidArg<D> extends true
|
|
291
|
+
? (ctx: TraceContextWithSpan, a: A, b: B, c: C, d: D) => R
|
|
292
|
+
: IsValidArg<C> extends true
|
|
293
|
+
? (ctx: TraceContextWithSpan, a: A, b: B, c: C) => R
|
|
294
|
+
: IsValidArg<B> extends true
|
|
295
|
+
? (ctx: TraceContextWithSpan, a: A, b: B) => R
|
|
296
|
+
: IsValidArg<A> extends true
|
|
297
|
+
? (ctx: TraceContextWithSpan, a: A) => R
|
|
298
|
+
: (ctx: TraceContextWithSpan) => Promise<R>
|
|
299
|
+
: never;
|
|
296
300
|
|
|
297
301
|
export type InterfaceWithTraceContext<T> = {
|
|
298
|
-
[P in keyof T]: AddTraceContext<T[P]
|
|
299
|
-
};
|
|
302
|
+
[P in keyof T]: AddTraceContext<T[P]>;
|
|
303
|
+
};
|
|
@@ -5,16 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* These cookies are set in the Theia frontend. This pattern is relied upon in:
|
|
9
|
-
* - proxy:
|
|
10
|
-
* - to filter it out on port locations
|
|
11
|
-
* - to forward it to the server for authentication
|
|
12
|
-
* - server:
|
|
13
|
-
* - to authenticate access to port locations
|
|
14
|
-
*/
|
|
15
|
-
export const worspacePortAuthCookieName = function(host: string, workspaceId: string): string {
|
|
16
|
-
return host
|
|
17
|
-
|
|
18
|
-
.replace(/[\W_]+/g, "_")
|
|
19
|
-
+ `_ws_${workspaceId}_port_auth_`;
|
|
20
|
-
};
|
|
8
|
+
* These cookies are set in the Theia frontend. This pattern is relied upon in:
|
|
9
|
+
* - proxy:
|
|
10
|
+
* - to filter it out on port locations
|
|
11
|
+
* - to forward it to the server for authentication
|
|
12
|
+
* - server:
|
|
13
|
+
* - to authenticate access to port locations
|
|
14
|
+
*/
|
|
15
|
+
export const worspacePortAuthCookieName = function (host: string, workspaceId: string): string {
|
|
16
|
+
return host.replace(/https?/, "").replace(/[\W_]+/g, "_") + `_ws_${workspaceId}_port_auth_`;
|
|
17
|
+
};
|
package/src/workspace-cluster.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import * as fs from
|
|
8
|
-
import { filePathTelepresenceAware } from
|
|
7
|
+
import * as fs from "fs";
|
|
8
|
+
import { filePathTelepresenceAware } from "./env";
|
|
9
9
|
import { DeepPartial } from "./util/deep-partial";
|
|
10
|
-
import { PermissionName } from
|
|
10
|
+
import { PermissionName } from "./permission";
|
|
11
11
|
|
|
12
12
|
export interface WorkspaceCluster {
|
|
13
13
|
// Name of the workspace cluster.
|
|
@@ -35,9 +35,6 @@ export interface WorkspaceCluster {
|
|
|
35
35
|
|
|
36
36
|
// An optional set of constraints that limit who can start workspaces on the cluster
|
|
37
37
|
admissionConstraints?: AdmissionConstraint[];
|
|
38
|
-
|
|
39
|
-
// An optional set of admission preferences that guide cluster selection
|
|
40
|
-
admissionPreferences?: AdmissionPreference[];
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
export type WorkspaceClusterState = "available" | "cordoned" | "draining";
|
|
@@ -50,19 +47,33 @@ export interface TLSConfig {
|
|
|
50
47
|
crt: string;
|
|
51
48
|
}
|
|
52
49
|
export namespace TLSConfig {
|
|
53
|
-
export const loadFromBase64File = (path: string): string =>
|
|
50
|
+
export const loadFromBase64File = (path: string): string =>
|
|
51
|
+
fs.readFileSync(filePathTelepresenceAware(path)).toString("base64");
|
|
54
52
|
}
|
|
55
53
|
export type WorkspaceClusterWoTLS = Omit<WorkspaceCluster, "tls">;
|
|
56
54
|
export type WorkspaceManagerConnectionInfo = Pick<WorkspaceCluster, "name" | "url" | "tls">;
|
|
57
55
|
|
|
58
|
-
export type AdmissionConstraint =
|
|
56
|
+
export type AdmissionConstraint =
|
|
57
|
+
| AdmissionConstraintFeaturePreview
|
|
58
|
+
| AdmissionConstraintHasPermission
|
|
59
|
+
| AdmissionConstraintHasUserLevel
|
|
60
|
+
| AdmissionConstraintHasMoreResources;
|
|
59
61
|
export type AdmissionConstraintFeaturePreview = { type: "has-feature-preview" };
|
|
60
|
-
export type
|
|
61
|
-
export type AdmissionConstraintHasUserLevel = { type: "has-user-level"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export
|
|
65
|
-
|
|
62
|
+
export type AdmissionConstraintHasPermission = { type: "has-permission"; permission: PermissionName };
|
|
63
|
+
export type AdmissionConstraintHasUserLevel = { type: "has-user-level"; level: string };
|
|
64
|
+
export type AdmissionConstraintHasMoreResources = { type: "has-more-resources" };
|
|
65
|
+
|
|
66
|
+
export namespace AdmissionConstraint {
|
|
67
|
+
export function is(o: any): o is AdmissionConstraint {
|
|
68
|
+
return !!o && "type" in o;
|
|
69
|
+
}
|
|
70
|
+
export function isHasPermissionConstraint(o: any): o is AdmissionConstraintHasPermission {
|
|
71
|
+
return is(o) && o.type === "has-permission";
|
|
72
|
+
}
|
|
73
|
+
export function hasPermission(ac: AdmissionConstraint, permission: PermissionName): boolean {
|
|
74
|
+
return isHasPermissionConstraint(ac) && ac.permission === permission;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
66
77
|
|
|
67
78
|
export const WorkspaceClusterDB = Symbol("WorkspaceClusterDB");
|
|
68
79
|
export interface WorkspaceClusterDB {
|
|
@@ -93,4 +104,4 @@ export interface WorkspaceClusterDB {
|
|
|
93
104
|
}
|
|
94
105
|
export interface WorkspaceClusterFilter extends Pick<WorkspaceCluster, "state" | "govern" | "url"> {
|
|
95
106
|
minScore: number;
|
|
96
|
-
}
|
|
107
|
+
}
|
|
@@ -51,6 +51,23 @@ export interface WorkspaceInstance {
|
|
|
51
51
|
|
|
52
52
|
// instance is hard-deleted on the database and about to be collected by db-sync
|
|
53
53
|
readonly deleted?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Contains information about the image build, if there was any
|
|
57
|
+
*/
|
|
58
|
+
imageBuildInfo?: ImageBuildInfo;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* workspace class, also known as workspace size, determines the type of
|
|
62
|
+
* resources that are provided to the workspace.
|
|
63
|
+
*/
|
|
64
|
+
workspaceClass?: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Identifies the team or user to which this instance's runtime should be attributed to
|
|
68
|
+
* (e.g. for usage analytics or billing purposes).
|
|
69
|
+
*/
|
|
70
|
+
usageAttributionId?: string;
|
|
54
71
|
}
|
|
55
72
|
|
|
56
73
|
// WorkspaceInstanceStatus describes the current state of a workspace instance
|
|
@@ -90,49 +107,54 @@ export interface WorkspaceInstanceStatus {
|
|
|
90
107
|
export type WorkspaceInstancePhase =
|
|
91
108
|
// unknown indicates an issue within the system in that it cannot determine the actual phase of
|
|
92
109
|
// a workspace. This phase is usually accompanied by an error.
|
|
93
|
-
"unknown"
|
|
110
|
+
| "unknown"
|
|
94
111
|
|
|
95
112
|
// Preparing means that we haven't actually started the workspace instance just yet, but rather
|
|
96
|
-
// are still preparing for launch.
|
|
97
|
-
"preparing"
|
|
113
|
+
// are still preparing for launch.
|
|
114
|
+
| "preparing"
|
|
115
|
+
|
|
116
|
+
// Building means that we are building the Docker image for the workspace. A workspace will enter this phase only
|
|
117
|
+
// if an image build is required for that workspace.
|
|
118
|
+
| "building"
|
|
98
119
|
|
|
99
120
|
// Pending means the workspace does not yet consume resources in the cluster, but rather is looking for
|
|
100
121
|
// some space within the cluster. If for example the cluster needs to scale up to accomodate the
|
|
101
122
|
// workspace, the workspace will be in Pending state until that happened.
|
|
102
|
-
"pending"
|
|
123
|
+
| "pending"
|
|
103
124
|
|
|
104
125
|
// Creating means the workspace is currently being created. Thati includes downloading the images required
|
|
105
126
|
// to run the workspace over the network. The time spent in this phase varies widely and depends on the current
|
|
106
127
|
// network speed, image size and cache states.
|
|
107
|
-
"creating"
|
|
128
|
+
| "creating"
|
|
108
129
|
|
|
109
130
|
// Initializing is the phase in which the workspace is executing the appropriate workspace initializer (e.g. Git
|
|
110
131
|
// clone or backup download). After this phase one can expect the workspace to either be Running or Failed.
|
|
111
|
-
"initializing"
|
|
132
|
+
| "initializing"
|
|
112
133
|
|
|
113
134
|
// Running means the workspace is able to actively perform work, either by serving a user through Theia,
|
|
114
135
|
// or as a headless workspace.
|
|
115
|
-
"running"
|
|
136
|
+
| "running"
|
|
116
137
|
|
|
117
138
|
// Interrupted is an exceptional state where the container should be running but is temporarily unavailable.
|
|
118
139
|
// When in this state, we expect it to become running or stopping anytime soon.
|
|
119
|
-
"interrupted"
|
|
140
|
+
| "interrupted"
|
|
120
141
|
|
|
121
142
|
// Stopping means that the workspace is currently shutting down. It could go to stopped every moment.
|
|
122
|
-
"stopping"
|
|
143
|
+
| "stopping"
|
|
123
144
|
|
|
124
145
|
// Stopped means the workspace ended regularly because it was shut down.
|
|
125
|
-
"stopped";
|
|
146
|
+
| "stopped";
|
|
126
147
|
|
|
127
148
|
export interface WorkspaceInstanceConditions {
|
|
128
149
|
// Failed contains the reason the workspace failed to operate. If this field is empty, the workspace has not failed.
|
|
129
|
-
failed
|
|
150
|
+
// failed contains technical details for the failure of the workspace.
|
|
151
|
+
failed?: string;
|
|
130
152
|
|
|
131
153
|
// timeout contains the reason the workspace has timed out. If this field is empty, the workspace has not timed out.
|
|
132
|
-
timeout?: string
|
|
154
|
+
timeout?: string;
|
|
133
155
|
|
|
134
156
|
// PullingImages marks if the workspace is currently pulling its images. This condition can only be set during PhaseCreating
|
|
135
|
-
pullingImages?: boolean
|
|
157
|
+
pullingImages?: boolean;
|
|
136
158
|
|
|
137
159
|
// deployed marks that a workspace instance was sent/deployed at a workspace manager
|
|
138
160
|
deployed?: boolean;
|
|
@@ -143,7 +165,10 @@ export interface WorkspaceInstanceConditions {
|
|
|
143
165
|
// ISO8601 timestamp when the first user activity was registered in the frontend. Only set if the workspace is running.
|
|
144
166
|
firstUserActivity?: string;
|
|
145
167
|
|
|
146
|
-
//
|
|
168
|
+
// headlessTaskFailed indicates that a headless workspace task failed
|
|
169
|
+
// headlessTaskFailed is only set if:
|
|
170
|
+
// * this workspace is headless
|
|
171
|
+
// * the task being run returned a non 0 exit status code
|
|
147
172
|
headlessTaskFailed?: string;
|
|
148
173
|
|
|
149
174
|
// stopped_by_request is true if the workspace was stopped using a StopWorkspace call
|
|
@@ -151,10 +176,10 @@ export interface WorkspaceInstanceConditions {
|
|
|
151
176
|
}
|
|
152
177
|
|
|
153
178
|
// AdmissionLevel describes who can access a workspace instance and its ports.
|
|
154
|
-
export type AdmissionLevel =
|
|
179
|
+
export type AdmissionLevel = "owner_only" | "everyone";
|
|
155
180
|
|
|
156
181
|
// PortVisibility describes how a port can be accessed
|
|
157
|
-
export type PortVisibility =
|
|
182
|
+
export type PortVisibility = "public" | "private";
|
|
158
183
|
|
|
159
184
|
// WorkspaceInstancePort describes a port exposed on a workspace instance
|
|
160
185
|
export interface WorkspaceInstancePort {
|
|
@@ -180,19 +205,25 @@ export interface WorkspaceInstanceRepoStatus {
|
|
|
180
205
|
uncommitedFiles?: string[];
|
|
181
206
|
|
|
182
207
|
// the total number of uncommited files
|
|
183
|
-
totalUncommitedFiles?: number
|
|
208
|
+
totalUncommitedFiles?: number;
|
|
184
209
|
|
|
185
210
|
// untrackedFiles is the list of untracked files in the workspace, possibly truncated
|
|
186
211
|
untrackedFiles?: string[];
|
|
187
212
|
|
|
188
213
|
// the total number of untracked files
|
|
189
|
-
totalUntrackedFiles?: number
|
|
214
|
+
totalUntrackedFiles?: number;
|
|
190
215
|
|
|
191
216
|
// unpushedCommits is the list of unpushed changes in the workspace, possibly truncated
|
|
192
217
|
unpushedCommits?: string[];
|
|
193
218
|
|
|
194
219
|
// the total number of unpushed changes
|
|
195
|
-
totalUnpushedCommits?: number
|
|
220
|
+
totalUnpushedCommits?: number;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// ConfigurationIdeConfig ide config of WorkspaceInstanceConfiguration
|
|
224
|
+
export interface ConfigurationIdeConfig {
|
|
225
|
+
useLatest?: boolean;
|
|
226
|
+
desktopIdeAlias?: string;
|
|
196
227
|
}
|
|
197
228
|
|
|
198
229
|
// WorkspaceInstanceConfiguration contains all per-instance configuration
|
|
@@ -208,8 +239,25 @@ export interface WorkspaceInstanceConfiguration {
|
|
|
208
239
|
ideImage: string;
|
|
209
240
|
|
|
210
241
|
// desktopIdeImage is the ref of the desktop IDE image this instance uses.
|
|
211
|
-
desktopIdeImage?: string
|
|
242
|
+
desktopIdeImage?: string;
|
|
212
243
|
|
|
213
244
|
// supervisorImage is the ref of the supervisor image this instance uses.
|
|
214
245
|
supervisorImage?: string;
|
|
246
|
+
|
|
247
|
+
ideConfig?: ConfigurationIdeConfig;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Holds information about the image build (if there was one) for this WorkspaceInstance
|
|
252
|
+
*/
|
|
253
|
+
export interface ImageBuildInfo {
|
|
254
|
+
log?: ImageBuildLogInfo;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Holds information about how to access logs for this an image build
|
|
259
|
+
*/
|
|
260
|
+
export interface ImageBuildLogInfo {
|
|
261
|
+
url: string;
|
|
262
|
+
headers: { [key: string]: string };
|
|
215
263
|
}
|
package/src/wsready.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2022 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
4
|
* See License-AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
// generated using github.com/32leaves/bel on
|
|
7
|
+
// generated using github.com/32leaves/bel on 2022-05-18 18:19:49.011672619 +0000 UTC m=+0.006607361
|
|
8
8
|
// DO NOT MODIFY
|
|
9
9
|
|
|
10
10
|
export enum WorkspaceInitSource {
|
|
@@ -13,5 +13,5 @@ export enum WorkspaceInitSource {
|
|
|
13
13
|
WorkspaceInitFromOther = "from-other",
|
|
14
14
|
}
|
|
15
15
|
export interface WorkspaceReadyMessage {
|
|
16
|
-
source: WorkspaceInitSource
|
|
16
|
+
source: WorkspaceInitSource;
|
|
17
17
|
}
|