-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #472 from mertalev/feat/prefixes
feat: metric prefixes
- Loading branch information
Showing
12 changed files
with
253 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { MetricOptions } from '@opentelemetry/api'; | ||
|
||
export interface OtelMetricOptions extends MetricOptions { | ||
/** | ||
* A prefix to add to the name of the metric. | ||
*/ | ||
prefix?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { createParamDecorator } from '@nestjs/common'; | ||
import { MetricOptions } from '@opentelemetry/api'; | ||
import { getOrCreateCounter, MetricType } from '../metric-data'; | ||
import { getOrCreateCounter } from '../metric-data'; | ||
import { OtelMetricOptions } from '../../interfaces/metric-options.interface'; | ||
|
||
export const OtelCounter = createParamDecorator((name: string, options?: MetricOptions) => { | ||
export const OtelCounter = createParamDecorator((name: string, options?: OtelMetricOptions) => { | ||
if (!name || name.length === 0) { | ||
throw new Error('OtelCounter need a name argument'); | ||
} | ||
return getOrCreateCounter(name, options); | ||
}); | ||
|
||
export const OtelUpDownCounter = createParamDecorator((name: string, options?: MetricOptions) => { | ||
if (!name || name.length === 0) { | ||
throw new Error('OtelUpDownCounter need a name argument'); | ||
export const OtelUpDownCounter = createParamDecorator( | ||
(name: string, options?: OtelMetricOptions) => { | ||
if (!name || name.length === 0) { | ||
throw new Error('OtelUpDownCounter need a name argument'); | ||
} | ||
return getOrCreateCounter(name, options); | ||
} | ||
return getOrCreateCounter(name, options); | ||
}); | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.