Skip to content

cloud: add isInTrial helper function#239210

Merged
TattdCodeMonkey merged 7 commits intoelastic:mainfrom
TattdCodeMonkey:cloud-in-trial-func
Oct 29, 2025
Merged

cloud: add isInTrial helper function#239210
TattdCodeMonkey merged 7 commits intoelastic:mainfrom
TattdCodeMonkey:cloud-in-trial-func

Conversation

@TattdCodeMonkey
Copy link
Contributor

@TattdCodeMonkey TattdCodeMonkey commented Oct 15, 2025

Summary

Added the isInTrial helper function to the cloud plugin setup & start interfaces that allow checking if the deployment or serverless project are in trial based on either the trial_end_date or serverless.in_trial config values being set. Adding a function allows the date comparison to be handled by the cloud plugin and possibly updated in the future without consumers needing to know the details of how we verify if the cluster is within a trial cloud organization.

This is a follow-up to #232703 where I added the serverless.in_trial config value. In subsequent PRs it was discussed we should have a helper on the cloud function to give uniform way to access "in trial".

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@TattdCodeMonkey TattdCodeMonkey added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Oct 15, 2025
@TattdCodeMonkey TattdCodeMonkey requested review from a team as code owners October 15, 2025 17:30
@TattdCodeMonkey TattdCodeMonkey requested a review from a team as a code owner October 15, 2025 17:30
@TattdCodeMonkey
Copy link
Contributor Author

cc: @afharo & @jloleysens

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

ML changes LGTM

@TattdCodeMonkey TattdCodeMonkey requested a review from a team as a code owner October 16, 2025 18:17
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Oct 16, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@TattdCodeMonkey TattdCodeMonkey requested a review from a team as a code owner October 16, 2025 21:09
Copy link
Contributor

@jbudz jbudz left a comment

Choose a reason for hiding this comment

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

packages/kbn-optimizer/limits.yml LGTM

Copy link
Contributor

@jen-huang jen-huang left a comment

Choose a reason for hiding this comment

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

Fleet changes LGTM

@TattdCodeMonkey
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Approving to unblock progress. Thanks for cleaning this up @TattdCodeMonkey.

I'd like to get your thoughts about removing trialEndDate from the setup contract before merging!

});

it('should set the feedback button visibility to "false" for deployment in trial', async () => {
it('should set the feedback button visibility to "false" for deployment in trial via endDate', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
it('should set the feedback button visibility to "false" for deployment in trial via endDate', async () => {
it('should set the feedback button visibility to "false" for deployment in trial', async () => {

Seems like we're removing knowledge of "endDate"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, other plugins should just use the function and let the cloud plugin handle all the logic around endDate.


expect(setup.getInTrial()).toBe(false);
});
it('is `false` when `serverless.in_trial` & `trial_end_date` are not set', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens when both serverless.in_trial and trial_end_date are set? IMO we should throw and remove all serverless.in_trial test cases from this set of tests and scope those to the serverless:true config tests below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jloleysens serverless.in_trial will override any trial_end_date for the purpose of getInTrial.

I will remove all serverless.in_trial case from here.

I can add code to throw if both are set, but that makes me a little uneasy since both of these config values are set from other systems. I feel like it's more likely someone will break Kibana unwittingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove all serverless.in_trial test cases from this set of tests and scope those to the serverless:true config tests below.

The tests below are testing the start interface. These tests are testing setup. Technically we're exposing the same function, but I'd prefer to have the function tests for both contracts.

I will move the serverless.in_trial test cases into the is serverless enabled section.

cloudDefaultPort: decodedId?.defaultPort,
isCloudEnabled,
trialEndDate: this.config.trial_end_date ? new Date(this.config.trial_end_date) : undefined,
trialEndDate: this.trialEndDate,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this from the setup contract for now? Or does someone need the actual date?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, the actual date could be useful in the frontend if we wanted to show something like "5 days left in trial" which I've seen product interested in before.

But currently it is not used like that. So I'm fine removing it if we things thats the best option.

@jloleysens jloleysens added ci:project-deploy-elasticsearch Create an Elasticsearch Serverless project ci:project-deploy-observability Create an Observability project ci:project-deploy-security Create a Security Serverless Project labels Oct 24, 2025
@github-actions
Copy link
Contributor

🤖 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!)

@jloleysens
Copy link
Contributor

Oh, and can we test this on serverless before merging, I added the project deploy labels!

Added the getInTrial helper function to the cloud plugin setup & start
interfaces that allow checking if the deployment or serverless project
are in trial based on either the trial_end_date or serverless.in_trial
config values being set. Adding a function allows the date comparison to
be handled by the cloud plugin and possibly updated in the future
without consumers needing to know the details of how we verify if the
cluster is within a trial cloud organization.
@TattdCodeMonkey TattdCodeMonkey force-pushed the cloud-in-trial-func branch 2 times, most recently from 54419eb to 14b5783 Compare October 28, 2025 16:36
Worked on reducing page load bundle size for cloud, but still needed to
increase the limit slightly. While working on that change I also added
some extra code to handle if the configured `trial_end_date` does not
parse, which should never happen but is possible so I ultimately decided
to make sure it was handled and logged.
@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 28, 2025

⏳ Build in-progress

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #84 / Alerting builtin alertTypes es_query Query DSL only runs correctly: _source: false field for esQuery search type
  • [job] [logs] FTR Configs #61 / Serverless Observability - Deployment-agnostic API integration tests Observability Alerting Custom Threshold rule AVG - TICKS - FIRED "after all" hook in "AVG - TICKS - FIRED"
  • [job] [logs] FTR Configs #28 / Serverless Observability feature flag testing - Deployment-agnostic API integration tests SyntheticsAlertOnNoData "after all" hook for "should change the message if monitor goes from pending to down and recover the alert if monitor goes from pending to up"

History

@TattdCodeMonkey TattdCodeMonkey changed the title cloud: add getInTrial helper function cloud: add isInTrial helper function Oct 29, 2025
@TattdCodeMonkey TattdCodeMonkey merged commit 7a9460f into elastic:main Oct 29, 2025
13 checks passed
sbelastic pushed a commit to sbelastic/kibana that referenced this pull request Oct 30, 2025
## Summary

Added the isInTrial helper function to the cloud plugin setup & start
interfaces that allow checking if the deployment or serverless project
are in trial based on either the trial_end_date or serverless.in_trial
config values being set. Adding a function allows the date comparison to
be handled by the cloud plugin and possibly updated in the future
without consumers needing to know the details of how we verify if the
cluster is within a trial cloud organization.

This is a follow-up to
[elastic#232703](elastic#232703) where I added
the `serverless.in_trial` config value. In subsequent PRs it was
discussed we should have a helper on the cloud function to give uniform
way to access "in trial".

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] ~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/src/platform/packages/shared/kbn-i18n/README.md)~
- [ ]
~[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
- [ ] ~If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- [ ] ~This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.~
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] ~The PR description includes the appropriate Release Notes
section, and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)~
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
ana-davydova pushed a commit to ana-davydova/kibana that referenced this pull request Nov 3, 2025
## Summary

Added the isInTrial helper function to the cloud plugin setup & start
interfaces that allow checking if the deployment or serverless project
are in trial based on either the trial_end_date or serverless.in_trial
config values being set. Adding a function allows the date comparison to
be handled by the cloud plugin and possibly updated in the future
without consumers needing to know the details of how we verify if the
cluster is within a trial cloud organization.

This is a follow-up to
[elastic#232703](elastic#232703) where I added
the `serverless.in_trial` config value. In subsequent PRs it was
discussed we should have a helper on the cloud function to give uniform
way to access "in trial".

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] ~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/src/platform/packages/shared/kbn-i18n/README.md)~
- [ ]
~[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
- [ ] ~If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- [ ] ~This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.~
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] ~The PR description includes the appropriate Release Notes
section, and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)~
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
albertoblaz pushed a commit to albertoblaz/kibana that referenced this pull request Nov 4, 2025
## Summary

Added the isInTrial helper function to the cloud plugin setup & start
interfaces that allow checking if the deployment or serverless project
are in trial based on either the trial_end_date or serverless.in_trial
config values being set. Adding a function allows the date comparison to
be handled by the cloud plugin and possibly updated in the future
without consumers needing to know the details of how we verify if the
cluster is within a trial cloud organization.

This is a follow-up to
[elastic#232703](elastic#232703) where I added
the `serverless.in_trial` config value. In subsequent PRs it was
discussed we should have a helper on the cloud function to give uniform
way to access "in trial".

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] ~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/src/platform/packages/shared/kbn-i18n/README.md)~
- [ ]
~[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
- [ ] ~If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- [ ] ~This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.~
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] ~The PR description includes the appropriate Release Notes
section, and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)~
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:project-deploy-elasticsearch Create an Elasticsearch Serverless project ci:project-deploy-observability Create an Observability project ci:project-deploy-security Create a Security Serverless Project release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team Team:Search v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants