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

Add an option to send histograms/summary counts as monotonic counters #4629

Merged
merged 2 commits into from
Oct 11, 2019

Conversation

mfpierre
Copy link
Contributor

What does this PR do?

Add an option to send histograms & summaries counts as monotonic_counter

Motivation

Using monotonic counts for counters is more appropriate is most cases

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have changelog/ and integration/ labels attached
  • Feature or bugfix must have tests
  • Git history must be clean
  • If PR adds a configuration option, it must be added to the configuration file.

@mfpierre mfpierre force-pushed the mfpierre/histograms-summary-count branch from 27345ce to ba598fe Compare October 10, 2019 08:48
Copy link
Member

@AlexandreYang AlexandreYang left a comment

Choose a reason for hiding this comment

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

Using monotonic counts for counters is more appropriate is most cases

Is using a flag like send_counts_as_monotonic an issue if we want only some of the metrics to be send as monotonic counts ?

As you said above, it might be appropriate for most cases, but maybe not all cases.

Would it be more appropriate to provide a way to supply a specific type for each metric ? Example:

    def __init__(self, name, init_config, agentConfig, instances=None):
        super(CrioCheck, self).__init__(
            ...
            default_instances={
                "crio": {
                    ...
                    'metrics': [
                        {'container_runtime_crio_operations1': ('operations.count', GAUGE)},
                        {'container_runtime_crio_operations2': ('operations.count', COUNT)},
                        {'container_runtime_crio_operations_latency_microseconds': ('operations.latency', MONOTONIC_COUNT)},
                    ],
                    ...
                }
            },
        )

@mfpierre
Copy link
Contributor Author

@AlexandreYang actually there's already a setting for this called send_monotonic_counter that would send counter typed metrics as monotonic_counter (ever increasing value). Note that's what you're suggesting is already possible via type override.

This change is only for the counters inside summary/histograms metrics.

Copy link
Member

@AlexandreYang AlexandreYang left a comment

Choose a reason for hiding this comment

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

Oh, right. Thx for the explanation.

So there is no case, where you might want to send some distribution counts as count and some other as monotonic count ?

@@ -172,6 +172,10 @@ def create_scraper_configuration(self, instance=None):
instance.get('send_monotonic_counter', default_instance.get('send_monotonic_counter', True))
)

config['send_counts_as_monotonic'] = is_affirmative(
Copy link
Member

Choose a reason for hiding this comment

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

Since that's quite specific to distribution metrics. Should the name be a bit more precise like: send_distribution_counts_as_monotonic ?

Otherwise, this might be confused with sending all counts as monotonic.

AlexandreYang
AlexandreYang previously approved these changes Oct 10, 2019
Copy link
Member

@AlexandreYang AlexandreYang left a comment

Choose a reason for hiding this comment

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

LGTM. Maybe be nice to have a review from @DataDog/container-integrations too.

@mfpierre mfpierre force-pushed the mfpierre/histograms-summary-count branch from a751e78 to a48a3c1 Compare October 10, 2019 15:26
@therve therve merged commit 45dc683 into master Oct 11, 2019
@therve therve deleted the mfpierre/histograms-summary-count branch October 11, 2019 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants