@salesforce/telemetry 6.6.7 → 6.7.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
@@ -2,4 +2,4 @@ import { TelemetryReporter } from './telemetryReporter';
2
2
  export * from './telemetryReporter';
3
3
  export { isEnabled } from './enabledCheck';
4
4
  export default TelemetryReporter;
5
- export type { Attributes, O11ySchema, O11yBatchingConfig, PdpEvent } from './types';
5
+ export type { Attributes, O11ySchema, O11yBatchingConfig, PdpEvent, TelemetryOptions } from './types';
@@ -33,7 +33,10 @@ class O11yReporter extends baseReporter_1.BaseReporter {
33
33
  super(options);
34
34
  this.extensionName = options.extensionName ?? options.project;
35
35
  this.service = o11y_reporter_1.O11yService.getInstance(this.extensionName);
36
- this.initialized = this.service.initialize(this.extensionName, options.o11yUploadEndpoint);
36
+ const dynamicO11yUploadEndpointPath = options.dynamicO11yUploadEndpoint
37
+ ? options.dynamicO11yUploadEndpoint
38
+ : undefined;
39
+ this.initialized = this.service.initialize(this.extensionName, options.o11yUploadEndpoint, options.getConnectionFn, dynamicO11yUploadEndpointPath ? { dynamicO11yUploadEndpointPath } : undefined);
37
40
  this.commonProperties = this.buildO11yCommonProperties(options.commonProperties);
38
41
  }
39
42
  async init() {
package/lib/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Env } from '@salesforce/kit';
2
+ import { Connection as O11yConnection } from '@salesforce/o11y-reporter';
2
3
  export type Properties = {
3
4
  [key: string]: string;
4
5
  };
@@ -96,6 +97,21 @@ export type TelemetryOptions = {
96
97
  project: string;
97
98
  key: string;
98
99
  commonProperties?: Properties;
100
+ /**
101
+ * Optional getConnection function used at upload time to resolve endpoint and token from the current org.
102
+ * If getConnection is missing or fails, uploads use the static o11yUploadEndpoint (no auth).
103
+ * E.g.,
104
+ * ```
105
+ * Connection.create({
106
+ * authInfo: await AuthInfo.create({ username: 'myAdminUsername' })
107
+ * })
108
+ * ```
109
+ * or
110
+ * ```
111
+ * WorkspaceContextUtil.getInstance().getConnection()
112
+ * ```
113
+ */
114
+ getConnectionFn?: () => Promise<O11yConnection>;
99
115
  contextTags?: Properties;
100
116
  env?: Env;
101
117
  gdprSensitiveKeys?: string[];
@@ -103,6 +119,11 @@ export type TelemetryOptions = {
103
119
  sessionId?: string;
104
120
  waitForConnection?: boolean;
105
121
  o11yUploadEndpoint?: string;
122
+ /**
123
+ * Optional path appended to the org instance URL for the dynamic endpoint.
124
+ * Default: /services/data/v65.0/connect/proxy/ui-telemetry.
125
+ */
126
+ dynamicO11yUploadEndpoint?: string;
106
127
  enableO11y?: boolean;
107
128
  enableAppInsights?: boolean;
108
129
  extensionName?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/telemetry",
3
- "version": "6.6.7",
3
+ "version": "6.7.0",
4
4
  "description": "Library for telemetry reporting to Application Insights and O11y",
5
5
  "main": "lib/exported",
6
6
  "exports": {