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

[Exporter/Datadog] Added debug flag to print metrics payload #7570

Closed
wants to merge 2 commits into from

Conversation

ikhan-tc
Copy link

@ikhan-tc ikhan-tc commented Feb 4, 2022

Description: Added debug logging to log metrics payload data sent to Datadog. Redo #5856 as debug log instead of Info log. Metrics payload data will be logged if collector is started in debug mode.

Link to tracking Issue: #7528

Testing: Started the collector in debug mode to test the output. The metrics payload data only logged if the collector is in debug mode.

@ikhan-tc ikhan-tc requested a review from mx-psi as a code owner February 4, 2022 17:46
@ikhan-tc ikhan-tc requested a review from a team February 4, 2022 17:46
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 4, 2022

CLA Signed

The committers are authorized under a signed CLA.

  • ✅ ikhan-tc (81adb421ac8c6f0522c30f948e04b038c5293ef0)

@ikhan-tc ikhan-tc changed the title Added debug flag to print metrics payload [Exporter/Datadog] Added debug flag to print metrics payload Feb 4, 2022
@ikhan-tc
Copy link
Author

ikhan-tc commented Feb 4, 2022

@mx-psi Can you please review this PR. I added back that line of code which is spamming the logs but changed the log level to "debug" instead of "info".

@@ -178,6 +178,7 @@ func (exp *metricsExporter) PushMetricsData(ctx context.Context, md pdata.Metric

err = nil
if len(ms) > 0 {
exp.params.Logger.Debug("exporting payload", zap.Any("metric", ms))
Copy link
Member

Choose a reason for hiding this comment

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

Indentation here looks odd. Did you run gofmt and/or the linter target? This will likely fail the CI.

Copy link
Author

Choose a reason for hiding this comment

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

@jpkrohling Can you please review this PR again. Tested with gofmt and linter this time.

@ikhan-tc ikhan-tc force-pushed the add_debug_log_payload branch from 81adb42 to 1126067 Compare February 7, 2022 15:12
@ikhan-tc ikhan-tc requested a review from jpkrohling February 8, 2022 20:32
Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @ikhan-tc and apologies for the delay in replying.

I understand the need for this and this has been an ask by other users before. However, these are not the only types of payloads that we export for metrics, and it would be confusing to log only some of them. In particular:

  1. We export 'sketches' payloads for Histogram metrics by default here these are sent in Protobuf format, so logging them would be a bit more difficult. Their format is also a bit more difficult to understand.
  2. We export 'host metadata' payloads here
    func pushMetadata(cfg *config.Config, buildInfo component.BuildInfo, metadata *HostMetadata) error {
    . These are also relevant for metrics; e.g. the tags field in the configuration is sent in this payload together with the host and then the backend applies these tags to the metrics. We already log this one.

If we only log the 'metrics series' payloads, users that are exporting Histograms could be confused). I think we should at least log something for sketches: at the very least number of sketches exported (ideally also their names).

A second question is whether we want these to be logged unconditionally in debug mode. I am undecided on this one; what do you think about this? I would try to look at what other exporters do over the next few days to help decide on this.

@mx-psi
Copy link
Member

mx-psi commented Feb 22, 2022

Hey again, I had a look at what other exporters. I think from my side I am okay to log unconditionally on debug, but to accept this PR I want to log also the sketches payloads then.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2022

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Mar 9, 2022
@mx-psi mx-psi removed the Stale label Mar 9, 2022
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Mar 24, 2022
@kmotupalli-tc
Copy link
Contributor

@mx-psi - I raised a pull request here - #8929
as per your change requests. Please review it.

@mx-psi
Copy link
Member

mx-psi commented Mar 28, 2022

@kmotupalli-tc Thanks! I left a comment, code looks good now :)

@github-actions github-actions bot removed the Stale label Mar 29, 2022
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Apr 14, 2022
@mx-psi
Copy link
Member

mx-psi commented Apr 14, 2022

#8929 was merged, so I am closing this. If this needs to be reopened for any reason please ping me!

@mx-psi mx-psi closed this Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants