@salesforce/telemetry 7.0.5 → 7.1.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/lib/exported.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from './telemetryReporter';
3
3
  export { isEnabled } from './enabledCheck';
4
4
  export default TelemetryReporter;
5
5
  export type { Attributes, O11ySchema, O11yBatchingConfig, PdpEvent, TelemetryOptions } from './types';
6
+ export type { FalconUploadOptions } from '@salesforce/o11y-reporter';
@@ -16,7 +16,6 @@ exports.O11yReporter = void 0;
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
- /* eslint-disable no-underscore-dangle */
20
19
  /* eslint-disable-next-line @typescript-eslint/triple-slash-reference -- needed so dynamic import('o11y_schema/sf_pdp') is typed when test tsconfig compiles */
21
20
  /// <reference path="../types/o11y_schema_sf_pdp.d.ts" />
22
21
  const o11y_reporter_1 = require("@salesforce/o11y-reporter");
@@ -39,8 +38,20 @@ class O11yReporter extends baseReporter_1.BaseReporter {
39
38
  super(options);
40
39
  this.extensionName = options.extensionName ?? options.project;
41
40
  this.service = o11y_reporter_1.O11yService.getInstance(this.extensionName);
42
- const dynamicO11yUploadEndpointPath = options.dynamicO11yUploadEndpoint ?? undefined;
43
- this.initialized = this.service.initialize(this.extensionName, options.o11yUploadEndpoint, options.getConnectionFn, dynamicO11yUploadEndpointPath ? { dynamicO11yUploadEndpointPath } : undefined);
41
+ // Default the CoreEnvelope appName to extensionName. o11y-reporter does NOT derive appName
42
+ // from extensionName — when unset it falls back to its generic "o11y-reporter-extensions"
43
+ // default — so telemetry sets it here to label events with this consumer's name. A consumer
44
+ // may override via options.appName (e.g. a co-hosted process where appName is shared).
45
+ const initOptions = { appName: options.appName ?? this.extensionName };
46
+ if (options.dynamicO11yUploadEndpoint) {
47
+ initOptions.dynamicO11yUploadEndpointPath = options.dynamicO11yUploadEndpoint;
48
+ }
49
+ if (options.falcon) {
50
+ initOptions.falcon = options.falcon; // opt-in Falcon publishing
51
+ }
52
+ // extensionName is passed positionally (already unique per consumer); it becomes the per-event
53
+ // o11y loggerName. appName (above) is the process-level CoreEnvelope label.
54
+ this.initialized = this.service.initialize(this.extensionName, options.o11yUploadEndpoint, options.getConnectionFn, initOptions);
44
55
  this.commonProperties = this.buildO11yCommonProperties(options.commonProperties);
45
56
  }
46
57
  async init() {
@@ -107,6 +107,11 @@ class TelemetryReporter extends kit_1.AsyncCreatable {
107
107
  try {
108
108
  this.o11yReporter = new o11yReporter_1.O11yReporter(this.options);
109
109
  await this.o11yReporter.init();
110
+ // Opt-in Falcon publishing is gated behind enableO11y. Log that it is configured
111
+ // without ever logging the API key or any other secret.
112
+ if (this.options.falcon) {
113
+ this.logger.debug(`O11y Falcon publishing configured (environment: ${this.options.falcon.environment ?? 'dev'})`);
114
+ }
110
115
  // Configure batching - enabled by default unless explicitly disabled
111
116
  const batchingConfig = this.options.o11yBatching;
112
117
  // Batching is enabled by default. Only disable if explicitly set to false
package/lib/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Env } from '@salesforce/kit';
2
- import { Connection as O11yConnection } from '@salesforce/o11y-reporter';
2
+ import { Connection as O11yConnection, FalconUploadOptions } from '@salesforce/o11y-reporter';
3
3
  export type Properties = {
4
4
  [key: string]: string;
5
5
  };
@@ -127,10 +127,30 @@ export type TelemetryOptions = {
127
127
  enableO11y?: boolean;
128
128
  enableAppInsights?: boolean;
129
129
  extensionName?: string;
130
+ /**
131
+ * Optional PROCESS-level O11y application name (the CoreEnvelope `appName`).
132
+ *
133
+ * When omitted, telemetry defaults it to `extensionName`, so events are labeled with this
134
+ * consumer's name (e.g. "salesforce-cli") instead of o11y-reporter's generic
135
+ * "o11y-reporter-extensions" default. Supply an explicit value only for a co-hosted process
136
+ * where several extensions share one o11y client (e.g. the VS Code Extension Pack): `appName`
137
+ * is process-level first-writer-wins, so it cannot vary per consumer there — per-consumer
138
+ * identity always rides on `extensionName` (the o11y `loggerName`) regardless.
139
+ */
140
+ appName?: string;
130
141
  /**
131
142
  * Batching configuration for O11y telemetry
132
143
  * Batching is enabled by default. Set o11yBatching.enableAutoBatching to false to disable batching
133
144
  * and upload events immediately after each event.
134
145
  */
135
146
  o11yBatching?: O11yBatchingConfig;
147
+ /**
148
+ * Opt-in Falcon publishing configuration for O11y telemetry.
149
+ *
150
+ * When supplied (and enableO11y is true), Falcon becomes the selected upload destination for this
151
+ * consumer; otherwise the existing org-connection / static-endpoint path is used unchanged.
152
+ * Carries the Falcon apiKey, an optional environment ("dev" | "prod", defaults to "dev"), and
153
+ * consumer-supplied endpoints/endpoint. Never hardcode or log the apiKey.
154
+ */
155
+ falcon?: FalconUploadOptions;
136
156
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/telemetry",
3
- "version": "7.0.5",
3
+ "version": "7.1.0",
4
4
  "description": "Library for telemetry reporting to Application Insights and O11y",
5
5
  "main": "lib/exported",
6
6
  "exports": {
@@ -41,24 +41,24 @@
41
41
  "!lib/**/*.map"
42
42
  ],
43
43
  "dependencies": {
44
- "@salesforce/core": "^9.1.0",
44
+ "@salesforce/core": "^9.1.10",
45
45
  "@salesforce/kit": "^4.0.0",
46
- "@salesforce/o11y-reporter": "1.8.5",
46
+ "@salesforce/o11y-reporter": "1.11.0",
47
47
  "applicationinsights": "^2.9.8",
48
48
  "got": "^11",
49
49
  "o11y_schema": "^260.65.0",
50
50
  "proxy-agent": "^6.5.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@salesforce/dev-scripts": "^13.0.2",
53
+ "@salesforce/dev-scripts": "^14.0.0",
54
54
  "@types/chai": "^4.3.17",
55
55
  "@types/mocha": "^10.0.10",
56
56
  "@types/node": "^18",
57
57
  "@types/sinon": "^10.0.20",
58
58
  "eslint": "^10.4.0",
59
- "eslint-config-salesforce-typescript": "^6.0.0",
59
+ "eslint-config-salesforce-typescript": "^7.0.0",
60
60
  "ts-node": "^10.9.2",
61
- "typescript": "^5.9.3"
61
+ "typescript": "^6.0.0"
62
62
  },
63
63
  "types": "lib/exported.d.ts",
64
64
  "publishConfig": {