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

[Fleet] Fix metric types for GCP + elastic package registry integrations #6128

Merged
merged 3 commits into from
May 11, 2023

Conversation

kpollich
Copy link
Member

@kpollich kpollich commented May 9, 2023

What does this PR do?

Fix metric_type declarations for GCP and Elastic Package Registry integrations. These integrations had gauge metrics declared for non-numeric fields like booleans and dates, which resulted in Elasticsearch errors when enabling TSDB or generating time series metrics in mappings.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

@kpollich kpollich added the bug Something isn't working label May 9, 2023
@kpollich kpollich self-assigned this May 9, 2023
@kpollich kpollich requested review from a team as code owners May 9, 2023 12:46
@elasticmachine
Copy link

elasticmachine commented May 9, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-05-09T13:05:12.723+0000

  • Duration: 20 min 22 sec

Test stats 🧪

Test Results
Failed 0
Passed 64
Skipped 0
Total 64

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented May 9, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (7/7) 💚
Files 100.0% (7/7) 💚 50.0
Classes 100.0% (7/7) 💚 50.0
Methods 90.351% (103/114) 👍 21.12
Lines 96.192% (1541/1602) 👍 25.822
Conditionals 100.0% (0/0) 💚

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

LGTM changes in elastic-package-registry 👍

@kpollich
Copy link
Member Author

@elastic/security-external-integrations and @elastic/obs-cloud-monitoring could I get code owner review here? This is blocking some fixes we'd like to land before 8.8 FF. Thanks in advance!

@kpollich kpollich merged commit 11a47fe into elastic:main May 11, 2023
1 check passed
@kpollich kpollich deleted the fix-metrics-types branch May 11, 2023 11:40
kpollich added a commit to elastic/kibana that referenced this pull request May 11, 2023
…whether `index_mode: "time_series"` is set (#157047)

## Summary

Blocked by elastic/integrations#6128

This PR changes Fleet's mapping generation logic in `@package` component
templates such that `time_series_dimension: true` and `metric_type`
properties are generated for all mappings regardless of whether
`index_mode: "time_series"` is set. Previously, Elasticsearch would
error if this were the case, however in newer versions of Elasticsearch
it's simply a no-op when `index_mode` is not set to `time_series` and
TSDS fields are declared.

This allows us to more easily toggle TSDB on/off via API requests for
user trial.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@elasticmachine
Copy link

Package elastic_package_registry - 0.0.7 containing this change is available at https://epr.elastic.co/search?package=elastic_package_registry

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 11, 2023
…whether `index_mode: "time_series"` is set (elastic#157047)

## Summary

Blocked by elastic/integrations#6128

This PR changes Fleet's mapping generation logic in `@package` component
templates such that `time_series_dimension: true` and `metric_type`
properties are generated for all mappings regardless of whether
`index_mode: "time_series"` is set. Previously, Elasticsearch would
error if this were the case, however in newer versions of Elasticsearch
it's simply a no-op when `index_mode` is not set to `time_series` and
TSDS fields are declared.

This allows us to more easily toggle TSDB on/off via API requests for
user trial.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit c21f2a9)
@elasticmachine
Copy link

Package gcp - 2.20.1 containing this change is available at https://epr.elastic.co/search?package=gcp

kibanamachine added a commit to elastic/kibana that referenced this pull request May 11, 2023
…ss of whether `index_mode: "time_series"` is set (#157047) (#157378)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Fleet] Always generate time series metrics/dimensions regardless of
whether `index_mode: "time_series"` is set
(#157047)](#157047)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kyle
Pollich","email":"kyle.pollich@elastic.co"},"sourceCommit":{"committedDate":"2023-05-11T11:41:06Z","message":"[Fleet]
Always generate time series metrics/dimensions regardless of whether
`index_mode: \"time_series\"` is set (#157047)\n\n##
Summary\r\n\r\nBlocked by
elastic/integrations#6128 PR changes
Fleet's mapping generation logic in `@package` component\r\ntemplates
such that `time_series_dimension: true` and `metric_type`\r\nproperties
are generated for all mappings regardless of whether\r\n`index_mode:
\"time_series\"` is set. Previously, Elasticsearch would\r\nerror if
this were the case, however in newer versions of Elasticsearch\r\nit's
simply a no-op when `index_mode` is not set to `time_series` and\r\nTSDS
fields are declared.\r\n\r\nThis allows us to more easily toggle TSDB
on/off via API requests for\r\nuser
trial.\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"c21f2a978f1a9b849d437ed91b3c7708d87c04b9","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Fleet","backport:prev-minor","v8.9.0"],"number":157047,"url":"#157047
Always generate time series metrics/dimensions regardless of whether
`index_mode: \"time_series\"` is set (#157047)\n\n##
Summary\r\n\r\nBlocked by
elastic/integrations#6128 PR changes
Fleet's mapping generation logic in `@package` component\r\ntemplates
such that `time_series_dimension: true` and `metric_type`\r\nproperties
are generated for all mappings regardless of whether\r\n`index_mode:
\"time_series\"` is set. Previously, Elasticsearch would\r\nerror if
this were the case, however in newer versions of Elasticsearch\r\nit's
simply a no-op when `index_mode` is not set to `time_series` and\r\nTSDS
fields are declared.\r\n\r\nThis allows us to more easily toggle TSDB
on/off via API requests for\r\nuser
trial.\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"c21f2a978f1a9b849d437ed91b3c7708d87c04b9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"#157047
Always generate time series metrics/dimensions regardless of whether
`index_mode: \"time_series\"` is set (#157047)\n\n##
Summary\r\n\r\nBlocked by
elastic/integrations#6128 PR changes
Fleet's mapping generation logic in `@package` component\r\ntemplates
such that `time_series_dimension: true` and `metric_type`\r\nproperties
are generated for all mappings regardless of whether\r\n`index_mode:
\"time_series\"` is set. Previously, Elasticsearch would\r\nerror if
this were the case, however in newer versions of Elasticsearch\r\nit's
simply a no-op when `index_mode` is not set to `time_series` and\r\nTSDS
fields are declared.\r\n\r\nThis allows us to more easily toggle TSDB
on/off via API requests for\r\nuser
trial.\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"c21f2a978f1a9b849d437ed91b3c7708d87c04b9"}}]}]
BACKPORT-->

Co-authored-by: Kyle Pollich <kyle.pollich@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants