@gitpod/gitpod-protocol 0.1.5-tweak-workspaceconfig-origin-docs-fork.0 → 0.1.5-update-yarnlock.0
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 +150 -8
- package/lib/accounting-protocol.d.ts +21 -11
- package/lib/accounting-protocol.d.ts.map +1 -1
- package/lib/accounting-protocol.js +44 -33
- package/lib/accounting-protocol.js.map +1 -1
- package/lib/admin-protocol.d.ts +29 -1
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +5 -6
- package/lib/analytics.d.ts.map +1 -1
- package/lib/analytics.js +1 -1
- package/lib/analytics.js.map +1 -1
- package/lib/attribution.d.ts +25 -0
- package/lib/attribution.d.ts.map +1 -0
- package/lib/attribution.js +58 -0
- package/lib/attribution.js.map +1 -0
- package/lib/auth.d.ts +1 -1
- package/lib/auth.d.ts.map +1 -1
- package/lib/auth.js +1 -1
- package/lib/billing-mode.d.ts +45 -0
- package/lib/billing-mode.d.ts.map +1 -0
- package/lib/billing-mode.js +44 -0
- package/lib/billing-mode.js.map +1 -0
- 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 +19 -7
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +60 -9
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +3 -3
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +20 -12
- package/lib/context-url.spec.js.map +1 -1
- package/lib/encryption/container-module.d.ts +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +2 -2
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +10 -10
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +3 -4
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +2 -2
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +8 -10
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +1 -6
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +2 -21
- 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 +10 -0
- package/lib/experiments/configcat-server.d.ts.map +1 -0
- package/lib/experiments/configcat-server.js +37 -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 +51 -0
- package/lib/experiments/configcat.js.map +1 -0
- package/lib/experiments/types.d.ts +22 -0
- package/lib/experiments/types.d.ts.map +1 -0
- package/lib/experiments/types.js +10 -0
- package/lib/experiments/types.js.map +1 -0
- package/lib/frontend-dashboard-service.d.ts +99 -0
- package/lib/frontend-dashboard-service.d.ts.map +1 -0
- package/lib/frontend-dashboard-service.js +55 -0
- package/lib/frontend-dashboard-service.js.map +1 -0
- package/lib/gitpod-file-parser.d.ts +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +7 -7
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.d.ts +1 -1
- package/lib/gitpod-file-parser.spec.js +43 -40
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +143 -51
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +78 -36
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +2 -1
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +3 -2
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +2 -2
- package/lib/ide-frontend-service.js +1 -1
- package/lib/ide-protocol.d.ts +53 -8
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/ide-protocol.js +11 -1
- package/lib/ide-protocol.js.map +1 -1
- package/lib/index.d.ts +17 -15
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +30 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +31 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/license-protocol.d.ts +8 -1
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js +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 +5 -5
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +10 -7
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +5 -19
- package/lib/messaging/client-call-metrics.d.ts.map +1 -1
- package/lib/messaging/client-call-metrics.js +35 -23
- package/lib/messaging/client-call-metrics.js.map +1 -1
- package/lib/messaging/error.d.ts +12 -2
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +26 -4
- 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.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +23 -59
- 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/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 +1 -1
- package/lib/payment-protocol.d.ts.map +1 -1
- package/lib/payment-protocol.js +2 -2
- package/lib/payment-protocol.js.map +1 -1
- package/lib/permission.d.ts +13 -4
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +38 -26
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +8 -5
- package/lib/plans.d.ts.map +1 -1
- package/lib/plans.js +227 -172
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +238 -104
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +322 -105
- package/lib/protocol.js.map +1 -1
- package/lib/protocol.spec.d.ts +7 -0
- package/lib/protocol.spec.d.ts.map +1 -0
- package/lib/protocol.spec.js +127 -0
- package/lib/protocol.spec.js.map +1 -0
- package/lib/snapshot-url.d.ts +1 -1
- package/lib/snapshot-url.js +1 -1
- package/lib/snapshot-url.spec.d.ts +1 -1
- package/lib/snapshot-url.spec.js +1 -1
- package/lib/snapshot-url.spec.js.map +1 -1
- package/lib/team-subscription-protocol.d.ts +24 -4
- package/lib/team-subscription-protocol.d.ts.map +1 -1
- package/lib/team-subscription-protocol.js +25 -6
- package/lib/team-subscription-protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +39 -6
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +21 -3
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/typings/globals.d.ts +7 -3
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/typings/globals.js +1 -1
- package/lib/usage.d.ts +73 -0
- package/lib/usage.d.ts.map +1 -0
- package/lib/usage.js +20 -0
- package/lib/usage.js.map +1 -0
- package/lib/util/analytics.d.ts +1 -1
- package/lib/util/analytics.d.ts.map +1 -1
- package/lib/util/analytics.js +13 -4
- package/lib/util/analytics.js.map +1 -1
- package/lib/util/async-iterator.d.ts +1 -1
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +4 -4
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +1 -1
- package/lib/util/cancelable.js +1 -1
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +1 -1
- package/lib/util/date-time.js +7 -7
- 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/deep-partial.d.ts +1 -1
- package/lib/util/deep-partial.js +1 -1
- package/lib/util/deferred.d.ts +1 -1
- package/lib/util/deferred.js +1 -1
- 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 +2 -1
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +12 -3
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +6 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +461 -440
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.d.ts +1 -1
- package/lib/util/generate-workspace-id.spec.js +37 -2
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +2 -2
- package/lib/util/gitpod-cookie.d.ts.map +1 -1
- package/lib/util/gitpod-cookie.js +1 -4
- package/lib/util/gitpod-cookie.js.map +1 -1
- package/lib/util/gitpod-host-url.d.ts +12 -5
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +69 -41
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +16 -6
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +21 -1
- package/lib/util/grpc.d.ts.map +1 -1
- package/lib/util/grpc.js +74 -2
- package/lib/util/grpc.js.map +1 -1
- 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} +2 -2
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +2 -2
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +32 -26
- package/lib/util/logging.js.map +1 -1
- package/lib/util/logging.spec.d.ts +7 -0
- package/lib/util/logging.spec.d.ts.map +1 -0
- package/lib/util/logging.spec.js +52 -0
- package/lib/util/logging.spec.js.map +1 -0
- package/lib/util/make-link.d.ts +1 -1
- package/lib/util/make-link.js +6 -6
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/nice-grpc.d.ts +9 -0
- package/lib/util/nice-grpc.d.ts.map +1 -0
- package/lib/util/nice-grpc.js +121 -0
- package/lib/util/nice-grpc.js.map +1 -0
- package/lib/util/parse-workspace-id.d.ts +1 -1
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +3 -4
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +1 -1
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +1 -1
- package/lib/util/queue.js +1 -1
- package/lib/util/queue.spec.d.ts +1 -1
- package/lib/util/queue.spec.js +10 -7
- 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 +1 -1
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +1 -1
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +1 -1
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +3 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +16 -4
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +3 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +35 -1
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +47 -13
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +141 -32
- 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 +8 -8
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +9 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/webhook-event.d.ts +44 -0
- package/lib/webhook-event.d.ts.map +1 -0
- package/lib/webhook-event.js +8 -0
- package/lib/webhook-event.js.map +1 -0
- package/lib/workspace-class.d.ts +14 -0
- package/lib/workspace-class.d.ts.map +1 -0
- package/lib/workspace-class.js +8 -0
- package/lib/workspace-class.js.map +1 -0
- package/lib/workspace-cluster.d.ts +24 -18
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +22 -2
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +41 -4
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +1 -1
- package/lib/wsready.d.ts +8 -2
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +3 -3
- package/package.json +18 -8
- package/pkg-yarn.lock +11 -6
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +76 -52
- package/src/admin-protocol.ts +59 -19
- package/src/analytics.ts +27 -29
- package/src/attribution.ts +67 -0
- package/src/auth.ts +3 -3
- package/src/billing-mode.ts +84 -0
- package/src/blocked-repositories-protocol.ts +13 -0
- package/src/context-url.spec.ts +25 -15
- package/src/context-url.ts +93 -37
- package/src/encryption/container-module.ts +3 -4
- package/src/encryption/encryption-engine.spec.ts +10 -9
- package/src/encryption/encryption-engine.ts +21 -17
- package/src/encryption/encryption-service.ts +5 -6
- package/src/encryption/key-provider.ts +17 -20
- package/src/env.ts +2 -25
- package/src/experiments/always-default.ts +24 -0
- package/src/experiments/configcat-server.ts +42 -0
- package/src/experiments/configcat.ts +56 -0
- package/src/experiments/types.ts +34 -0
- package/src/frontend-dashboard-service.ts +148 -0
- package/src/gitpod-file-parser.spec.ts +56 -62
- package/src/gitpod-file-parser.ts +17 -18
- package/src/gitpod-service.ts +315 -136
- package/src/headless-workspace-log.ts +7 -5
- package/src/ide-frontend-service.ts +3 -3
- package/src/ide-protocol.ts +63 -8
- package/src/index.ts +17 -15
- package/src/installation-admin-protocol.ts +45 -0
- package/src/license-protocol.ts +13 -7
- package/src/messaging/browser/connection.ts +45 -47
- package/src/messaging/browser/window-connection.ts +40 -30
- package/src/messaging/client-call-metrics.ts +79 -82
- package/src/messaging/error.ts +37 -8
- package/src/messaging/handler.ts +6 -6
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +23 -30
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +3 -3
- package/src/permission.ts +45 -33
- package/src/plans.ts +257 -190
- package/src/protocol.spec.ts +97 -0
- package/src/protocol.ts +650 -305
- package/src/snapshot-url.spec.ts +10 -8
- package/src/snapshot-url.ts +1 -1
- package/src/team-subscription-protocol.ts +63 -23
- package/src/teams-projects-protocol.ts +60 -12
- package/src/typings/globals.ts +12 -5
- package/src/usage.ts +85 -0
- package/src/util/analytics.ts +47 -25
- package/src/util/async-iterator.ts +5 -6
- package/src/util/cancelable.ts +4 -4
- package/src/util/date-time.ts +9 -9
- package/src/util/debug-app.ts +81 -0
- package/src/util/deep-partial.ts +1 -1
- package/src/util/deferred.ts +7 -7
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +15 -7
- package/src/util/generate-workspace-id.spec.ts +35 -8
- package/src/util/generate-workspace-id.ts +465 -441
- package/src/util/gitpod-cookie.ts +9 -10
- package/src/util/gitpod-host-url.spec.ts +41 -14
- package/src/util/gitpod-host-url.ts +81 -46
- package/src/util/grpc.ts +94 -2
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.spec.ts +23 -0
- package/src/util/logging.ts +61 -43
- package/src/util/make-link.ts +7 -8
- package/src/util/nice-grpc.ts +96 -0
- package/src/util/parse-workspace-id.spec.ts +18 -9
- package/src/util/parse-workspace-id.ts +7 -8
- package/src/util/queue.spec.ts +28 -26
- package/src/util/queue.ts +1 -1
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +5 -7
- package/src/util/skip-if.ts +10 -7
- package/src/util/timeutil.spec.ts +41 -15
- package/src/util/timeutil.ts +28 -12
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +175 -59
- package/src/util/workspace-port-authentication.ts +11 -14
- package/src/webhook-event.ts +55 -0
- package/src/workspace-class.ts +14 -0
- package/src/workspace-cluster.ts +46 -21
- package/src/workspace-instance.ts +84 -22
- package/src/wsready.ts +11 -4
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/email-protocol.d.ts +0 -49
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -28
- package/lib/email-protocol.js.map +0 -1
- 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/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -65
- 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 -31
- package/lib/util/safe-promise.js.map +0 -1
- package/src/email-protocol.ts +0 -66
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/theia-plugins.ts +0 -11
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
|
-
* See License
|
|
5
|
+
* See License.AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
7
7
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
8
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -20,6 +20,10 @@ const expect = chai.expect;
|
|
|
20
20
|
const mocha_typescript_1 = require("mocha-typescript");
|
|
21
21
|
const timeutil_1 = require("./timeutil");
|
|
22
22
|
let TimeutilSpec = class TimeutilSpec {
|
|
23
|
+
testDaysBefore() {
|
|
24
|
+
const now = new Date().toISOString();
|
|
25
|
+
expect((0, timeutil_1.daysBefore)(now, 2)).to.be.eq((0, timeutil_1.hoursBefore)(now, 48));
|
|
26
|
+
}
|
|
23
27
|
testTimeutil() {
|
|
24
28
|
// targeting a 1st, 1th of Jan => 1st of Feb
|
|
25
29
|
this.isOneMonthLater(new Date(2000, 0, 1), 1, new Date(2000, 1, 1));
|
|
@@ -41,13 +45,43 @@ let TimeutilSpec = class TimeutilSpec {
|
|
|
41
45
|
const later = (0, timeutil_1.oneMonthLater)(from.toISOString(), day);
|
|
42
46
|
expect(later, `expected ${later} to be equal ${expectation}`).to.be.equal(expectation.toISOString());
|
|
43
47
|
}
|
|
48
|
+
testDaysBefore2() {
|
|
49
|
+
const tests = [
|
|
50
|
+
{
|
|
51
|
+
date: new Date("2021-07-13T00:00:00.000Z"),
|
|
52
|
+
daysEarlier: 365,
|
|
53
|
+
expectation: "2020-07-13T00:00:00.000Z",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
date: new Date("2019-02-01T00:00:00.000Z"),
|
|
57
|
+
daysEarlier: 365,
|
|
58
|
+
expectation: "2018-02-01T00:00:00.000Z",
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
for (const t of tests) {
|
|
62
|
+
const actual = (0, timeutil_1.daysBefore)(t.date.toISOString(), t.daysEarlier);
|
|
63
|
+
expect(actual).to.equal(t.expectation, `expected ${actual} to be equal ${t.expectation}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
44
66
|
};
|
|
67
|
+
__decorate([
|
|
68
|
+
mocha_typescript_1.test,
|
|
69
|
+
__metadata("design:type", Function),
|
|
70
|
+
__metadata("design:paramtypes", []),
|
|
71
|
+
__metadata("design:returntype", void 0)
|
|
72
|
+
], TimeutilSpec.prototype, "testDaysBefore", null);
|
|
45
73
|
__decorate([
|
|
46
74
|
mocha_typescript_1.test,
|
|
47
75
|
__metadata("design:type", Function),
|
|
48
76
|
__metadata("design:paramtypes", []),
|
|
49
77
|
__metadata("design:returntype", void 0)
|
|
50
78
|
], TimeutilSpec.prototype, "testTimeutil", null);
|
|
79
|
+
__decorate([
|
|
80
|
+
mocha_typescript_1.test,
|
|
81
|
+
__metadata("design:type", Function),
|
|
82
|
+
__metadata("design:paramtypes", []),
|
|
83
|
+
__metadata("design:returntype", void 0)
|
|
84
|
+
], TimeutilSpec.prototype, "testDaysBefore2", null);
|
|
51
85
|
TimeutilSpec = __decorate([
|
|
52
86
|
(0, mocha_typescript_1.suite)()
|
|
53
87
|
], TimeutilSpec);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeutil.spec.js","sourceRoot":"","sources":["../../src/util/timeutil.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,6BAA6B;AAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAC3B,uDAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"timeutil.spec.js","sourceRoot":"","sources":["../../src/util/timeutil.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,6BAA6B;AAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAC3B,uDAA+C;AAC/C,yCAAoE;AAGpE,IAAa,YAAY,GAAzB,MAAa,YAAY;IAErB,cAAc;QACV,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrC,MAAM,CAAC,IA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MAAM,gBAAgB,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;SAC7F;IACL,CAAC;CACJ,CAAA;AAtDG;IADC,uBAAI;;;;kDAIJ;AAGD;IADC,uBAAI;;;;gDAsBJ;AAQD;IADC,uBAAI;;;;mDAmBJ;AAvDQ,YAAY;IADxB,IAAA,wBAAK,GAAE;GACK,YAAY,CAwDxB;AAxDY,oCAAY"}
|
package/lib/util/tracing.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
4
|
+
* See License.AGPL.txt in the project root for license information.
|
|
5
5
|
*/
|
|
6
|
-
import * as opentracing from
|
|
7
|
-
import { Sampler, SamplingDecision } from
|
|
8
|
-
import { ResponseError } from
|
|
6
|
+
import * as opentracing from "opentracing";
|
|
7
|
+
import { Sampler, SamplingDecision } from "./jaeger-client-types";
|
|
8
|
+
import { ResponseError } from "vscode-jsonrpc";
|
|
9
|
+
import { LogContext } from "./logging";
|
|
9
10
|
export interface TraceContext {
|
|
10
11
|
span?: opentracing.Span;
|
|
11
12
|
}
|
|
@@ -13,16 +14,49 @@ export declare type TraceContextWithSpan = TraceContext & {
|
|
|
13
14
|
span: opentracing.Span;
|
|
14
15
|
};
|
|
15
16
|
export declare namespace TraceContext {
|
|
16
|
-
function startSpan(operation: string, parentCtx
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
17
|
+
function startSpan(operation: string, parentCtx?: TraceContext): opentracing.Span;
|
|
18
|
+
function childContext(operation: string, parentCtx: TraceContext): TraceContextWithSpan;
|
|
19
|
+
function withSpan(operation: string, callback: (ctx: TraceContext) => void, ctx?: TraceContext): void;
|
|
20
|
+
function setError(ctx: TraceContext, err: Error): void;
|
|
21
|
+
function setJsonRPCMetadata(ctx: TraceContext, method?: string): void;
|
|
22
|
+
function setJsonRPCError(ctx: TraceContext, method: string, err: ResponseError<any>, withStatusCode?: boolean): void;
|
|
23
|
+
function addJsonRPCParameters(ctx: TraceContext, params: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}): void;
|
|
26
|
+
/**
|
|
27
|
+
* Does what one would expect from `span.addTags`: Calls `span.addTag` for all keys in map, recursively for objects.
|
|
28
|
+
* Example:
|
|
29
|
+
* ```
|
|
30
|
+
* TraceContext.addNestedTags(ctx, {
|
|
31
|
+
* rpc: {
|
|
32
|
+
* system: "jsonrpc",
|
|
33
|
+
* jsonrpc: {
|
|
34
|
+
* version: "1.0",
|
|
35
|
+
* method: "test",
|
|
36
|
+
* parameters: ["abc", "def"],
|
|
37
|
+
* },
|
|
38
|
+
* },
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
* gives
|
|
42
|
+
* rpc.system = "jsonrpc"
|
|
43
|
+
* rpc.jsonrpc.version = "1.0"
|
|
44
|
+
* rpc.jsonrpc.method = "test"
|
|
45
|
+
* rpc.jsonrpc.parameters.0 = "abc"
|
|
46
|
+
* rpc.jsonrpc.parameters.1 = "def"
|
|
47
|
+
* @param ctx
|
|
48
|
+
* @param keyValueMap
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
function addNestedTags(ctx: TraceContext, keyValueMap: {
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
}, _namespace?: string): void;
|
|
54
|
+
function setOWI(ctx: TraceContext, owi: LogContext): void;
|
|
55
|
+
function finishOnce(span: opentracing.Span): () => void;
|
|
22
56
|
}
|
|
23
57
|
export declare class TracingManager {
|
|
24
58
|
setup(serviceName: string, opts?: CustomTracerOpts): void;
|
|
25
|
-
getTracerForService(serviceName: string, opts?: CustomTracerOpts):
|
|
59
|
+
getTracerForService(serviceName: string, opts?: CustomTracerOpts): import("jaeger-client").JaegerTracer;
|
|
26
60
|
}
|
|
27
61
|
export interface CustomTracerOpts {
|
|
28
62
|
perOpSampling?: PerOperationSampling;
|
|
@@ -43,8 +77,8 @@ export declare class PerOperationSampler implements Sampler {
|
|
|
43
77
|
equal(other: Sampler): boolean;
|
|
44
78
|
close(callback: () => void): void;
|
|
45
79
|
}
|
|
46
|
-
declare type IsValidArg<T> = T extends object ? keyof T extends never ? false : true : true;
|
|
47
|
-
declare 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 ?
|
|
80
|
+
declare type IsValidArg<T> = T extends object ? (keyof T extends never ? false : true) : true;
|
|
81
|
+
declare 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 ? IsValidArg<F> extends true ? (ctx: TraceContextWithSpan, a: A, b: B, c: C, d: D, e: E, f: F) => R : IsValidArg<E> extends true ? (ctx: TraceContextWithSpan, a: A, b: B, c: C, d: D, e: E) => R : IsValidArg<D> extends true ? (ctx: TraceContextWithSpan, a: A, b: B, c: C, d: D) => R : IsValidArg<C> extends true ? (ctx: TraceContextWithSpan, a: A, b: B, c: C) => R : IsValidArg<B> extends true ? (ctx: TraceContextWithSpan, a: A, b: B) => R : IsValidArg<A> extends true ? (ctx: TraceContextWithSpan, a: A) => R : (ctx: TraceContextWithSpan) => Promise<R> : never;
|
|
48
82
|
export declare type InterfaceWithTraceContext<T> = {
|
|
49
83
|
[P in keyof T]: AddTraceContext<T[P]>;
|
|
50
84
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/util/tracing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../src/util/tracing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EA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,CAAC,KAAK,CAAC,GAC5C,UAAU,CAAC,CAAC,CAAC,SAAS,IAAI,GAC1B,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,GACtC,CAAC,GAAG,EAAE,oBAAoB,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7C,KAAK,CAAC;AAEZ,oBAAY,yBAAyB,CAAC,CAAC,IAAI;KACtC,CAAC,IAAI,MAAM,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACxC,CAAC"}
|
package/lib/util/tracing.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
4
4
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
5
|
-
* See License
|
|
5
|
+
* See License.AGPL.txt in the project root for license information.
|
|
6
6
|
*/
|
|
7
7
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
8
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -16,72 +16,177 @@ const opentracing = require("opentracing");
|
|
|
16
16
|
const jaeger_client_1 = require("jaeger-client");
|
|
17
17
|
const opentracing_1 = require("opentracing");
|
|
18
18
|
const inversify_1 = require("inversify");
|
|
19
|
+
const logging_1 = require("./logging");
|
|
19
20
|
var TraceContext;
|
|
20
21
|
(function (TraceContext) {
|
|
21
22
|
function startSpan(operation, parentCtx) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
var _a;
|
|
24
|
+
const options = {};
|
|
25
|
+
// references should contain span id.
|
|
26
|
+
// cf. https://github.com/jaegertracing/jaeger-client-node/issues/432
|
|
27
|
+
if (!!(parentCtx === null || parentCtx === void 0 ? void 0 : parentCtx.span)) {
|
|
28
|
+
const ctx = (_a = parentCtx === null || parentCtx === void 0 ? void 0 : parentCtx.span) === null || _a === void 0 ? void 0 : _a.context();
|
|
29
|
+
if (ctx && !!ctx.toTraceId() && !!ctx.toSpanId()) {
|
|
30
|
+
options.references = [opentracing.followsFrom(ctx)];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
25
33
|
return opentracing.globalTracer().startSpan(operation, options);
|
|
26
34
|
}
|
|
27
35
|
TraceContext.startSpan = startSpan;
|
|
28
|
-
function
|
|
36
|
+
function childContext(operation, parentCtx) {
|
|
29
37
|
const span = startSpan(operation, parentCtx);
|
|
30
38
|
return { span };
|
|
31
39
|
}
|
|
32
|
-
TraceContext.
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
40
|
+
TraceContext.childContext = childContext;
|
|
41
|
+
function withSpan(operation, callback, ctx) {
|
|
42
|
+
// if we don't have a parent span, don't create a trace here as those <trace-without-root-spans> are not useful.
|
|
43
|
+
if (!ctx || !ctx.span || !ctx.span.context()) {
|
|
44
|
+
callback({});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const span = TraceContext.startSpan(operation, ctx);
|
|
48
|
+
try {
|
|
49
|
+
callback({ span });
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
TraceContext.setError({ span }, e);
|
|
53
|
+
throw e;
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
span.finish();
|
|
37
57
|
}
|
|
38
|
-
return opentracing.globalTracer().startSpan(operation, options);
|
|
39
58
|
}
|
|
40
|
-
TraceContext.
|
|
41
|
-
function
|
|
59
|
+
TraceContext.withSpan = withSpan;
|
|
60
|
+
function setError(ctx, err) {
|
|
42
61
|
if (!ctx.span) {
|
|
43
62
|
return;
|
|
44
63
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
TraceContext.addNestedTags(ctx, {
|
|
65
|
+
error: {
|
|
66
|
+
message: err.message,
|
|
67
|
+
stacktrace: err.stack,
|
|
68
|
+
},
|
|
48
69
|
});
|
|
49
70
|
ctx.span.setTag("error", true);
|
|
50
71
|
}
|
|
51
|
-
TraceContext.
|
|
52
|
-
function
|
|
72
|
+
TraceContext.setError = setError;
|
|
73
|
+
function setJsonRPCMetadata(ctx, method) {
|
|
53
74
|
if (!ctx.span) {
|
|
54
75
|
return;
|
|
55
76
|
}
|
|
56
|
-
|
|
57
|
-
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md#json-rpc
|
|
58
|
-
ctx.span.addTags({
|
|
77
|
+
const tags = {
|
|
59
78
|
rpc: {
|
|
60
79
|
system: "jsonrpc",
|
|
61
|
-
|
|
80
|
+
// version,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
if (method) {
|
|
84
|
+
tags.rpc.method = method;
|
|
85
|
+
}
|
|
86
|
+
addNestedTags(ctx, tags);
|
|
87
|
+
}
|
|
88
|
+
TraceContext.setJsonRPCMetadata = setJsonRPCMetadata;
|
|
89
|
+
function setJsonRPCError(ctx, method, err, withStatusCode = false) {
|
|
90
|
+
if (!ctx.span) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
// not use setError bc this is (most likely) a working operation
|
|
94
|
+
setJsonRPCMetadata(ctx, method);
|
|
95
|
+
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md#json-rpc
|
|
96
|
+
addNestedTags(ctx, {
|
|
97
|
+
rpc: {
|
|
62
98
|
jsonrpc: {
|
|
63
99
|
error_code: err.code,
|
|
64
100
|
error_message: err.message,
|
|
65
101
|
},
|
|
66
102
|
},
|
|
67
103
|
});
|
|
104
|
+
// the field "status_code" is used by honeycomb to derive insights like success rate, etc. Defaults to "0".
|
|
105
|
+
if (withStatusCode) {
|
|
106
|
+
ctx.span.setTag("status_code", err.code);
|
|
107
|
+
}
|
|
68
108
|
}
|
|
69
|
-
TraceContext.
|
|
70
|
-
function addJsonRPCParameters(ctx,
|
|
109
|
+
TraceContext.setJsonRPCError = setJsonRPCError;
|
|
110
|
+
function addJsonRPCParameters(ctx, params) {
|
|
71
111
|
if (!ctx.span) {
|
|
72
112
|
return;
|
|
73
113
|
}
|
|
74
|
-
ctx
|
|
114
|
+
setJsonRPCMetadata(ctx);
|
|
115
|
+
addNestedTags(ctx, {
|
|
75
116
|
rpc: {
|
|
76
|
-
system: "jsonrpc",
|
|
77
|
-
method,
|
|
78
117
|
jsonrpc: {
|
|
79
|
-
parameters:
|
|
118
|
+
parameters: params,
|
|
80
119
|
},
|
|
81
120
|
},
|
|
82
121
|
});
|
|
83
122
|
}
|
|
84
123
|
TraceContext.addJsonRPCParameters = addJsonRPCParameters;
|
|
124
|
+
/**
|
|
125
|
+
* Does what one would expect from `span.addTags`: Calls `span.addTag` for all keys in map, recursively for objects.
|
|
126
|
+
* Example:
|
|
127
|
+
* ```
|
|
128
|
+
* TraceContext.addNestedTags(ctx, {
|
|
129
|
+
* rpc: {
|
|
130
|
+
* system: "jsonrpc",
|
|
131
|
+
* jsonrpc: {
|
|
132
|
+
* version: "1.0",
|
|
133
|
+
* method: "test",
|
|
134
|
+
* parameters: ["abc", "def"],
|
|
135
|
+
* },
|
|
136
|
+
* },
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
* gives
|
|
140
|
+
* rpc.system = "jsonrpc"
|
|
141
|
+
* rpc.jsonrpc.version = "1.0"
|
|
142
|
+
* rpc.jsonrpc.method = "test"
|
|
143
|
+
* rpc.jsonrpc.parameters.0 = "abc"
|
|
144
|
+
* rpc.jsonrpc.parameters.1 = "def"
|
|
145
|
+
* @param ctx
|
|
146
|
+
* @param keyValueMap
|
|
147
|
+
* @returns
|
|
148
|
+
*/
|
|
149
|
+
function addNestedTags(ctx, keyValueMap, _namespace) {
|
|
150
|
+
if (!ctx.span) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const namespace = _namespace ? `${_namespace}.` : "";
|
|
154
|
+
try {
|
|
155
|
+
for (const k of Object.keys(keyValueMap)) {
|
|
156
|
+
const v = keyValueMap[k];
|
|
157
|
+
if (v instanceof Object) {
|
|
158
|
+
addNestedTags(ctx, v, `${namespace}${k}`);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
ctx.span.setTag(`${namespace}${k}`, v);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
// general resilience against odd shapes/parameters
|
|
167
|
+
logging_1.log.error("Tracing.addNestedTags", err, { namespace });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
TraceContext.addNestedTags = addNestedTags;
|
|
171
|
+
function setOWI(ctx, owi) {
|
|
172
|
+
if (!ctx.span) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
addNestedTags(ctx, {
|
|
176
|
+
context: owi,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
TraceContext.setOWI = setOWI;
|
|
180
|
+
function finishOnce(span) {
|
|
181
|
+
let done = false;
|
|
182
|
+
return () => {
|
|
183
|
+
if (done)
|
|
184
|
+
return;
|
|
185
|
+
span.finish();
|
|
186
|
+
done = true;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
TraceContext.finishOnce = finishOnce;
|
|
85
190
|
})(TraceContext = exports.TraceContext || (exports.TraceContext = {}));
|
|
86
191
|
let TracingManager = class TracingManager {
|
|
87
192
|
setup(serviceName, opts) {
|
|
@@ -91,12 +196,16 @@ let TracingManager = class TracingManager {
|
|
|
91
196
|
const config = {
|
|
92
197
|
disable: false,
|
|
93
198
|
reporter: {
|
|
94
|
-
logSpans: false
|
|
199
|
+
logSpans: false,
|
|
95
200
|
},
|
|
96
|
-
serviceName
|
|
201
|
+
serviceName,
|
|
97
202
|
};
|
|
98
203
|
const t = (0, jaeger_client_1.initTracerFromEnv)(config, {
|
|
99
|
-
logger: console
|
|
204
|
+
logger: console,
|
|
205
|
+
tags: {
|
|
206
|
+
"service.build.commit": process.env.GITPOD_BUILD_GIT_COMMIT,
|
|
207
|
+
"service.build.version": process.env.GITPOD_BUILD_VERSION,
|
|
208
|
+
},
|
|
100
209
|
});
|
|
101
210
|
if (opts) {
|
|
102
211
|
if (opts.perOpSampling) {
|
|
@@ -116,7 +225,7 @@ class PerOperationSampler {
|
|
|
116
225
|
this.strategies = strategies;
|
|
117
226
|
}
|
|
118
227
|
name() {
|
|
119
|
-
return
|
|
228
|
+
return "PerOperationSampler";
|
|
120
229
|
}
|
|
121
230
|
toString() {
|
|
122
231
|
return `${this.name()}`;
|
package/lib/util/tracing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/util/tracing.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../src/util/tracing.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;AAEH,2CAA2C;AAC3C,iDAAiE;AAEjE,6CAA+C;AAC/C,yCAAuC;AAEvC,uCAA4C;AAS5C,IAAiB,YAAY,CAgL5B;AAhLD,WAAiB,YAAY;IACzB,SAAgB,SAAS,CAAC,SAAiB,EAAE,SAAwB;;QACjE,MAAM,OAAO,GAA4B,EAAE,CAAC;QAE5C,qCAAqC;QACrC,qEAAqE;QACrE,IAAI,CAAC,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,CAAA,EAAE;YACnB,MAAM,GAAG,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,OAAO,EAAE,CAAC;YACvC,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;gBAC9C,OAAO,CAAC,UAAU,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;aACvD;SACJ;QAED,OAAO,WAAW,CAAC,YAAY,EAAE,CAAC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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,CAAC,CAAC;YAClE,sBAAY,CAAC,aAAa,CACtB,EAAE,IAAI,EAAE,EACR;gBACI,GAAG,EAAE;oBACD,MAAM,EAAE,SAAS;oBACjB,OAAO,EAAE;wBACL,OAAO,EAAE,KAAK;wBACd,MAAM,EAAE,MAAM;wBACd,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;qBAC7B;iBACJ;aACJ,CACJ,CAAC;YAEF,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,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AI,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"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
3
|
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License
|
|
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"}
|