Skip to content
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

Smart Agent Receiver: add datapoint conversion #56

Merged
merged 2 commits into from
Jan 14, 2021

Conversation

rmfitzpatrick
Copy link
Contributor

These changes address the 3rd remaining item detailed in #53 (comment) by adding internal SFx datapoint to pdata metric translation and forwarding to the next metric consumer. They are largely based on the translation that occurs in Collector Contrib's SFx receiver but without using SFx's protobuf definitions.

In testing these changes, there is a minor form of end-to-end integration test that uses the native SA cpu monitor without vetting its metric content too heavily, which I deemed out of scope after earlier attempts in light of CI flake and cross-platform concerns.

@codecov-io
Copy link

Codecov Report

Merging #56 (1aae972) into main (52b356c) will increase coverage by 0.22%.
The diff coverage is 94.59%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #56      +/-   ##
==========================================
+ Coverage   93.90%   94.13%   +0.22%     
==========================================
  Files           5        6       +1     
  Lines         197      307     +110     
==========================================
+ Hits          185      289     +104     
- Misses          6       11       +5     
- Partials        6        7       +1     
Impacted Files Coverage Δ
internal/receiver/smartagentreceiver/convert.go 94.17% <94.17%> (ø)
internal/receiver/smartagentreceiver/output.go 100.00% <100.00%> (ø)
internal/receiver/smartagentreceiver/receiver.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52b356c...1aae972. Read the comment docs.

err := setDataType(datapoint, m)
if err != nil {
numDropped++
c.logger.Warn("SignalFx datapoint type conversion error",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is probably better to use Debug instead of Warn for conversion errors otherwise it can flood the logs: https://github.com/open-telemetry/opentelemetry-collector/blob/master/CONTRIBUTING.md#logging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, reverted change.

@@ -60,6 +71,9 @@ func (output *Output) Copy() types.Output {

func (output *Output) SendDatapoints(datapoints ...*datapoint.Datapoint) {
output.logger.Debug("SendDatapoints has been called.", zap.Any("datapoints", datapoints))
metrics, numDropped := output.converter.toMetrics(datapoints)
output.logger.Debug("SendDatapoints", zap.Any("metrics", metrics), zap.Int("numDropped", numDropped))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to remove the logger.Debug's in the final version so that Debug logs are not flooded for success cases. OK to keep for now if you are using them for debugging while you are actively developing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, updated to use internal tracing and only debug log on dropped points.

@rmfitzpatrick rmfitzpatrick merged commit 8227889 into main Jan 14, 2021
@rmfitzpatrick rmfitzpatrick deleted the smartagentconversion branch January 14, 2021 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants