@dxos/client-services 0.1.54 → 0.1.55-main.0618d91

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.
@@ -2201,7 +2201,7 @@ var DataSpace = class DataSpace2 {
2201
2201
  await this.initializeDataPipeline();
2202
2202
  } catch (err) {
2203
2203
  if (err instanceof import_errors3.CancelledError) {
2204
- (0, import_log9.log)("Data pipeline initialization cancelled", err, {
2204
+ (0, import_log9.log)("data pipeline initialization cancelled", err, {
2205
2205
  F: __dxlog_file9,
2206
2206
  L: 193,
2207
2207
  S: this,
@@ -2235,7 +2235,7 @@ var DataSpace = class DataSpace2 {
2235
2235
  });
2236
2236
  this.metrics.controlPipelineReady = new Date();
2237
2237
  await this._createWritableFeeds();
2238
- (0, import_log9.log)("Writable feeds created", void 0, {
2238
+ (0, import_log9.log)("writable feeds created", void 0, {
2239
2239
  F: __dxlog_file9,
2240
2240
  L: 221,
2241
2241
  S: this,
@@ -2347,7 +2347,7 @@ var DataSpace = class DataSpace2 {
2347
2347
  }
2348
2348
  async activate() {
2349
2349
  if (this._state !== import_services6.SpaceState.INACTIVE) {
2350
- throw new import_errors3.SystemError("Invalid operation");
2350
+ return;
2351
2351
  }
2352
2352
  await this._metadataStore.setSpaceState(this.key, import_services6.SpaceState.ACTIVE);
2353
2353
  await this._open();
@@ -2355,7 +2355,7 @@ var DataSpace = class DataSpace2 {
2355
2355
  }
2356
2356
  async deactivate() {
2357
2357
  if (this._state === import_services6.SpaceState.INACTIVE) {
2358
- throw new import_errors3.SystemError("Invalid operation");
2358
+ return;
2359
2359
  }
2360
2360
  await this._metadataStore.setSpaceState(this.key, import_services6.SpaceState.INACTIVE);
2361
2361
  await this._close();
@@ -3592,6 +3592,46 @@ var LoggingServiceImpl = class {
3592
3592
  const index = import_log14.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
3593
3593
  import_log14.log.runtimeConfig.processors.splice(index, 1);
3594
3594
  }
3595
+ async controlMetrics({ reset, record }) {
3596
+ if (reset) {
3597
+ import_util7.tracer.clear();
3598
+ }
3599
+ if (record === true) {
3600
+ import_util7.tracer.start();
3601
+ } else if (record === false) {
3602
+ import_util7.tracer.stop();
3603
+ }
3604
+ return {
3605
+ recording: import_util7.tracer.recording
3606
+ };
3607
+ }
3608
+ queryMetrics({ interval }) {
3609
+ const createNumericalValues = (key) => {
3610
+ var _a;
3611
+ const consume = (_a = import_util7.tracer.get(key)) != null ? _a : [];
3612
+ return {
3613
+ key,
3614
+ stats: (0, import_util7.numericalValues)(consume, "duration")
3615
+ };
3616
+ };
3617
+ return new import_codec_protobuf12.Stream(({ next }) => {
3618
+ const update = () => {
3619
+ const metrics = {
3620
+ timestamp: new Date(),
3621
+ values: [
3622
+ createNumericalValues("dxos.echo.pipeline.control"),
3623
+ createNumericalValues("dxos.echo.pipeline.data")
3624
+ ]
3625
+ };
3626
+ next(metrics);
3627
+ };
3628
+ update();
3629
+ const i = setInterval(update, interval);
3630
+ return () => {
3631
+ clearInterval(i);
3632
+ };
3633
+ });
3634
+ }
3595
3635
  queryLogs(request) {
3596
3636
  return new import_codec_protobuf12.Stream(({ ctx, next }) => {
3597
3637
  const handler = (entry2) => {
@@ -3746,7 +3786,8 @@ var SystemServiceImpl = class {
3746
3786
  async updateStatus({ status }) {
3747
3787
  await this._onUpdateStatus(status);
3748
3788
  }
3749
- queryStatus() {
3789
+ // TODO(burdon): Standardize interval option in stream request?
3790
+ queryStatus({ interval = 3e3 } = {}) {
3750
3791
  return new import_codec_protobuf14.Stream(({ next }) => {
3751
3792
  const update = () => {
3752
3793
  next({
@@ -3755,9 +3796,9 @@ var SystemServiceImpl = class {
3755
3796
  };
3756
3797
  update();
3757
3798
  const unsubscribe = this._statusUpdate.on(() => update());
3758
- const interval = setInterval(update, 3e3);
3799
+ const i = setInterval(update, interval);
3759
3800
  return () => {
3760
- clearInterval(interval);
3801
+ clearInterval(i);
3761
3802
  unsubscribe();
3762
3803
  };
3763
3804
  });