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

[Perfomance] Track time range picker with onPageReady function #202889

Merged
merged 21 commits into from
Dec 13, 2024

Conversation

kpatticha
Copy link
Contributor

@kpatticha kpatticha commented Dec 4, 2024

Summary

closes https://github.com/elastic/observability-dev/issues/3377

Metrics

meta.query_range_secs - The duration of the selected time range in seconds.

meta.query_offset_secs - The offset from "now" to the 'rangeTo'/end' time picker value in seconds.


Extend the onPageReady function to support date ranges in the meta field. The function should compute the query range in seconds based on the provided time range and report it to telemetry as meta.query_range_secs.

If the rangeTo is different from 'now', calculate the offset.

  • A negative offset indicates that the rangeTo is in the past,
  • a positive offset means it is in the future,
  • and zero indicates that the rangeTo is exactly 'now'."

How to instrument

To report the selected time range, pass the rangeFrom and rangeTo .

Failing to pass the correct type will result in TS error.

Then, use this data when invoking onPageReady:

 onPageReady({
        meta: { rangeFrom, rangeTo },
 });

Analysis

Meta is flatten field. In order to aggregate the data it's necessary to create a run time field. You can add a field in the

  1. select data view (ebt-kibana-*-performance-metrics)
  2. Add a new field
  3. Type double
  4. Set value

query_range_secs

def meta = doc[“meta”].size();
if (meta > 0) {
    def range = doc[“meta.query_range_secs”].size();
    if (range > 0) {
        // Emit the value of ‘meta.target’
        emit(Double.parseDouble(doc[“meta.query_range_secs”].value));
    }
}

query_offset_secs


def meta = doc[“meta”].size();
if (meta > 0) {
    def offset = doc[“meta.query_offset_secs”].size();
    if (offset > 0) {
     
        emit(Double.parseDouble(doc[“meta.query_offset_secs”].value));
    }
}

Examples

Screenshot 2024-12-09 at 19 51 32 Screenshot 2024-12-09 at 19 56 08 Screenshot 2024-12-09 at 19 53 45 1

Notes

  • Instrumented only 2 solutions as an example (dataset and apm services)

TODO

"owner": ["@elastic/obs-ux-logs-team"],
"group": "platform",
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 couldn't use the package outside of observability so I updated the group in order to be reuse and extend it. Let me know if that's okay for you @elastic/obs-ux-logs-team

Copy link
Contributor

Choose a reason for hiding this comment

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

That was the plan in case the package is needed elsewhere so it's fine.

@kpatticha kpatticha marked this pull request as ready for review December 9, 2024 18:02
@kpatticha kpatticha requested review from a team as code owners December 9, 2024 18:02
@kpatticha kpatticha requested a review from yngrdyn December 9, 2024 18:05
@botelastic botelastic bot added ci:project-deploy-observability Create an Observability project Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team labels Dec 9, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

Copy link
Contributor

github-actions bot commented Dec 9, 2024

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@crespocarlos crespocarlos self-requested a review December 10, 2024 08:37
"owner": ["@elastic/obs-ux-logs-team"],
"group": "platform",
Copy link
Contributor

Choose a reason for hiding this comment

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

That was the plan in case the package is needed elsewhere so it's fine.

Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

LGTM from Core's POV.

cc @dmlemeshko and @thomasneirynck as these changes may be relevant to their efforts in Dashboard Performance.

Copy link
Contributor

@awahab07 awahab07 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks of implementing this.

@yngrdyn
Copy link
Contributor

yngrdyn commented Dec 13, 2024

This is awesome, thanks! 🚀

@kpatticha kpatticha enabled auto-merge (squash) December 13, 2024 10:53
@elasticmachine
Copy link
Contributor

elasticmachine commented Dec 13, 2024

💛 Build succeeded, but was flaky

  • Buildkite Build
  • Commit: 1038854
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-202889-103885447b35

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #18 / Severity form field selects the correct value when changed to reported by me

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/ebt-tools 28 29 +1
@kbn/timerange 8 14 +6
total +7

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 3.3MB 3.3MB +185.0B
datasetQuality 252.4KB 252.5KB +81.0B
total +266.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/ebt-tools 2 3 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 450.7KB 450.9KB +150.0B
kbnUiSharedDeps-srcJs 3.5MB 3.5MB +35.0B
total +185.0B
Unknown metric groups

API count

id before after diff
@kbn/ebt-tools 37 38 +1
@kbn/timerange 8 14 +6
total +7

History

@kpatticha kpatticha merged commit bd1c00f into elastic:main Dec 13, 2024
8 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/12316291530

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 202889

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Dec 16, 2024
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 202889 locally

@kpatticha
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kpatticha added a commit to kpatticha/kibana that referenced this pull request Dec 17, 2024
…stic#202889)

closes elastic/observability-dev#3377

in seconds.

'rangeTo'/end' time picker value in seconds.

____

Extend the `onPageReady` function to support date ranges in the meta
field. The function should compute the query range in seconds based on
the provided time range and report it to telemetry as
meta.query_range_secs.

If the `rangeTo` is different from 'now', calculate the offset.
- A negative offset indicates that the rangeTo is in the past,
- a positive offset means it is in the future,
- and zero indicates that the rangeTo is exactly 'now'."

To report the selected time range, pass the `rangeFrom` and `rangeTo` .
> Failing to pass the correct type will result in TS error.

Then, use this data when invoking onPageReady:
```
 onPageReady({
        meta: { rangeFrom, rangeTo },
 });
```

Meta is flatten field. In order to aggregate the data it's necessary to
create a run time field. You can add a field in the

1. select data view (`ebt-kibana-*-performance-metrics`)
2. Add a new field
3. Type double
4. Set value

`query_range_secs`
```
def meta = doc[“meta”].size();
if (meta > 0) {
    def range = doc[“meta.query_range_secs”].size();
    if (range > 0) {
        // Emit the value of ‘meta.target’
        emit(Double.parseDouble(doc[“meta.query_range_secs”].value));
    }
}

```

`query_offset_secs`
```

def meta = doc[“meta”].size();
if (meta > 0) {
    def offset = doc[“meta.query_offset_secs”].size();
    if (offset > 0) {

        emit(Double.parseDouble(doc[“meta.query_offset_secs”].value));
    }
}

```

<img width="1478" alt="Screenshot 2024-12-09 at 19 51 32"
src="https://github.com/user-attachments/assets/72f796e1-4f20-487f-b62a-b6a4aead9a4a">

<img width="1478" alt="Screenshot 2024-12-09 at 19 56 08"
src="https://github.com/user-attachments/assets/c278dc3b-e6f3-47ed-9c90-954d71b59161">

<img width="1478" alt="Screenshot 2024-12-09 at 19 53 45 1"
src="https://github.com/user-attachments/assets/ef42ecef-48cd-4396-9f5d-c971098d5219">

- Instrumented only 2 solutions as an example (dataset and apm services)

- [x] Update documentation -
elastic#204179
- [ ] Update dashboards (create a runtime field)
- [x] Track offset ( we need to know if the user selected now or now)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit bd1c00f)
kpatticha added a commit that referenced this pull request Dec 17, 2024
#202889) (#204564)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Perfomance] Track time range picker with `onPageReady` function
(#202889)](#202889)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT
[{"author":{"name":"Katerina","email":"aikaterini.patticha@elastic.co"},"sourceCommit":{"committedDate":"2024-12-13T13:11:44Z","message":"[Perfomance]
Track time range picker with `onPageReady` function (#202889)\n\n##
Summary\r\n\r\ncloses
https://github.com/elastic/observability-dev/issues/3377\r\n## Metrics
\r\n#### `meta.query_range_secs` - The duration of the selected time
range\r\nin seconds.\r\n#### `meta.query_offset_secs` - The offset from
\"now\" to the\r\n'rangeTo'/end' time picker value in
seconds.\r\n\r\n____\r\n\r\nExtend the `onPageReady` function to support
date ranges in the meta\r\nfield. The function should compute the query
range in seconds based on\r\nthe provided time range and report it to
telemetry as\r\nmeta.query_range_secs.\r\n\r\n\r\n\r\n\r\nIf the
`rangeTo` is different from 'now', calculate the offset. \r\n- A
negative offset indicates that the rangeTo is in the past, \r\n- a
positive offset means it is in the future, \r\n- and zero indicates that
the rangeTo is exactly 'now'.\" \r\n\r\n\r\n\r\n### How to
instrument\r\nTo report the selected time range, pass the `rangeFrom`
and `rangeTo` . \r\n> Failing to pass the correct type will result in TS
error.\r\n\r\n\r\nThen, use this data when invoking
onPageReady:\r\n```\r\n onPageReady({\r\n meta: { rangeFrom, rangeTo
},\r\n });\r\n```\r\n\r\n### Analysis \r\n\r\nMeta is flatten field. In
order to aggregate the data it's necessary to\r\ncreate a run time
field. You can add a field in the\r\n\r\n1. select data view
(`ebt-kibana-*-performance-metrics`) \r\n2. Add a new field\r\n3. Type
double\r\n4. Set value \r\n\r\n`query_range_secs`\r\n```\r\ndef meta =
doc[“meta”].size();\r\nif (meta > 0) {\r\n def range =
doc[“meta.query_range_secs”].size();\r\n if (range > 0) {\r\n // Emit
the value of ‘meta.target’\r\n
emit(Double.parseDouble(doc[“meta.query_range_secs”].value));\r\n
}\r\n}\r\n\r\n```\r\n\r\n`query_offset_secs` \r\n```\r\n\r\ndef meta =
doc[“meta”].size();\r\nif (meta > 0) {\r\n def offset =
doc[“meta.query_offset_secs”].size();\r\n if (offset > 0) {\r\n \r\n
emit(Double.parseDouble(doc[“meta.query_offset_secs”].value));\r\n
}\r\n}\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n###
Examples\r\n\r\n\r\n<img width=\"1478\" alt=\"Screenshot 2024-12-09 at
19 51
32\"\r\nsrc=\"https://github.com/user-attachments/assets/72f796e1-4f20-487f-b62a-b6a4aead9a4a\">\r\n\r\n<img
width=\"1478\" alt=\"Screenshot 2024-12-09 at 19 56
08\"\r\nsrc=\"https://github.com/user-attachments/assets/c278dc3b-e6f3-47ed-9c90-954d71b59161\">\r\n\r\n<img
width=\"1478\" alt=\"Screenshot 2024-12-09 at 19 53 45
1\"\r\nsrc=\"https://github.com/user-attachments/assets/ef42ecef-48cd-4396-9f5d-c971098d5219\">\r\n\r\n\r\n\r\n\r\n\r\n###
Notes\r\n- Instrumented only 2 solutions as an example (dataset and apm
services)\r\n\r\n### TODO\r\n- [x] Update documentation
-\r\nhttps://github.com//pull/204179\r\n- [ ] Update
dashboards (create a runtime field) \r\n- [x] Track offset ( we need to
know if the user selected now or
now)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bd1c00fd65848ff27a1bace14363c5ab326c491d","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services"],"number":202889,"url":"https://github.com/elastic/kibana/pull/202889","mergeCommit":{"message":"[Perfomance]
Track time range picker with `onPageReady` function (#202889)\n\n##
Summary\r\n\r\ncloses
https://github.com/elastic/observability-dev/issues/3377\r\n## Metrics
\r\n#### `meta.query_range_secs` - The duration of the selected time
range\r\nin seconds.\r\n#### `meta.query_offset_secs` - The offset from
\"now\" to the\r\n'rangeTo'/end' time picker value in
seconds.\r\n\r\n____\r\n\r\nExtend the `onPageReady` function to support
date ranges in the meta\r\nfield. The function should compute the query
range in seconds based on\r\nthe provided time range and report it to
telemetry as\r\nmeta.query_range_secs.\r\n\r\n\r\n\r\n\r\nIf the
`rangeTo` is different from 'now', calculate the offset. \r\n- A
negative offset indicates that the rangeTo is in the past, \r\n- a
positive offset means it is in the future, \r\n- and zero indicates that
the rangeTo is exactly 'now'.\" \r\n\r\n\r\n\r\n### How to
instrument\r\nTo report the selected time range, pass the `rangeFrom`
and `rangeTo` . \r\n> Failing to pass the correct type will result in TS
error.\r\n\r\n\r\nThen, use this data when invoking
onPageReady:\r\n```\r\n onPageReady({\r\n meta: { rangeFrom, rangeTo
},\r\n });\r\n```\r\n\r\n### Analysis \r\n\r\nMeta is flatten field. In
order to aggregate the data it's necessary to\r\ncreate a run time
field. You can add a field in the\r\n\r\n1. select data view
(`ebt-kibana-*-performance-metrics`) \r\n2. Add a new field\r\n3. Type
double\r\n4. Set value \r\n\r\n`query_range_secs`\r\n```\r\ndef meta =
doc[“meta”].size();\r\nif (meta > 0) {\r\n def range =
doc[“meta.query_range_secs”].size();\r\n if (range > 0) {\r\n // Emit
the value of ‘meta.target’\r\n
emit(Double.parseDouble(doc[“meta.query_range_secs”].value));\r\n
}\r\n}\r\n\r\n```\r\n\r\n`query_offset_secs` \r\n```\r\n\r\ndef meta =
doc[“meta”].size();\r\nif (meta > 0) {\r\n def offset =
doc[“meta.query_offset_secs”].size();\r\n if (offset > 0) {\r\n \r\n
emit(Double.parseDouble(doc[“meta.query_offset_secs”].value));\r\n
}\r\n}\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n###
Examples\r\n\r\n\r\n<img width=\"1478\" alt=\"Screenshot 2024-12-09 at
19 51
32\"\r\nsrc=\"https://github.com/user-attachments/assets/72f796e1-4f20-487f-b62a-b6a4aead9a4a\">\r\n\r\n<img
width=\"1478\" alt=\"Screenshot 2024-12-09 at 19 56
08\"\r\nsrc=\"https://github.com/user-attachments/assets/c278dc3b-e6f3-47ed-9c90-954d71b59161\">\r\n\r\n<img
width=\"1478\" alt=\"Screenshot 2024-12-09 at 19 53 45
1\"\r\nsrc=\"https://github.com/user-attachments/assets/ef42ecef-48cd-4396-9f5d-c971098d5219\">\r\n\r\n\r\n\r\n\r\n\r\n###
Notes\r\n- Instrumented only 2 solutions as an example (dataset and apm
services)\r\n\r\n### TODO\r\n- [x] Update documentation
-\r\nhttps://github.com//pull/204179\r\n- [ ] Update
dashboards (create a runtime field) \r\n- [x] Track offset ( we need to
know if the user selected now or
now)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bd1c00fd65848ff27a1bace14363c5ab326c491d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202889","number":202889,"mergeCommit":{"message":"[Perfomance]
Track time range picker with `onPageReady` function (#202889)\n\n##
Summary\r\n\r\ncloses
https://github.com/elastic/observability-dev/issues/3377\r\n## Metrics
\r\n#### `meta.query_range_secs` - The duration of the selected time
range\r\nin seconds.\r\n#### `meta.query_offset_secs` - The offset from
\"now\" to the\r\n'rangeTo'/end' time picker value in
seconds.\r\n\r\n____\r\n\r\nExtend the `onPageReady` function to support
date ranges in the meta\r\nfield. The function should compute the query
range in seconds based on\r\nthe provided time range and report it to
telemetry as\r\nmeta.query_range_secs.\r\n\r\n\r\n\r\n\r\nIf the
`rangeTo` is different from 'now', calculate the offset. \r\n- A
negative offset indicates that the rangeTo is in the past, \r\n- a
positive offset means it is in the future, \r\n- and zero indicates that
the rangeTo is exactly 'now'.\" \r\n\r\n\r\n\r\n### How to
instrument\r\nTo report the selected time range, pass the `rangeFrom`
and `rangeTo` . \r\n> Failing to pass the correct type will result in TS
error.\r\n\r\n\r\nThen, use this data when invoking
onPageReady:\r\n```\r\n onPageReady({\r\n meta: { rangeFrom, rangeTo
},\r\n });\r\n```\r\n\r\n### Analysis \r\n\r\nMeta is flatten field. In
order to aggregate the data it's necessary to\r\ncreate a run time
field. You can add a field in the\r\n\r\n1. select data view
(`ebt-kibana-*-performance-metrics`) \r\n2. Add a new field\r\n3. Type
double\r\n4. Set value \r\n\r\n`query_range_secs`\r\n```\r\ndef meta =
doc[“meta”].size();\r\nif (meta > 0) {\r\n def range =
doc[“meta.query_range_secs”].size();\r\n if (range > 0) {\r\n // Emit
the value of ‘meta.target’\r\n
emit(Double.parseDouble(doc[“meta.query_range_secs”].value));\r\n
}\r\n}\r\n\r\n```\r\n\r\n`query_offset_secs` \r\n```\r\n\r\ndef meta =
doc[“meta”].size();\r\nif (meta > 0) {\r\n def offset =
doc[“meta.query_offset_secs”].size();\r\n if (offset > 0) {\r\n \r\n
emit(Double.parseDouble(doc[“meta.query_offset_secs”].value));\r\n
}\r\n}\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n###
Examples\r\n\r\n\r\n<img width=\"1478\" alt=\"Screenshot 2024-12-09 at
19 51
32\"\r\nsrc=\"https://github.com/user-attachments/assets/72f796e1-4f20-487f-b62a-b6a4aead9a4a\">\r\n\r\n<img
width=\"1478\" alt=\"Screenshot 2024-12-09 at 19 56
08\"\r\nsrc=\"https://github.com/user-attachments/assets/c278dc3b-e6f3-47ed-9c90-954d71b59161\">\r\n\r\n<img
width=\"1478\" alt=\"Screenshot 2024-12-09 at 19 53 45
1\"\r\nsrc=\"https://github.com/user-attachments/assets/ef42ecef-48cd-4396-9f5d-c971098d5219\">\r\n\r\n\r\n\r\n\r\n\r\n###
Notes\r\n- Instrumented only 2 solutions as an example (dataset and apm
services)\r\n\r\n### TODO\r\n- [x] Update documentation
-\r\nhttps://github.com//pull/204179\r\n- [ ] Update
dashboards (create a runtime field) \r\n- [x] Track offset ( we need to
know if the user selected now or
now)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"bd1c00fd65848ff27a1bace14363c5ab326c491d"}}]}]
BACKPORT-->
@kibanamachine kibanamachine added v8.18.0 and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Dec 17, 2024
kpatticha added a commit that referenced this pull request Dec 18, 2024
## Summary
Related to this: #202889

Update the documentation with the recent changes
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 18, 2024
## Summary
Related to this: elastic#202889

Update the documentation with the recent changes

(cherry picked from commit 860d5b6)
JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this pull request Dec 19, 2024
## Summary
Related to this: elastic#202889

Update the documentation with the recent changes
benakansara pushed a commit to benakansara/kibana that referenced this pull request Jan 2, 2025
## Summary
Related to this: elastic#202889

Update the documentation with the recent changes
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Jan 13, 2025
…stic#202889)

## Summary

closes elastic/observability-dev#3377
## Metrics 
#### `meta.query_range_secs` - The duration of the selected time range
in seconds.
#### `meta.query_offset_secs` - The offset from "now" to the
'rangeTo'/end' time picker value in seconds.

____

Extend the `onPageReady` function to support date ranges in the meta
field. The function should compute the query range in seconds based on
the provided time range and report it to telemetry as
meta.query_range_secs.




If the `rangeTo` is different from 'now', calculate the offset. 
- A negative offset indicates that the rangeTo is in the past, 
- a positive offset means it is in the future, 
- and zero indicates that the rangeTo is exactly 'now'." 



### How to instrument
To report the selected time range, pass the `rangeFrom` and `rangeTo` . 
> Failing to pass the correct type will result in TS error.


Then, use this data when invoking onPageReady:
```
 onPageReady({
        meta: { rangeFrom, rangeTo },
 });
```

### Analysis 

Meta is flatten field. In order to aggregate the data it's necessary to
create a run time field. You can add a field in the

1. select data view (`ebt-kibana-*-performance-metrics`) 
2. Add a new field
3. Type double
4. Set value 

`query_range_secs`
```
def meta = doc[“meta”].size();
if (meta > 0) {
    def range = doc[“meta.query_range_secs”].size();
    if (range > 0) {
        // Emit the value of ‘meta.target’
        emit(Double.parseDouble(doc[“meta.query_range_secs”].value));
    }
}

```

`query_offset_secs` 
```

def meta = doc[“meta”].size();
if (meta > 0) {
    def offset = doc[“meta.query_offset_secs”].size();
    if (offset > 0) {
     
        emit(Double.parseDouble(doc[“meta.query_offset_secs”].value));
    }
}

```







### Examples


<img width="1478" alt="Screenshot 2024-12-09 at 19 51 32"
src="https://github.com/user-attachments/assets/72f796e1-4f20-487f-b62a-b6a4aead9a4a">

<img width="1478" alt="Screenshot 2024-12-09 at 19 56 08"
src="https://github.com/user-attachments/assets/c278dc3b-e6f3-47ed-9c90-954d71b59161">

<img width="1478" alt="Screenshot 2024-12-09 at 19 53 45 1"
src="https://github.com/user-attachments/assets/ef42ecef-48cd-4396-9f5d-c971098d5219">





### Notes
- Instrumented only 2 solutions as an example (dataset and apm services)

### TODO
- [x] Update documentation -
elastic#204179
- [ ] Update dashboards (create a runtime field) 
- [x] Track offset ( we need to know if the user selected now or now)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Jan 13, 2025
## Summary
Related to this: elastic#202889

Update the documentation with the recent changes
viduni94 pushed a commit to viduni94/kibana that referenced this pull request Jan 23, 2025
## Summary
Related to this: elastic#202889

Update the documentation with the recent changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants