@ms-cloudpack/telemetry 0.3.9 → 0.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"getAppInsightsConfig.d.ts","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAGrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AASrE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,oCAuB7D"}
1
+ {"version":3,"file":"getAppInsightsConfig.d.ts","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAGrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AASrE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,oCAsB7D"}
@@ -10,7 +10,7 @@ function sha256(input) {
10
10
  export function getAppInsightsConfig(options) {
11
11
  const config = {
12
12
  azureMonitorExporterOptions: {
13
- connectionString: 'InstrumentationKey=d512a3ac-e644-47b8-895a-4a9a25778aaf;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com',
13
+ connectionString: options.connectionString,
14
14
  },
15
15
  instrumentationOptions: {
16
16
  http: {
@@ -1 +1 @@
1
- {"version":3,"file":"getAppInsightsConfig.js","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;AAC/B,MAAM,EAAE,0BAA0B,EAAE,GAAG,mBAAmB,CAAC;AAE3D,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAyB;IAC5D,MAAM,MAAM,GAAqC;QAC/C,2BAA2B,EAAE;YAC3B,gBAAgB,EACd,6HAA6H;SAChI;QACD,sBAAsB,EAAE;YACtB,IAAI,EAAE;gBACJ,OAAO,EAAE,KAAK;aACf;YACD,QAAQ,EAAE;gBACR,OAAO,EAAE,KAAK;aACf;SACF;QACD,QAAQ,EAAE,IAAI,QAAQ,CAAC;YACrB,+CAA+C;YAC/C,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC;YAC3E,CAAC,0BAA0B,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,WAAW;YAC9D,CAAC,0BAA0B,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC,gBAAgB;SACzE,CAAC;KACH,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import Resources from '@opentelemetry/resources';\nimport SemanticConventions from '@opentelemetry/semantic-conventions';\nimport type { AzureMonitorOpenTelemetryOptions } from '@azure/monitor-opentelemetry';\nimport { createHash } from 'crypto';\nimport { getComputerName } from './getComputerName.js';\nimport type { TelemetryOptions } from '../types/TelemetryOptions.js';\n\nconst { Resource } = Resources;\nconst { SemanticResourceAttributes } = SemanticConventions;\n\nfunction sha256(input: string) {\n return createHash('sha256').update(input).digest('hex');\n}\n\nexport function getAppInsightsConfig(options: TelemetryOptions) {\n const config: AzureMonitorOpenTelemetryOptions = {\n azureMonitorExporterOptions: {\n connectionString:\n 'InstrumentationKey=d512a3ac-e644-47b8-895a-4a9a25778aaf;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com',\n },\n instrumentationOptions: {\n http: {\n enabled: false,\n },\n azureSdk: {\n enabled: false,\n },\n },\n resource: new Resource({\n // Use a hash of the computer name to avoid PII\n [SemanticResourceAttributes.SERVICE_INSTANCE_ID]: sha256(getComputerName()),\n [SemanticResourceAttributes.SERVICE_NAME]: options.serviceName,\n [SemanticResourceAttributes.SERVICE_NAMESPACE]: options.serviceNamespace,\n }),\n };\n\n return config;\n}\n"]}
1
+ {"version":3,"file":"getAppInsightsConfig.js","sourceRoot":"","sources":["../../src/AppInsights/getAppInsightsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,0BAA0B,CAAC;AACjD,OAAO,mBAAmB,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;AAC/B,MAAM,EAAE,0BAA0B,EAAE,GAAG,mBAAmB,CAAC;AAE3D,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAyB;IAC5D,MAAM,MAAM,GAAqC;QAC/C,2BAA2B,EAAE;YAC3B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;SAC3C;QACD,sBAAsB,EAAE;YACtB,IAAI,EAAE;gBACJ,OAAO,EAAE,KAAK;aACf;YACD,QAAQ,EAAE;gBACR,OAAO,EAAE,KAAK;aACf;SACF;QACD,QAAQ,EAAE,IAAI,QAAQ,CAAC;YACrB,+CAA+C;YAC/C,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC;YAC3E,CAAC,0BAA0B,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,WAAW;YAC9D,CAAC,0BAA0B,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC,gBAAgB;SACzE,CAAC;KACH,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import Resources from '@opentelemetry/resources';\nimport SemanticConventions from '@opentelemetry/semantic-conventions';\nimport type { AzureMonitorOpenTelemetryOptions } from '@azure/monitor-opentelemetry';\nimport { createHash } from 'crypto';\nimport { getComputerName } from './getComputerName.js';\nimport type { TelemetryOptions } from '../types/TelemetryOptions.js';\n\nconst { Resource } = Resources;\nconst { SemanticResourceAttributes } = SemanticConventions;\n\nfunction sha256(input: string) {\n return createHash('sha256').update(input).digest('hex');\n}\n\nexport function getAppInsightsConfig(options: TelemetryOptions) {\n const config: AzureMonitorOpenTelemetryOptions = {\n azureMonitorExporterOptions: {\n connectionString: options.connectionString,\n },\n instrumentationOptions: {\n http: {\n enabled: false,\n },\n azureSdk: {\n enabled: false,\n },\n },\n resource: new Resource({\n // Use a hash of the computer name to avoid PII\n [SemanticResourceAttributes.SERVICE_INSTANCE_ID]: sha256(getComputerName()),\n [SemanticResourceAttributes.SERVICE_NAME]: options.serviceName,\n [SemanticResourceAttributes.SERVICE_NAMESPACE]: options.serviceNamespace,\n }),\n };\n\n return config;\n}\n"]}
@@ -1,6 +1,5 @@
1
- import type { Span } from '@opentelemetry/api';
1
+ import { type Span } from '@opentelemetry/api';
2
2
  import type { TelemetryClient } from '../types/TelemetryClient.js';
3
- import { NoOpTracer } from './NoOpTracer.js';
4
3
  import { PerformanceRecorder } from '../PerformanceRecorder.js';
5
4
  /**
6
5
  * No-op implementation of {@link TelemetryClient}.
@@ -9,9 +8,9 @@ import { PerformanceRecorder } from '../PerformanceRecorder.js';
9
8
  export declare class NoOpTelemetryClient implements TelemetryClient {
10
9
  readonly rootSpan: Span;
11
10
  readonly performance: PerformanceRecorder;
12
- private tracer;
11
+ constructor();
13
12
  setSharedSpanAttribute(): TelemetryClient;
14
13
  shutdown(): Promise<void>;
15
- getTracer(): NoOpTracer;
14
+ getTracer(): import("@opentelemetry/api").Tracer;
16
15
  }
17
16
  //# sourceMappingURL=NoOpTelemetryClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NoOpTelemetryClient.d.ts","sourceRoot":"","sources":["../../src/NoOp/NoOpTelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAkB;IACzC,QAAQ,CAAC,WAAW,sBAA0C;IAC9D,OAAO,CAAC,MAAM,CAAoB;IAElC,sBAAsB,IAAI,eAAe;IAKzC,QAAQ;IAKR,SAAS;CAGV"}
1
+ {"version":3,"file":"NoOpTelemetryClient.d.ts","sourceRoot":"","sources":["../../src/NoOp/NoOpTelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAS,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;GAGG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;;IAO1C,sBAAsB,IAAI,eAAe;IAKzC,QAAQ;IAKR,SAAS;CAGV"}
@@ -1,5 +1,4 @@
1
- import { NoOpTracer } from './NoOpTracer.js';
2
- import { NoOpSpan } from './NoOpSpan.js';
1
+ import { trace } from '@opentelemetry/api';
3
2
  import { PerformanceRecorder } from '../PerformanceRecorder.js';
4
3
  /**
5
4
  * No-op implementation of {@link TelemetryClient}.
@@ -7,9 +6,8 @@ import { PerformanceRecorder } from '../PerformanceRecorder.js';
7
6
  */
8
7
  export class NoOpTelemetryClient {
9
8
  constructor() {
10
- this.rootSpan = new NoOpSpan();
9
+ this.rootSpan = this.getTracer().startSpan('no-op');
11
10
  this.performance = new PerformanceRecorder(this.rootSpan);
12
- this.tracer = new NoOpTracer();
13
11
  }
14
12
  setSharedSpanAttribute() {
15
13
  // No-op
@@ -20,7 +18,7 @@ export class NoOpTelemetryClient {
20
18
  return Promise.resolve();
21
19
  }
22
20
  getTracer() {
23
- return this.tracer;
21
+ return trace.getTracer('no-op');
24
22
  }
25
23
  }
26
24
  //# sourceMappingURL=NoOpTelemetryClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NoOpTelemetryClient.js","sourceRoot":"","sources":["../../src/NoOp/NoOpTelemetryClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAAhC;QACW,aAAQ,GAAS,IAAI,QAAQ,EAAE,CAAC;QAChC,gBAAW,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtD,WAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAepC,CAAC;IAbC,sBAAsB;QACpB,QAAQ;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ;QACN,QAAQ;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF","sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { TelemetryClient } from '../types/TelemetryClient.js';\nimport { NoOpTracer } from './NoOpTracer.js';\nimport { NoOpSpan } from './NoOpSpan.js';\nimport { PerformanceRecorder } from '../PerformanceRecorder.js';\n\n/**\n * No-op implementation of {@link TelemetryClient}.\n * This class will be used when Telemetry is disabled.\n */\nexport class NoOpTelemetryClient implements TelemetryClient {\n readonly rootSpan: Span = new NoOpSpan();\n readonly performance = new PerformanceRecorder(this.rootSpan);\n private tracer = new NoOpTracer();\n\n setSharedSpanAttribute(): TelemetryClient {\n // No-op\n return this;\n }\n\n shutdown() {\n // No-op\n return Promise.resolve();\n }\n\n getTracer() {\n return this.tracer;\n }\n}\n"]}
1
+ {"version":3,"file":"NoOpTelemetryClient.js","sourceRoot":"","sources":["../../src/NoOp/NoOpTelemetryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAI9B;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,WAAW,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAED,sBAAsB;QACpB,QAAQ;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ;QACN,QAAQ;QACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,SAAS;QACP,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CACF","sourcesContent":["import { type Span, trace } from '@opentelemetry/api';\nimport type { TelemetryClient } from '../types/TelemetryClient.js';\nimport { PerformanceRecorder } from '../PerformanceRecorder.js';\n\n/**\n * No-op implementation of {@link TelemetryClient}.\n * This class will be used when Telemetry is disabled.\n */\nexport class NoOpTelemetryClient implements TelemetryClient {\n readonly rootSpan: Span;\n readonly performance: PerformanceRecorder;\n\n constructor() {\n this.rootSpan = this.getTracer().startSpan('no-op');\n this.performance = new PerformanceRecorder(this.rootSpan);\n }\n\n setSharedSpanAttribute(): TelemetryClient {\n // No-op\n return this;\n }\n\n shutdown() {\n // No-op\n return Promise.resolve();\n }\n\n getTracer() {\n return trace.getTracer('no-op');\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  export async function createTelemetryClient(options) {
2
- if (!options.instrumentationKey) {
2
+ if (!options.connectionString) {
3
3
  console.debug('No connection string found. Telemetry will not be sent.');
4
4
  // Create a no-op telemetry client if no instrumentation key is provided
5
5
  const { NoOpTelemetryClient } = await import('./NoOp/NoOpTelemetryClient.js');
@@ -1 +1 @@
1
- {"version":3,"file":"createTelemetryClient.js","sourceRoot":"","sources":["../src/createTelemetryClient.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAyB;IACnE,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE;QAC/B,OAAO,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAEzE,wEAAwE;QACxE,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;QAC9E,OAAO,IAAI,mBAAmB,EAAE,CAAC;KAClC;IAED,0EAA0E;IAC1E,OAAO,CAAC,GAAG,CAAC,iDAAiD,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC;IAE3F,yDAAyD;IACzD,MAAM,EAAE,0BAA0B,EAAE,GAAG,MAAM,MAAM,CAAC,6CAA6C,CAAC,CAAC;IACnG,OAAO,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { TelemetryOptions } from './types/TelemetryOptions.js';\nimport type { TelemetryClient } from './types/TelemetryClient.js';\n\nexport async function createTelemetryClient(options: TelemetryOptions): Promise<TelemetryClient> {\n if (!options.instrumentationKey) {\n console.debug('No connection string found. Telemetry will not be sent.');\n\n // Create a no-op telemetry client if no instrumentation key is provided\n const { NoOpTelemetryClient } = await import('./NoOp/NoOpTelemetryClient.js');\n return new NoOpTelemetryClient();\n }\n\n // Set initial log level to WARN to avoid logging telemetry initialization\n process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL = options.logLevel || 'WARN';\n\n // Import TelemetryClient after setting initial log level\n const { AppInsightsTelemetryClient } = await import('./AppInsights/AppInsightsTelemetryClient.js');\n return new AppInsightsTelemetryClient(options);\n}\n"]}
1
+ {"version":3,"file":"createTelemetryClient.js","sourceRoot":"","sources":["../src/createTelemetryClient.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAyB;IACnE,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;QAC7B,OAAO,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAEzE,wEAAwE;QACxE,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;QAC9E,OAAO,IAAI,mBAAmB,EAAE,CAAC;KAClC;IAED,0EAA0E;IAC1E,OAAO,CAAC,GAAG,CAAC,iDAAiD,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC;IAE3F,yDAAyD;IACzD,MAAM,EAAE,0BAA0B,EAAE,GAAG,MAAM,MAAM,CAAC,6CAA6C,CAAC,CAAC;IACnG,OAAO,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { TelemetryOptions } from './types/TelemetryOptions.js';\nimport type { TelemetryClient } from './types/TelemetryClient.js';\n\nexport async function createTelemetryClient(options: TelemetryOptions): Promise<TelemetryClient> {\n if (!options.connectionString) {\n console.debug('No connection string found. Telemetry will not be sent.');\n\n // Create a no-op telemetry client if no instrumentation key is provided\n const { NoOpTelemetryClient } = await import('./NoOp/NoOpTelemetryClient.js');\n return new NoOpTelemetryClient();\n }\n\n // Set initial log level to WARN to avoid logging telemetry initialization\n process.env.APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL = options.logLevel || 'WARN';\n\n // Import TelemetryClient after setting initial log level\n const { AppInsightsTelemetryClient } = await import('./AppInsights/AppInsightsTelemetryClient.js');\n return new AppInsightsTelemetryClient(options);\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.36.4"
8
+ "packageVersion": "7.37.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -1,9 +1,9 @@
1
1
  import type { LogLevel } from './LogLevel.js';
2
2
  export interface TelemetryOptions {
3
3
  /**
4
- * The instrumentation key for the Application Insights.
4
+ * The connection string for the Application Insights.
5
5
  */
6
- instrumentationKey?: string;
6
+ connectionString?: string;
7
7
  /**
8
8
  * The log level for the telemetry client.
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TelemetryOptions.d.ts","sourceRoot":"","sources":["../../src/types/TelemetryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
1
+ {"version":3,"file":"TelemetryOptions.d.ts","sourceRoot":"","sources":["../../src/types/TelemetryOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"TelemetryOptions.js","sourceRoot":"","sources":["../../src/types/TelemetryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { LogLevel } from './LogLevel.js';\n\nexport interface TelemetryOptions {\n /**\n * The instrumentation key for the Application Insights.\n */\n instrumentationKey?: string;\n\n /**\n * The log level for the telemetry client.\n */\n logLevel?: LogLevel;\n\n /**\n * The version of the product. This will be added as a shared attribute to all spans.\n */\n productVersion: string;\n\n /**\n * A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services.\n * Possible values: cloudpack, cloudpack.services, etc.\n */\n serviceNamespace: string;\n\n /**\n * Logic name of the service\n * Possible values: cli, bundler-service, etc.\n */\n serviceName: string;\n\n /**\n * Name of the root span, 'root' will be used as a span name if this property is not set.\n */\n rootSpanName?: string;\n}\n"]}
1
+ {"version":3,"file":"TelemetryOptions.js","sourceRoot":"","sources":["../../src/types/TelemetryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { LogLevel } from './LogLevel.js';\n\nexport interface TelemetryOptions {\n /**\n * The connection string for the Application Insights.\n */\n connectionString?: string;\n\n /**\n * The log level for the telemetry client.\n */\n logLevel?: LogLevel;\n\n /**\n * The version of the product. This will be added as a shared attribute to all spans.\n */\n productVersion: string;\n\n /**\n * A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services.\n * Possible values: cloudpack, cloudpack.services, etc.\n */\n serviceNamespace: string;\n\n /**\n * Logic name of the service\n * Possible values: cli, bundler-service, etc.\n */\n serviceName: string;\n\n /**\n * Name of the root span, 'root' will be used as a span name if this property is not set.\n */\n rootSpanName?: string;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/telemetry",
3
- "version": "0.3.9",
3
+ "version": "0.4.0",
4
4
  "description": "Helpers for logging tasks to the console.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -8,6 +8,7 @@
8
8
  "sideEffects": false,
9
9
  "exports": {
10
10
  ".": {
11
+ "source": "./src/index.ts",
11
12
  "types": "./lib/index.d.ts",
12
13
  "import": "./lib/index.js"
13
14
  }
@@ -1,18 +0,0 @@
1
- import type { Span, SpanContext } from '@opentelemetry/api';
2
- /**
3
- * No-op implementation of {@link Span}.
4
- * This class will be used when Telemetry is disabled.
5
- * @internal
6
- */
7
- export declare class NoOpSpan implements Span {
8
- spanContext(): SpanContext;
9
- setAttribute(): this;
10
- setAttributes(): this;
11
- addEvent(): this;
12
- setStatus(): this;
13
- updateName(): this;
14
- end(): void;
15
- isRecording(): boolean;
16
- recordException(): void;
17
- }
18
- //# sourceMappingURL=NoOpSpan.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NoOpSpan.d.ts","sourceRoot":"","sources":["../../src/NoOp/NoOpSpan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;GAIG;AACH,qBAAa,QAAS,YAAW,IAAI;IACnC,WAAW,IAAI,WAAW;IAQ1B,YAAY,IAAI,IAAI;IAKpB,aAAa,IAAI,IAAI;IAKrB,QAAQ,IAAI,IAAI;IAKhB,SAAS,IAAI,IAAI;IAKjB,UAAU,IAAI,IAAI;IAKlB,GAAG,IAAI,IAAI;IAIX,WAAW,IAAI,OAAO;IAItB,eAAe,IAAI,IAAI;CAGxB"}
@@ -1,44 +0,0 @@
1
- /**
2
- * No-op implementation of {@link Span}.
3
- * This class will be used when Telemetry is disabled.
4
- * @internal
5
- */
6
- export class NoOpSpan {
7
- spanContext() {
8
- return {
9
- spanId: '',
10
- traceFlags: 0,
11
- traceId: '',
12
- };
13
- }
14
- setAttribute() {
15
- // no-op
16
- return this;
17
- }
18
- setAttributes() {
19
- // no-op
20
- return this;
21
- }
22
- addEvent() {
23
- // no-op
24
- return this;
25
- }
26
- setStatus() {
27
- // no-op
28
- return this;
29
- }
30
- updateName() {
31
- // no-op
32
- return this;
33
- }
34
- end() {
35
- // no-op
36
- }
37
- isRecording() {
38
- return false;
39
- }
40
- recordException() {
41
- // no-op
42
- }
43
- }
44
- //# sourceMappingURL=NoOpSpan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NoOpSpan.js","sourceRoot":"","sources":["../../src/NoOp/NoOpSpan.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,QAAQ;IACnB,WAAW;QACT,OAAO;YACL,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IAED,YAAY;QACV,QAAQ;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa;QACX,QAAQ;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ;QACN,QAAQ;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS;QACP,QAAQ;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU;QACR,QAAQ;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG;QACD,QAAQ;IACV,CAAC;IAED,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe;QACb,QAAQ;IACV,CAAC;CACF","sourcesContent":["import type { Span, SpanContext } from '@opentelemetry/api';\n\n/**\n * No-op implementation of {@link Span}.\n * This class will be used when Telemetry is disabled.\n * @internal\n */\nexport class NoOpSpan implements Span {\n spanContext(): SpanContext {\n return {\n spanId: '',\n traceFlags: 0,\n traceId: '',\n };\n }\n\n setAttribute(): this {\n // no-op\n return this;\n }\n\n setAttributes(): this {\n // no-op\n return this;\n }\n\n addEvent(): this {\n // no-op\n return this;\n }\n\n setStatus(): this {\n // no-op\n return this;\n }\n\n updateName(): this {\n // no-op\n return this;\n }\n\n end(): void {\n // no-op\n }\n\n isRecording(): boolean {\n return false;\n }\n\n recordException(): void {\n // no-op\n }\n}\n"]}
@@ -1,12 +0,0 @@
1
- import type { Context, Span, SpanOptions, Tracer } from '@opentelemetry/api';
2
- /**
3
- * No-op implementation of {@link Tracer}.
4
- * This class will be used when Telemetry is disabled.
5
- */
6
- export declare class NoOpTracer implements Tracer {
7
- startSpan(): Span;
8
- startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
9
- startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, _opts: SpanOptions, fn: F): ReturnType<F>;
10
- startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, opts: SpanOptions, ctx: Context, fn: F): ReturnType<F>;
11
- }
12
- //# sourceMappingURL=NoOpTracer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NoOpTracer.d.ts","sourceRoot":"","sources":["../../src/NoOp/NoOpTracer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG7E;;;GAGG;AACH,qBAAa,UAAW,YAAW,MAAM;IACvC,SAAS,IAAI,IAAI;IAIjB,eAAe,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAC5F,eAAe,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAChH,eAAe,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EACrD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,CAAC,GACJ,UAAU,CAAC,CAAC,CAAC;CAsBjB"}
@@ -1,28 +0,0 @@
1
- import { NoOpSpan } from './NoOpSpan.js';
2
- /**
3
- * No-op implementation of {@link Tracer}.
4
- * This class will be used when Telemetry is disabled.
5
- */
6
- export class NoOpTracer {
7
- startSpan() {
8
- return new NoOpSpan();
9
- }
10
- startActiveSpan(_name, arg2, arg3, arg4) {
11
- let fn;
12
- if (arguments.length < 2) {
13
- return;
14
- }
15
- else if (arguments.length === 2) {
16
- fn = arg2;
17
- }
18
- else if (arguments.length === 3) {
19
- fn = arg3;
20
- }
21
- else {
22
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
23
- fn = arg4;
24
- }
25
- return fn(new NoOpSpan());
26
- }
27
- }
28
- //# sourceMappingURL=NoOpTracer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NoOpTracer.js","sourceRoot":"","sources":["../../src/NoOp/NoOpTracer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,UAAU;IACrB,SAAS;QACP,OAAO,IAAI,QAAQ,EAAE,CAAC;IACxB,CAAC;IAUD,eAAe,CACb,KAAa,EACb,IAAsB,EACtB,IAAkB,EAClB,IAAQ;QAER,IAAI,EAAK,CAAC;QAEV,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,OAAO;SACR;aAAM,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,EAAE,GAAG,IAAS,CAAC;SAChB;aAAM,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,EAAE,GAAG,IAAS,CAAC;SAChB;aAAM;YACL,oEAAoE;YACpE,EAAE,GAAG,IAAK,CAAC;SACZ;QAED,OAAO,EAAE,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import type { Context, Span, SpanOptions, Tracer } from '@opentelemetry/api';\nimport { NoOpSpan } from './NoOpSpan.js';\n\n/**\n * No-op implementation of {@link Tracer}.\n * This class will be used when Telemetry is disabled.\n */\nexport class NoOpTracer implements Tracer {\n startSpan(): Span {\n return new NoOpSpan();\n }\n\n startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;\n startActiveSpan<F extends (span: Span) => ReturnType<F>>(name: string, _opts: SpanOptions, fn: F): ReturnType<F>;\n startActiveSpan<F extends (span: Span) => ReturnType<F>>(\n name: string,\n opts: SpanOptions,\n ctx: Context,\n fn: F,\n ): ReturnType<F>;\n startActiveSpan<F extends (span: Span) => ReturnType<F>>(\n _name: string,\n arg2?: F | SpanOptions,\n arg3?: F | Context,\n arg4?: F,\n ): ReturnType<F> | undefined {\n let fn: F;\n\n if (arguments.length < 2) {\n return;\n } else if (arguments.length === 2) {\n fn = arg2 as F;\n } else if (arguments.length === 3) {\n fn = arg3 as F;\n } else {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n fn = arg4!;\n }\n\n return fn(new NoOpSpan());\n }\n}\n"]}