@lark-apaas/observable-web 1.0.0-alpha.5 → 1.0.0-alpha.6

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.
@@ -47,6 +47,7 @@ var import_sdk_logs = require("@opentelemetry/sdk-logs");
47
47
  var import_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-http");
48
48
  var import_sdk_metrics = require("@opentelemetry/sdk-metrics");
49
49
  var import_resource_detector = require("./resource-detector");
50
+ var import_const = require("../const");
50
51
  var import_metric_exporter = require("./metric-exporter");
51
52
  var import_PvInstrumentation = require("./instrumentation/PvInstrumentation");
52
53
  class WebObservableSdk {
@@ -60,7 +61,7 @@ class WebObservableSdk {
60
61
  return this._instance;
61
62
  }
62
63
  start(config) {
63
- if (this.isStarted) return;
64
+ if (this.isStarted || config.env === import_const.AppEnv.Dev) return;
64
65
  this.config = config;
65
66
  try {
66
67
  this.resource = (0, import_resources.detectResources)({
@@ -1,10 +1,12 @@
1
1
  import { DeviceType } from './getDeviceTypeByAgent.js';
2
+ import { AppEnv } from '../const.js';
2
3
 
3
4
  declare const getDefaultAttr: () => {
4
5
  app_id: string;
5
6
  tenant_id: string;
6
7
  user_id: string;
7
8
  did: string;
9
+ app_env: AppEnv;
8
10
  device_type: DeviceType;
9
11
  };
10
12
 
@@ -21,6 +21,7 @@ __export(getDefaultAttr_exports, {
21
21
  getDefaultAttr: () => getDefaultAttr
22
22
  });
23
23
  module.exports = __toCommonJS(getDefaultAttr_exports);
24
+ var import_const = require("../const");
24
25
  var import_getDeviceID = require("./getDeviceID");
25
26
  var import_getDeviceTypeByAgent = require("./getDeviceTypeByAgent");
26
27
  const getDefaultAttr = () => ({
@@ -28,5 +29,7 @@ const getDefaultAttr = () => ({
28
29
  tenant_id: window.tenantId || "",
29
30
  user_id: window.userId || "",
30
31
  did: (0, import_getDeviceID.getDeviceId)(),
32
+ // 默认为 Prod 环境,preview 环境不上报
33
+ app_env: import_const.AppEnv.Prod,
31
34
  device_type: (0, import_getDeviceTypeByAgent.getDeviceTypeByAgent)(navigator.userAgent)
32
35
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/observable-web",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "Observable SDK For Web",
5
5
  "main": "./dist/lib/index.js",
6
6
  "files": [