-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add histogram and summary metric types #2705
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some minor nits for error types and logging.
registerHistogram (name: string, opts?: HistogramOptions): Histogram | ||
registerHistogram (name: string, opts: any = {}): any { | ||
if (name == null || name.trim() === '') { | ||
throw new Error('Metric name is required') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use InvalidParametersError
for invalid parameters
registerHistogramGroup (name: string, opts?: HistogramOptions): HistogramGroup | ||
registerHistogramGroup (name: string, opts: any = {}): any { | ||
if (name == null || name.trim() === '') { | ||
throw new Error('Metric name is required') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use InvalidParametersError
for invalid parameters
registerSummary (name: string, opts?: SummaryOptions): Summary | ||
registerSummary (name: string, opts: any = {}): any { | ||
if (name == null || name.trim() === '') { | ||
throw new Error('Metric name is required') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use InvalidParametersError
for invalid parameters
registerSummaryGroup (name: string, opts?: SummaryOptions): SummaryGroup | ||
registerSummaryGroup (name: string, opts: any = {}): any { | ||
if (name == null || name.trim() === '') { | ||
throw new Error('Metric name is required') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use InvalidParametersError
for invalid parameters
registerHistogram (name: string, opts?: HistogramOptions): Histogram | ||
registerHistogram (name: string, opts: any = {}): any { | ||
if (name == null ?? name.trim() === '') { | ||
throw new Error('Histogram name is required') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use InvalidParametersError
for invalid parameters
registerHistogramGroup (name: string, opts?: HistogramOptions): HistogramGroup | ||
registerHistogramGroup (name: string, opts: any = {}): any { | ||
if (name == null || name.trim() === '') { | ||
throw new Error('Metric name is required') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use InvalidParametersError
for invalid parameters
registerSummary (name: string, opts?: SummaryOptions): Summary | ||
registerSummary (name: string, opts: any = {}): any { | ||
if (name == null || name.trim() === '') { | ||
throw new Error('Metric name is required') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use InvalidParametersError
for invalid parameters
registerSummaryGroup (name: string, opts?: SummaryOptions): SummaryGroup | ||
registerSummaryGroup (name: string, opts: any = {}): any { | ||
if (name == null || name.trim() === '') { | ||
throw new Error('Metric name is required') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use InvalidParametersError
for invalid parameters
return metrics.get(name) | ||
} | ||
|
||
this.log('Register histogram', name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.log('Register histogram', name) | |
this.log('register histogram', name) |
let metric = metrics.get(name) | ||
|
||
if (metrics.has(name)) { | ||
this.log('Reuse existing histogram', name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.log('Reuse existing histogram', name) | |
this.log('reuse existing histogram', name) |
Description
Histogram
,HistogramGroup
,Summary
,SummaryGroup
metric typesregisterHistogram
,registerHistogramGroup
,registerSummary
,registerSummaryGroup
methods toMetrics
interfaceChange checklist