1.2.0 • Published 6 months ago

@zonneplan/open-telemetry-nest v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

OpenTelemetry Nest

npm.io

Find the source code at zonneplan/open-telemetry-js.

Set up

npm install @zonneplan/open-telemetry-nest

Usage

Using metrics

import { createCounterProvider, Counter } from '@zonneplan/open-telemetry-nest';

const MY_METRIC = 'my_metric';

// my-module.ts
@Module({
  providers: [
    /**
     * Registers a counter provider, which can be injected in services.
     */
    createCounterProvider({
      name: MY_METRIC,
      description: 'My metric description',
      unit: 'occurrences',
      valueType: ValueType.INT,
    })
  ]
})
export class MyModule {}

// my-service.ts
@Injectable()
export class MyService {
  constructor(
    /**
     * Inject the metric in the service.
     */
    @InjectMetric(MY_METRIC) private readonly myMetric: Counter
  ) {}

  /**
   * Using the default metric methods.
   */
  public myMethod() {
    this.myMetric.add(1);
  }

  /**
   * Using the metric increment decorator.
   */
  @metricIncrement(MY_METRIC)
  public myMetricIncrementDecorator() {
    
  }
}
1.2.0

6 months ago

1.1.1

7 months ago

1.0.2

10 months ago

1.1.0

9 months ago

1.0.1

10 months ago

1.0.0

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.5

1 year ago

0.1.2

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago