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

Enable all remaining metric aggregations on counters #97974

Conversation

salvatore-campagna
Copy link
Contributor

@salvatore-campagna salvatore-campagna commented Jul 26, 2023

Here we enable aggregations previously not allowed on fields of type counter.
The decision of enabling such aggregations even if the result is "meaningless"
for counters has been taken to favour TSDB adoption.

Aggregations now allowed, other than the existing ones, include:

  • avg
  • box plot
  • cardinality
  • extended stats
  • median absolute deviation
  • percentile ranks
  • percentiles
  • stats
  • sum
  • value count

I included tests for the weighted average and matrix stats aggregations too.

Resolves #97882

@salvatore-campagna salvatore-campagna added :Analytics/Aggregations Aggregations backport auto-backport Automatically create backport pull requests when merged :StorageEngine/TSDB You know, for Metrics v8.10.0 v8.9.1 labels Jul 26, 2023
@salvatore-campagna salvatore-campagna self-assigned this Jul 26, 2023
@salvatore-campagna
Copy link
Contributor Author

I need to update the documentation including supported aggregations for counters.

@@ -152,7 +152,7 @@ of aggregations (for example `sum`) compute results that don't make sense for a
+
Only numeric and `aggregate_metric_double` fields support the `counter` metric type.

NOTE: Due to the cumulative nature of counter fields, only the following aggregations are allowed with the `counter` field: `rate`, `histogram`, `range`, `min`, `max`, `top_metrics` and `variable_width_histogram`.
NOTE: Due to the cumulative nature of counter fields, the following aggregations are supported and expected to provide meaningful results with the `counter` field: `rate`, `histogram`, `range`, `min`, `max`, `top_metrics` and `variable_width_histogram`. Anyway, in order to prevent issues with existing integrations, we also allow the following aggregations, even if the result might be meaningless on counters: `avg`, `box plot`, `cardinality`, `extended stats`, `median absolute deviation`, `percentile ranks`, `percentiles`, `stats`, `sum` and `value count`.

Choose a reason for hiding this comment

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

issues with existing integrations

Should we say instead existing integrations custom dashboards?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove the Anyway, part and just start with In order to prevent ...?

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -152,7 +152,7 @@ of aggregations (for example `sum`) compute results that don't make sense for a
+
Only numeric and `aggregate_metric_double` fields support the `counter` metric type.

NOTE: Due to the cumulative nature of counter fields, only the following aggregations are allowed with the `counter` field: `rate`, `histogram`, `range`, `min`, `max`, `top_metrics` and `variable_width_histogram`.
NOTE: Due to the cumulative nature of counter fields, the following aggregations are supported and expected to provide meaningful results with the `counter` field: `rate`, `histogram`, `range`, `min`, `max`, `top_metrics` and `variable_width_histogram`. Anyway, in order to prevent issues with existing integrations, we also allow the following aggregations, even if the result might be meaningless on counters: `avg`, `box plot`, `cardinality`, `extended stats`, `median absolute deviation`, `percentile ranks`, `percentiles`, `stats`, `sum` and `value count`.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove the Anyway, part and just start with In order to prevent ...?

@salvatore-campagna salvatore-campagna merged commit d0b2f65 into elastic:main Aug 8, 2023
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.9 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 97974

@salvatore-campagna
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.9

Questions ?

Please refer to the Backport tool documentation

salvatore-campagna added a commit to salvatore-campagna/elasticsearch that referenced this pull request Aug 8, 2023
Here we enable aggregations previously not allowed on fields of type counter.
The decision of enabling such aggregations even if the result is "meaningless"
for counters has been taken to favour TSDB adoption.

Aggregations now allowed, other than the existing ones, include:
* avg
* box plot
* cardinality
* extended stats
* median absolute deviation
* percentile ranks
* percentiles
* stats
* sum
* value count

I included tests for the weighted average and matrix stats aggregations too.

Resolves elastic#97882

(cherry picked from commit d0b2f65)

# Conflicts:
#	rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/120_counter_fields.yml
salvatore-campagna added a commit that referenced this pull request Aug 8, 2023
…98294)

* Enable all remaining metric aggregations on counters (#97974)

Here we enable aggregations previously not allowed on fields of type counter.
The decision of enabling such aggregations even if the result is "meaningless"
for counters has been taken to favour TSDB adoption.

Aggregations now allowed, other than the existing ones, include:
* avg
* box plot
* cardinality
* extended stats
* median absolute deviation
* percentile ranks
* percentiles
* stats
* sum
* value count

I included tests for the weighted average and matrix stats aggregations too.

Resolves #97882

(cherry picked from commit d0b2f65)

# Conflicts:
#	rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/120_counter_fields.yml

* fix: skip versions up to and including 8.9.0
dej611 added a commit to elastic/kibana that referenced this pull request Aug 11, 2023
…ported operations (#163515)

## Summary

Fix #163473

This PR relaxes a bit the checks on the Lens side for old/saved
visualizations with unsupported operations for the `counter` field type,
while preserving those checks for newer visualizations.

Dashboards with "meaningless" operations will now show a warning
message:
<img width="556" alt="Screenshot 2023-08-09 at 18 31 21"
src="https://github.com/elastic/kibana/assets/924948/7c8f3739-4957-4d1d-8aaa-e9457b8a4426">

When in editor the warning is shown at the top-right corner as well:
<img width="845" alt="Screenshot 2023-08-09 at 18 30 31"
src="https://github.com/elastic/kibana/assets/924948/c52a7823-d4b9-4efd-9c5d-ca654f3f03a0">

New visualizations still prevent the user from using the unsupported
operations:
<img width="410" alt="Screenshot 2023-08-09 at 18 30 55"
src="https://github.com/elastic/kibana/assets/924948/d2364a01-0dc3-409a-9c0b-3e3a77cb2566">
<img width="848" alt="Screenshot 2023-08-09 at 18 31 48"
src="https://github.com/elastic/kibana/assets/924948/086a7360-6b1a-40a2-90d9-f4e8c7bf3f3a">

There's theoretically a last case where users in old SOs might create a
new metric dimension trying to force to use a unsupported operation for
a counter field: in this case the logic for a "new" visualization will
kick-in, clean the data in the workspace and show a full error.
Cancelling such metric dimension will lead to the previous "relaxed"
state.

Messages are grouped by field and by top referencing column (i.e. a
formula): this means that if a formula uses the same `counter` field
with two different dimensions (i.e. `sum(counter_field) +
median(counter_field)` as `myFormula`) will show up as a single column
(`myFormula`).

The wording of the message mimics the same documentation copy provided
in the ES documentation. Ref:
elastic/elasticsearch#97974

Testing SO:


[export.ndjson.txt](https://github.com/elastic/kibana/files/12304924/export.ndjson.txt)


### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
benakansara pushed a commit to benakansara/kibana that referenced this pull request Aug 14, 2023
…ported operations (elastic#163515)

## Summary

Fix elastic#163473

This PR relaxes a bit the checks on the Lens side for old/saved
visualizations with unsupported operations for the `counter` field type,
while preserving those checks for newer visualizations.

Dashboards with "meaningless" operations will now show a warning
message:
<img width="556" alt="Screenshot 2023-08-09 at 18 31 21"
src="https://github.com/elastic/kibana/assets/924948/7c8f3739-4957-4d1d-8aaa-e9457b8a4426">

When in editor the warning is shown at the top-right corner as well:
<img width="845" alt="Screenshot 2023-08-09 at 18 30 31"
src="https://github.com/elastic/kibana/assets/924948/c52a7823-d4b9-4efd-9c5d-ca654f3f03a0">

New visualizations still prevent the user from using the unsupported
operations:
<img width="410" alt="Screenshot 2023-08-09 at 18 30 55"
src="https://github.com/elastic/kibana/assets/924948/d2364a01-0dc3-409a-9c0b-3e3a77cb2566">
<img width="848" alt="Screenshot 2023-08-09 at 18 31 48"
src="https://github.com/elastic/kibana/assets/924948/086a7360-6b1a-40a2-90d9-f4e8c7bf3f3a">

There's theoretically a last case where users in old SOs might create a
new metric dimension trying to force to use a unsupported operation for
a counter field: in this case the logic for a "new" visualization will
kick-in, clean the data in the workspace and show a full error.
Cancelling such metric dimension will lead to the previous "relaxed"
state.

Messages are grouped by field and by top referencing column (i.e. a
formula): this means that if a formula uses the same `counter` field
with two different dimensions (i.e. `sum(counter_field) +
median(counter_field)` as `myFormula`) will show up as a single column
(`myFormula`).

The wording of the message mimics the same documentation copy provided
in the ES documentation. Ref:
elastic/elasticsearch#97974

Testing SO:


[export.ndjson.txt](https://github.com/elastic/kibana/files/12304924/export.ndjson.txt)


### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Aug 14, 2023
…ported operations (elastic#163515)

## Summary

Fix elastic#163473

This PR relaxes a bit the checks on the Lens side for old/saved
visualizations with unsupported operations for the `counter` field type,
while preserving those checks for newer visualizations.

Dashboards with "meaningless" operations will now show a warning
message:
<img width="556" alt="Screenshot 2023-08-09 at 18 31 21"
src="https://github.com/elastic/kibana/assets/924948/7c8f3739-4957-4d1d-8aaa-e9457b8a4426">

When in editor the warning is shown at the top-right corner as well:
<img width="845" alt="Screenshot 2023-08-09 at 18 30 31"
src="https://github.com/elastic/kibana/assets/924948/c52a7823-d4b9-4efd-9c5d-ca654f3f03a0">

New visualizations still prevent the user from using the unsupported
operations:
<img width="410" alt="Screenshot 2023-08-09 at 18 30 55"
src="https://github.com/elastic/kibana/assets/924948/d2364a01-0dc3-409a-9c0b-3e3a77cb2566">
<img width="848" alt="Screenshot 2023-08-09 at 18 31 48"
src="https://github.com/elastic/kibana/assets/924948/086a7360-6b1a-40a2-90d9-f4e8c7bf3f3a">

There's theoretically a last case where users in old SOs might create a
new metric dimension trying to force to use a unsupported operation for
a counter field: in this case the logic for a "new" visualization will
kick-in, clean the data in the workspace and show a full error.
Cancelling such metric dimension will lead to the previous "relaxed"
state.

Messages are grouped by field and by top referencing column (i.e. a
formula): this means that if a formula uses the same `counter` field
with two different dimensions (i.e. `sum(counter_field) +
median(counter_field)` as `myFormula`) will show up as a single column
(`myFormula`).

The wording of the message mimics the same documentation copy provided
in the ES documentation. Ref:
elastic/elasticsearch#97974

Testing SO:

[export.ndjson.txt](https://github.com/elastic/kibana/files/12304924/export.ndjson.txt)

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
(cherry picked from commit 4c812e3)
dej611 added a commit to dej611/kibana that referenced this pull request Aug 17, 2023
…ported operations (elastic#163515)

## Summary

Fix elastic#163473

This PR relaxes a bit the checks on the Lens side for old/saved
visualizations with unsupported operations for the `counter` field type,
while preserving those checks for newer visualizations.

Dashboards with "meaningless" operations will now show a warning
message:
<img width="556" alt="Screenshot 2023-08-09 at 18 31 21"
src="https://github.com/elastic/kibana/assets/924948/7c8f3739-4957-4d1d-8aaa-e9457b8a4426">

When in editor the warning is shown at the top-right corner as well:
<img width="845" alt="Screenshot 2023-08-09 at 18 30 31"
src="https://github.com/elastic/kibana/assets/924948/c52a7823-d4b9-4efd-9c5d-ca654f3f03a0">

New visualizations still prevent the user from using the unsupported
operations:
<img width="410" alt="Screenshot 2023-08-09 at 18 30 55"
src="https://github.com/elastic/kibana/assets/924948/d2364a01-0dc3-409a-9c0b-3e3a77cb2566">
<img width="848" alt="Screenshot 2023-08-09 at 18 31 48"
src="https://github.com/elastic/kibana/assets/924948/086a7360-6b1a-40a2-90d9-f4e8c7bf3f3a">

There's theoretically a last case where users in old SOs might create a
new metric dimension trying to force to use a unsupported operation for
a counter field: in this case the logic for a "new" visualization will
kick-in, clean the data in the workspace and show a full error.
Cancelling such metric dimension will lead to the previous "relaxed"
state.

Messages are grouped by field and by top referencing column (i.e. a
formula): this means that if a formula uses the same `counter` field
with two different dimensions (i.e. `sum(counter_field) +
median(counter_field)` as `myFormula`) will show up as a single column
(`myFormula`).

The wording of the message mimics the same documentation copy provided
in the ES documentation. Ref:
elastic/elasticsearch#97974

Testing SO:


[export.ndjson.txt](https://github.com/elastic/kibana/files/12304924/export.ndjson.txt)


### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
dej611 added a commit to elastic/kibana that referenced this pull request Aug 21, 2023
… unsupported operations (#163515) - manual backport (#164191)

# Backport

This will backport the following commits from `main` to `8.9`:
- [[Lens] Relax counter field checks for saved visualizations with
unsupported operations
(#163515)](#163515)

This is a manual backport which adds a missing mock function, not
available in the automated backport cherry-pick of the PR.
The extra code is here:
`x-pack/plugins/lens/public/datasources/form_based/mocks.ts`

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

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

<!--BACKPORT [{"author":{"name":"Marco
Liberati","email":"dej611@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-08-11T09:52:17Z","message":"[Lens]
Relax counter field checks for saved visualizations with unsupported
operations (#163515)\n\n## Summary\r\n\r\nFix #163473\r\n\r\nThis PR
relaxes a bit the checks on the Lens side for
old/saved\r\nvisualizations with unsupported operations for the
`counter` field type,\r\nwhile preserving those checks for newer
visualizations.\r\n\r\nDashboards with \"meaningless\" operations will
now show a warning\r\nmessage:\r\n<img width=\"556\" alt=\"Screenshot
2023-08-09 at 18 31
21\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/7c8f3739-4957-4d1d-8aaa-e9457b8a4426\">\r\n\r\nWhen
in editor the warning is shown at the top-right corner as well:\r\n<img
width=\"845\" alt=\"Screenshot 2023-08-09 at 18 30
31\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/c52a7823-d4b9-4efd-9c5d-ca654f3f03a0\">\r\n\r\nNew
visualizations still prevent the user from using the
unsupported\r\noperations:\r\n<img width=\"410\" alt=\"Screenshot
2023-08-09 at 18 30
55\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/d2364a01-0dc3-409a-9c0b-3e3a77cb2566\">\r\n<img
width=\"848\" alt=\"Screenshot 2023-08-09 at 18 31
48\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/086a7360-6b1a-40a2-90d9-f4e8c7bf3f3a\">\r\n\r\nThere's
theoretically a last case where users in old SOs might create a\r\nnew
metric dimension trying to force to use a unsupported operation for\r\na
counter field: in this case the logic for a \"new\" visualization
will\r\nkick-in, clean the data in the workspace and show a full
error.\r\nCancelling such metric dimension will lead to the previous
\"relaxed\"\r\nstate.\r\n\r\nMessages are grouped by field and by top
referencing column (i.e. a\r\nformula): this means that if a formula
uses the same `counter` field\r\nwith two different dimensions (i.e.
`sum(counter_field) +\r\nmedian(counter_field)` as `myFormula`) will
show up as a single column\r\n(`myFormula`).\r\n\r\nThe wording of the
message mimics the same documentation copy provided\r\nin the ES
documentation.
Ref:\r\nhttps://github.com/elastic/elasticsearch/pull/97974\r\n\r\nTesting
SO:\r\n\r\n\r\n[export.ndjson.txt](https://github.com/elastic/kibana/files/12304924/export.ndjson.txt)\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"4c812e3b6d1a4e477768dae04047e79bbdc940ff","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","backport:prev-minor","v8.10.0"],"number":163515,"url":"https://github.com/elastic/kibana/pull/163515","mergeCommit":{"message":"[Lens]
Relax counter field checks for saved visualizations with unsupported
operations (#163515)\n\n## Summary\r\n\r\nFix #163473\r\n\r\nThis PR
relaxes a bit the checks on the Lens side for
old/saved\r\nvisualizations with unsupported operations for the
`counter` field type,\r\nwhile preserving those checks for newer
visualizations.\r\n\r\nDashboards with \"meaningless\" operations will
now show a warning\r\nmessage:\r\n<img width=\"556\" alt=\"Screenshot
2023-08-09 at 18 31
21\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/7c8f3739-4957-4d1d-8aaa-e9457b8a4426\">\r\n\r\nWhen
in editor the warning is shown at the top-right corner as well:\r\n<img
width=\"845\" alt=\"Screenshot 2023-08-09 at 18 30
31\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/c52a7823-d4b9-4efd-9c5d-ca654f3f03a0\">\r\n\r\nNew
visualizations still prevent the user from using the
unsupported\r\noperations:\r\n<img width=\"410\" alt=\"Screenshot
2023-08-09 at 18 30
55\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/d2364a01-0dc3-409a-9c0b-3e3a77cb2566\">\r\n<img
width=\"848\" alt=\"Screenshot 2023-08-09 at 18 31
48\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/086a7360-6b1a-40a2-90d9-f4e8c7bf3f3a\">\r\n\r\nThere's
theoretically a last case where users in old SOs might create a\r\nnew
metric dimension trying to force to use a unsupported operation for\r\na
counter field: in this case the logic for a \"new\" visualization
will\r\nkick-in, clean the data in the workspace and show a full
error.\r\nCancelling such metric dimension will lead to the previous
\"relaxed\"\r\nstate.\r\n\r\nMessages are grouped by field and by top
referencing column (i.e. a\r\nformula): this means that if a formula
uses the same `counter` field\r\nwith two different dimensions (i.e.
`sum(counter_field) +\r\nmedian(counter_field)` as `myFormula`) will
show up as a single column\r\n(`myFormula`).\r\n\r\nThe wording of the
message mimics the same documentation copy provided\r\nin the ES
documentation.
Ref:\r\nhttps://github.com/elastic/elasticsearch/pull/97974\r\n\r\nTesting
SO:\r\n\r\n\r\n[export.ndjson.txt](https://github.com/elastic/kibana/files/12304924/export.ndjson.txt)\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"4c812e3b6d1a4e477768dae04047e79bbdc940ff"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/163515","number":163515,"mergeCommit":{"message":"[Lens]
Relax counter field checks for saved visualizations with unsupported
operations (#163515)\n\n## Summary\r\n\r\nFix #163473\r\n\r\nThis PR
relaxes a bit the checks on the Lens side for
old/saved\r\nvisualizations with unsupported operations for the
`counter` field type,\r\nwhile preserving those checks for newer
visualizations.\r\n\r\nDashboards with \"meaningless\" operations will
now show a warning\r\nmessage:\r\n<img width=\"556\" alt=\"Screenshot
2023-08-09 at 18 31
21\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/7c8f3739-4957-4d1d-8aaa-e9457b8a4426\">\r\n\r\nWhen
in editor the warning is shown at the top-right corner as well:\r\n<img
width=\"845\" alt=\"Screenshot 2023-08-09 at 18 30
31\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/c52a7823-d4b9-4efd-9c5d-ca654f3f03a0\">\r\n\r\nNew
visualizations still prevent the user from using the
unsupported\r\noperations:\r\n<img width=\"410\" alt=\"Screenshot
2023-08-09 at 18 30
55\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/d2364a01-0dc3-409a-9c0b-3e3a77cb2566\">\r\n<img
width=\"848\" alt=\"Screenshot 2023-08-09 at 18 31
48\"\r\nsrc=\"https://github.com/elastic/kibana/assets/924948/086a7360-6b1a-40a2-90d9-f4e8c7bf3f3a\">\r\n\r\nThere's
theoretically a last case where users in old SOs might create a\r\nnew
metric dimension trying to force to use a unsupported operation for\r\na
counter field: in this case the logic for a \"new\" visualization
will\r\nkick-in, clean the data in the workspace and show a full
error.\r\nCancelling such metric dimension will lead to the previous
\"relaxed\"\r\nstate.\r\n\r\nMessages are grouped by field and by top
referencing column (i.e. a\r\nformula): this means that if a formula
uses the same `counter` field\r\nwith two different dimensions (i.e.
`sum(counter_field) +\r\nmedian(counter_field)` as `myFormula`) will
show up as a single column\r\n(`myFormula`).\r\n\r\nThe wording of the
message mimics the same documentation copy provided\r\nin the ES
documentation.
Ref:\r\nhttps://github.com/elastic/elasticsearch/pull/97974\r\n\r\nTesting
SO:\r\n\r\n\r\n[export.ndjson.txt](https://github.com/elastic/kibana/files/12304924/export.ndjson.txt)\r\n\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[x]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"4c812e3b6d1a4e477768dae04047e79bbdc940ff"}}]}]
BACKPORT-->

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations auto-backport Automatically create backport pull requests when merged backport >non-issue :StorageEngine/TSDB You know, for Metrics v8.9.1 v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable all aggregations on counter fields
5 participants