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

Adjust SyntheticSourceLicenseService #116647

Merged

Conversation

martijnvg
Copy link
Member

@martijnvg martijnvg commented Nov 12, 2024

Allow gold and platinum license to use synthetic source for a limited time. If the start time of a license is before the cut off date, then gold and platinum licenses will not fallback to stored source if synthetic source is used.

Allow gold and platinum license to use synthetic source for a limited time.
If the start time of a license if before a cut off date, then gold and platinum licenses will not fallback to stored source if synthetic source is used.
@salvatore-campagna
Copy link
Contributor

Do we also need to test for a customer switching license?

@n1v0lg n1v0lg self-requested a review November 21, 2024 14:28
Copy link
Contributor

@n1v0lg n1v0lg left a comment

Choose a reason for hiding this comment

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

Made a first pass and this is looking great. I left a few suggestions -- as discussed on Slack, it'd be great to convert the new IT case to use more realistic licensing primitives by extending AbstractLicensesIntegrationTestCase

I'll make another pass over the PR once that's ready.

private static final String CUTOFF_DATE_SYS_PROP_NAME = "es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date";
private static final Logger LOGGER = LogManager.getLogger(SyntheticSourceLicenseService.class);
static final long DEFAULT_CUTOFF_DATE = LocalDateTime.of(2024, 12, 12, 0, 0).toInstant(ZoneOffset.UTC).toEpochMilli();
private static final long MAX_CUTOFF_DATE = LocalDateTime.of(2026, 12, 12, 0, 0).toInstant(ZoneOffset.UTC).toEpochMilli();
Copy link
Contributor

@n1v0lg n1v0lg Nov 21, 2024

Choose a reason for hiding this comment

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

Unless this is already confirmed, lets validate with product that this is the max cut off we want -- I don't have a very good sense for that this value should be, personally.

@martijnvg
Copy link
Member Author

Do we also need to test for a customer switching license?

@salvatore-campagna No, I don't think we need to test switching to gold/platinum license. We already have this test coverage by testing going from basic to enterprise and the other way around.

}
// To allow the following patterns: metrics-apm.transaction.*, metrics-apm.service_transaction.*, metrics-apm.service_summary.*,
// metrics-apm.service_destination.*, "metrics-apm.internal-* and metrics-apm.app.*
if (dataStreamName != null && dataStreamName.startsWith("metrics-apm.")) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@felixbarny Double checking, is the pattern sufficient in selecting the apm data streams that currently use synthetic source? Synthetic source will require an enterprise license from 8.17.0, but for apm's synthetic source usage we will allow gold/platinum license for a little longer.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the pattern looks good. For reference, all the APM templates are in Elasticsearch: https://github.com/elastic/elasticsearch/tree/main/x-pack/plugin/apm-data/src/main/resources/index-templates

@martijnvg martijnvg added the auto-backport Automatically create backport pull requests when merged label Nov 25, 2024
putLicense(createGoldOrPlatinumLicense(startPastCutoff));
ensureGreen();

createIndexWithSyntheticSourceAndAssertExpectedType(".profiling-stacktraces", "STORED");
Copy link
Contributor

Choose a reason for hiding this comment

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

We should test with synthetic?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, this method creates an index with source mode set to synthetic. The last argument here is what the expected source mode should be.

String indexName = DataStream.getDefaultBackingIndexName(dataStreamName, 0);
var result = provider.getAdditionalIndexSettings(indexName, dataStreamName, IndexMode.TIME_SERIES, null, null, settings, List.of());
assertThat(result.size(), equalTo(0));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Add tests with license at a later date?

return createGoldOrPlatinumLicense(start);
}

static License createGoldOrPlatinumLicense(long start) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: remove this, pass the license string to the function above to deduplicate. Consider adding a boolean "isBeforeCutoff" to avoid passing dates.

Copy link
Contributor

@kkrik-es kkrik-es left a comment

Choose a reason for hiding this comment

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

Some comments, ptal.

@martijnvg martijnvg enabled auto-merge (squash) November 26, 2024 06:58
@martijnvg martijnvg merged commit ed33bea into elastic:main Nov 26, 2024
15 of 16 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.17 Commit could not be cherrypicked due to conflicts
8.x Commit could not be cherrypicked due to conflicts

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

martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 26, 2024
Allow gold and platinum license to use synthetic source for a limited time. If the start time of a license is before the cut off date, then gold and platinum licenses will not fallback to stored source if synthetic source is used.

Co-authored-by: Nikolaj Volgushev <[email protected]>
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 26, 2024
Allow gold and platinum license to use synthetic source for a limited time. If the start time of a license is before the cut off date, then gold and platinum licenses will not fallback to stored source if synthetic source is used.

Co-authored-by: Nikolaj Volgushev <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Nov 26, 2024
Allow gold and platinum license to use synthetic source for a limited time. If the start time of a license is before the cut off date, then gold and platinum licenses will not fallback to stored source if synthetic source is used.

Co-authored-by: Nikolaj Volgushev <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Nov 26, 2024
* Adjust SyntheticSourceLicenseService (#116647)

Allow gold and platinum license to use synthetic source for a limited time. If the start time of a license is before the cut off date, then gold and platinum licenses will not fallback to stored source if synthetic source is used.

Co-authored-by: Nikolaj Volgushev <[email protected]>

* spotless

---------

Co-authored-by: Nikolaj Volgushev <[email protected]>
martijnvg added a commit that referenced this pull request Nov 27, 2024
Indicates whether es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date_restricted_override system property has been configured.

A follow up from #116647
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 27, 2024
Indicates whether es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date_restricted_override system property has been configured.

A follow up from elastic#116647
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 27, 2024
Allow gold and platinum license to use synthetic source for a limited time. If the start time of a license is before the cut off date, then gold and platinum licenses will not fallback to stored source if synthetic source is used.

Co-authored-by: Nikolaj Volgushev <[email protected]>
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 27, 2024
Indicates whether es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date_restricted_override system property has been configured.

A follow up from elastic#116647
elasticsearchmachine pushed a commit that referenced this pull request Nov 27, 2024
Indicates whether es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date_restricted_override system property has been configured.

A follow up from #116647
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 27, 2024
Indicates whether es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date_restricted_override system property has been configured.

A follow up from elastic#116647
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 27, 2024
Indicates whether es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date_restricted_override system property has been configured.

A follow up from elastic#116647
elasticsearchmachine pushed a commit that referenced this pull request Nov 27, 2024
Indicates whether es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date_restricted_override system property has been configured.

A follow up from #116647
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this pull request Nov 27, 2024
Indicates whether es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date_restricted_override system property has been configured.

A follow up from elastic#116647
alexey-ivanov-es pushed a commit to alexey-ivanov-es/elasticsearch that referenced this pull request Nov 28, 2024
Allow gold and platinum license to use synthetic source for a limited time. If the start time of a license is before the cut off date, then gold and platinum licenses will not fallback to stored source if synthetic source is used.

Co-authored-by: Nikolaj Volgushev <[email protected]>
alexey-ivanov-es pushed a commit to alexey-ivanov-es/elasticsearch that referenced this pull request Nov 28, 2024
Indicates whether es.mapping.synthetic_source_fallback_to_stored_source.cutoff_date_restricted_override system property has been configured.

A follow up from elastic#116647
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged backport pending >non-issue :StorageEngine/Mapping The storage related side of mappings Team:StorageEngine v8.17.0 v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants