-
Notifications
You must be signed in to change notification settings - Fork 84
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 option for Batch to merge results before sending. #1103
Conversation
This is needed when batching Metric data that has been transformed to Line Protocol format. closes edgexfoundry#1101 Signed-off-by: Leonard Goodell <[email protected]>
pkg/transforms/metrics.go
Outdated
@@ -64,7 +64,8 @@ func (mp *MetricsProcessor) ToLineProtocol(ctx interfaces.AppFunctionContext, da | |||
metric.Tags = append(metric.Tags, mp.additionalTags...) | |||
} | |||
|
|||
result := metric.ToLineProtocol() | |||
// New line is needed if the resulting metric data is batched and sent in chunks to service like InfluxDB | |||
result := metric.ToLineProtocol() + "\n" |
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.
use fmt.Sprintln() to avoid hard coded \n
? :
result := metric.ToLineProtocol() + "\n" | |
result := fmt.Sprintln(metric.ToLineProtocol()) |
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.
I like it. THX!
Changed.
Signed-off-by: Leonard Goodell <[email protected]>
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
Codecov Report
@@ Coverage Diff @@
## main #1103 +/- ##
==========================================
- Coverage 68.56% 68.49% -0.08%
==========================================
Files 37 37
Lines 3022 3034 +12
==========================================
+ Hits 2072 2078 +6
- Misses 822 827 +5
- Partials 128 129 +1
Continue to review full report at Codecov.
|
This is needed when batching Metric data that has been transformed to
Line Protocol format.
closes #1101
Signed-off-by: Leonard Goodell [email protected]
If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/app-functions-sdk-go/blob/main/.github/CONTRIBUTING.md
PR Checklist
Please check if your PR fulfills the following requirements:
BREAKING CHANGE:
describing the break)TBD
Testing Instructions
Build and run App Template service to generate metrics
Build ASC with this branch
Configure ASC metrics-profile with:
ExecutionOrder = "ToLineProtocol, Batch, HTTPExport"
MergeOnSend = "true"
in Batch function parametersRun ASC with metrics-profile with DEBUG logging
Verify HTTP Export reports
status is 204 No Content
in log fileNew Dependency Instructions (If applicable)