Skip to content

Commit

Permalink
[FFM-9621] - Avoid sending empty metric payloads (#89)
Browse files Browse the repository at this point in the history
* [FFM-9621] - Avoid sending empty metric payloads

What
Adds a check to make sure metrics data is not empty before sending it.

Why
We're seeing empty metrics payloads arriving at the BE we should avoid wasting network bandwidth.

Testing
Manual

Co-authored-by: Kevin Nagurski <Kevin.nagurski@harness.io>
  • Loading branch information
andybharness and knagurski authored Oct 17, 2023
1 parent d0019e1 commit b8c7f8a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@harnessio/ff-nodejs-server-sdk",
"version": "1.3.4",
"version": "1.3.5",
"description": "Feature flags SDK for NodeJS environments",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
Expand Down
3 changes: 2 additions & 1 deletion src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ export const MetricsProcessor = (
}

const metrics: Metrics = _summarize();
if (metrics) {

if (metrics && metrics.metricsData.length && metrics.targetData.length) {
log.debug('Start sending metrics data');
api
.postMetrics(environment, cluster, metrics)
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = "1.3.4";
export const VERSION = "1.3.5";

0 comments on commit b8c7f8a

Please sign in to comment.