0.5.2 • Published 9 days ago

@ms-cloudpack/telemetry v0.5.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 days ago

@ms-cloudpack/telemetry

A library for telemetry that gets reported to Application Insights by using Open Telemetry standards.

Currently, this library only supports Tracing. Metrics and Logs can be added later when needed.

Example usage

  1. Create a client:
const telemetryClient = new TelemetryClient({
  serviceNamespace: 'cloudpack',
  serviceName: 'cli',
  productVersion: '1.2.3',
  instrumentationKey: '<Application insights Instrumentation Key>',
  logLevel: 'verbose',
});
  1. Add shared attributes
telemetryClient.setSharedSpanAttribute('sessionId', 'my-session-id');

These attributes will get added to all spans.

  1. Get the tracer
const tracer = telemetryClient.getTracer();
  1. Create a span / add events / end the span
const span = tracer.createSpan('my-unit-of-work');
// do work
span.addEvent('my-event', { myCustomAttribute: 'my-custom-value' });

try {
  // do more work
} catch (err) {
  span.recordException(err);
}

// end the span when the unit-of-work completed.
span.end();

Lear more about spans

  1. Shutdown TelemetryClient before application exists
telemetryClient.shutdown();
  • This will force flush all the remaining data to remote servers and prevent more data to be collected.
  • Make sure that all spans have been ended before shuting down the telemetry client
0.5.2

9 days ago

0.5.1

2 months ago

0.5.0

2 months ago

0.4.9-beta.0

2 months ago

0.4.8

2 months ago

0.4.7

2 months ago

0.4.7-beta.1

2 months ago

0.4.7-beta.2

2 months ago

0.4.7-beta.0

3 months ago

0.4.6

4 months ago

0.4.5

5 months ago

0.3.9

8 months ago

0.3.10

8 months ago

0.3.6

10 months ago

0.4.4

6 months ago

0.3.5

10 months ago

0.3.8

9 months ago

0.3.7

9 months ago

0.4.1

8 months ago

0.4.0

8 months ago

0.4.3

7 months ago

0.3.4

11 months ago

0.4.2

8 months ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.3

11 months ago

0.3.0

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago