Skip to content

Commit

Permalink
feat: ename value recorder on decorators and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pragmaticivan committed Dec 11, 2021
1 parent 6ed63ae commit 646e2ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -243,7 +243,7 @@ You have the following decorators:

* `@OtelCounter()`
* `@OtelUpDownCounter()`
* `@OtelValueRecorder()`
* `@OtelHistogram()`

Example of usage:

Expand Down Expand Up @@ -272,12 +272,12 @@ Impl |Metric |Description| Labels | Metric Type
|| http_response_total| Total number of HTTP responses.| method, status, path | Counter |
|| http_response_success_total| Total number of all successful responses.| - | Counter |
|| http_response_error_total| Total number of all response errors.| - | Counter |
|| http_request_duration_seconds | HTTP latency value recorder in seconds. | method, status, path | ValueRecorder |
|| http_request_duration_seconds | HTTP latency value recorder in seconds. | method, status, path | Histogram |
|| http_client_error_total | Total number of client error requests. | - | Counter |
|| http_server_error_total | Total number of server error requests. | - | Counter |
|| http_server_aborts_total | Total number of data transfers aborted. | - | Counter |
|| http_request_size_bytes | Current total of incoming bytes. | - | ValueRecorder|
|| http_response_size_bytes | Current total of outgoing bytes. | - | ValueRecorder |
|| http_request_size_bytes | Current total of incoming bytes. | - | Histogram|
|| http_response_size_bytes | Current total of outgoing bytes. | - | Histogram |

## Prometheus Metrics

Expand Down
Expand Up @@ -2,9 +2,9 @@ import { createParamDecorator } from '@nestjs/common';
import { MetricOptions } from '@opentelemetry/api-metrics';
import { getOrCreateHistogram, MetricType } from '../metric-data';

export const OtelValueRecorder = createParamDecorator((name: string, options?: MetricOptions) => {
export const OtelHistogram = createParamDecorator((name: string, options?: MetricOptions) => {
if (!name || name.length === 0) {
throw new Error('OtelValueRecorder need a name argument');
throw new Error('OtelHistogram need a name argument');
}
return getOrCreateHistogram(name, MetricType.Histogram, options);
});
2 changes: 1 addition & 1 deletion src/metrics/decorators/index.ts
@@ -1,3 +1,3 @@
export * from './common';
export * from './counter';
export * from './value-recorder';
export * from './histogram';

0 comments on commit 646e2ea

Please sign in to comment.