-
Notifications
You must be signed in to change notification settings - Fork 8
FFM-10325 Fix issue with detecting empty evaluation/target metrics #101
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,11 +101,6 @@ export const MetricsProcessor = ( | |
}; | ||
|
||
const _summarize = (): Metrics | unknown => { | ||
if (!data) { | ||
log.debug('No metrics data!'); | ||
return; | ||
} | ||
|
||
const targetData: TargetData[] = []; | ||
const metricsData: MetricsData[] = []; | ||
|
||
|
@@ -184,30 +179,34 @@ export const MetricsProcessor = ( | |
|
||
const _send = (): void => { | ||
if (closed) { | ||
log.debug('SDK has been closed before metrics can be sent'); | ||
return; | ||
} | ||
|
||
if (data.size == 0) { | ||
log.debug('No metrics to send in this interval'); | ||
return; | ||
} | ||
|
||
const metrics: Metrics = _summarize(); | ||
|
||
if (metrics && metrics.metricsData.length && metrics.targetData.length) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can safely remove this check, because the earlier |
||
log.debug('Start sending metrics data'); | ||
api | ||
.postMetrics(environment, cluster, metrics) | ||
.then((response) => { | ||
log.debug('Metrics server returns: ', response.status); | ||
infoMetricsSuccess(log); | ||
if (response.status >= 400) { | ||
log.error( | ||
'Error while sending metrics data with status code: ', | ||
response.status, | ||
); | ||
} | ||
}) | ||
.catch((error: Error) => { | ||
warnPostMetricsFailed(`${error}`, log); | ||
log.debug('Metrics server returns error: ', error); | ||
}); | ||
} | ||
log.debug('Start sending metrics data'); | ||
api | ||
.postMetrics(environment, cluster, metrics) | ||
.then((response) => { | ||
log.debug('Metrics server returns: ', response.status); | ||
infoMetricsSuccess(log); | ||
if (response.status >= 400) { | ||
log.error( | ||
'Error while sending metrics data with status code: ', | ||
response.status, | ||
); | ||
} | ||
}) | ||
.catch((error: Error) => { | ||
warnPostMetricsFailed(`${error}`, log); | ||
log.debug('Metrics server returns error: ', error); | ||
}); | ||
}; | ||
|
||
const start = (): void => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const VERSION = '1.4.0'; | ||
export const VERSION = '1.4.1'; |
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.
data
is initialized when it is declared so this will always be true