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 detailed_index_stats parameter to pull index-level metrics #10766

Merged
merged 12 commits into from
Dec 7, 2021
Merged

Add detailed_index_stats parameter to pull index-level metrics #10766

merged 12 commits into from
Dec 7, 2021

Conversation

missingcharacter
Copy link
Contributor

@missingcharacter missingcharacter commented Dec 1, 2021

What does this PR do?

Creates a parameter called detailed_index_stats within the elastic integration.
In order to obtain index-level stats when your cluster is hosted externally (i.e., you're not pointing to localhost), you'd set:

  • cluster_stats: true
  • detailed_index_stats: true

Motivation

AWS OpenSearch integration does not have these metrics and I'd like to get as many stats as I can out of my cluster

Additional Notes

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • 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

@missingcharacter missingcharacter requested review from a team as code owners December 1, 2021 03:13
…th cluster_stats if you want to pull index-level metrics
@codecov
Copy link

codecov bot commented Dec 1, 2021

Codecov Report

Merging #10766 (580e516) into master (ea588b8) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Flag Coverage Δ
elastic 90.52% <100.00%> (+1.89%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

elastic/assets/configuration/spec.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@sarah-witt sarah-witt left a comment

Choose a reason for hiding this comment

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

Hi @missingcharacter thanks a lot for the PR! I left two initial comments

c = from_instance({'url': 'http://example.com', 'detailed_index_stats': True})
assert c.detailed_index_stats is True


Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also add a test for running the check when this parameter is enabled, and assert the expected tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sarah-witt thanks and I addressed this comment in commit 0ffcd75

if value is not None:
value = value.get(key)
value = value.get(key.replace('\\', ''))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some unit tests for process_metric since the behavior is changing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the creation of an index that starts with a dot "." and added a check for this new index to test_index_metrics and the new test I created called test_detailed_index_stats in commit 0ffcd75

jtappa
jtappa previously approved these changes Dec 3, 2021
Copy link
Contributor

@jtappa jtappa left a comment

Choose a reason for hiding this comment

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

👍🏻 from docs team

Copy link
Contributor

@coignetp coignetp 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 the PR! Could you add documentation about these metrics in metadata.csv https://github.com/DataDog/integrations-core/blob/master/elastic/metadata.csv

elastic/tests/test_elastic.py Show resolved Hide resolved
@coignetp coignetp changed the title [Added] Creating parameter detailed_index_stats to be used with cluster_stats if you want to pull index-level metrics Add detailed_index_stats parameter to pull index-level metrics Dec 6, 2021
@missingcharacter
Copy link
Contributor Author

@coignetp all tests pass now

Copy link
Contributor

@coignetp coignetp left a comment

Choose a reason for hiding this comment

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

Sorry for the noice and the back and forth, but in the end let's get rid of assert_all_metrics_covered, as it seems we should apply this more broadly and it's out of scope of this PR

elastic/metadata.csv Outdated Show resolved Hide resolved
elastic/tests/test_elastic.py Outdated Show resolved Hide resolved
elastic/tests/test_elastic.py Outdated Show resolved Hide resolved
@missingcharacter
Copy link
Contributor Author

@coignetp and @sarah-witt all tests pass now

Copy link
Contributor

@coignetp coignetp left a comment

Choose a reason for hiding this comment

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

Thanks!

@coignetp coignetp merged commit c6f368f into DataDog:master Dec 7, 2021
github-actions bot pushed a commit that referenced this pull request Dec 7, 2021
* [elasticsearch] Creating parameter detailed_index_stats to be used with cluster_stats if you want to pull index-level metrics

* Update elastic/assets/configuration/spec.yaml

Co-authored-by: Jorie Helwig <joriephoto@gmail.com>

* [elastic] ddev validate config --sync elastic

* [elastic] Adding tests for when an index name start with a dot "."

* [elastic] Asserting all metrics instead of 1 at a time

Co-authored-by: Paul <paul.coignet@datadoghq.com>

* [tests] [detailed_index_stats] Asserting rest of metrics for tests to pass

* [elastic] Adding correct columns to elastic/metadata.csv

* [elastic] Adding missing metrics to metadata.csv

* [elastic] Remove system.* metrics from metadata.csv for now

Co-authored-by: Paul <paul.coignet@datadoghq.com>

* [elastic] Remove system.* metrics from assert_metrics_using_metadata

Co-authored-by: Paul <paul.coignet@datadoghq.com>

* [elastic] Remove aggregator.assert_all_metrics_covered()

Co-authored-by: Paul <paul.coignet@datadoghq.com>

* [elastic] python-black on elastic/tests/test_elastic.py

Co-authored-by: Jorie Helwig <joriephoto@gmail.com>
Co-authored-by: Paul <paul.coignet@datadoghq.com> c6f368f
@missingcharacter missingcharacter deleted the aws-opensearch-index-level-metrics branch December 7, 2021 12:14
@missingcharacter
Copy link
Contributor Author

Thanks @coignetp @jtappa @sarah-witt

cswatt pushed a commit that referenced this pull request Jan 5, 2022
* [elasticsearch] Creating parameter detailed_index_stats to be used with cluster_stats if you want to pull index-level metrics

* Update elastic/assets/configuration/spec.yaml

Co-authored-by: Jorie Helwig <joriephoto@gmail.com>

* [elastic] ddev validate config --sync elastic

* [elastic] Adding tests for when an index name start with a dot "."

* [elastic] Asserting all metrics instead of 1 at a time

Co-authored-by: Paul <paul.coignet@datadoghq.com>

* [tests] [detailed_index_stats] Asserting rest of metrics for tests to pass

* [elastic] Adding correct columns to elastic/metadata.csv

* [elastic] Adding missing metrics to metadata.csv

* [elastic] Remove system.* metrics from metadata.csv for now

Co-authored-by: Paul <paul.coignet@datadoghq.com>

* [elastic] Remove system.* metrics from assert_metrics_using_metadata

Co-authored-by: Paul <paul.coignet@datadoghq.com>

* [elastic] Remove aggregator.assert_all_metrics_covered()

Co-authored-by: Paul <paul.coignet@datadoghq.com>

* [elastic] python-black on elastic/tests/test_elastic.py

Co-authored-by: Jorie Helwig <joriephoto@gmail.com>
Co-authored-by: Paul <paul.coignet@datadoghq.com>
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.

5 participants