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

Setting to disable x-opaque-id in logs throttling #78911

Merged

Conversation

pgomulka
Copy link
Contributor

@pgomulka pgomulka commented Oct 11, 2021

Introduces a setting cluster.deprecation_indexing.x_opaque_id_used.enabled to disable use of
x-opaque-id in RateLimitingFilter. This will be used for deprecation
logs indexing and will not affect logging to files (it uses different
instance of RateLimitingFilter with this flag enabled by default)

Changes the indices backing a deprecation log data stream to be hidden.

Refactors DeprecationHttpIT to be more reliable

relates #76292
closes #77936

  • Have you signed the contributor license agreement?
  • Have you followed the contributor guidelines?
  • If submitting code, have you built your formula locally prior to submission with gradle check?
  • If submitting code, is your pull request against master? Unless there is a good reason otherwise, we prefer pull requests against master and will backport as needed.
  • If submitting code, have you checked that your submission is for an OS and architecture that we support?
  • If you are submitting this code for a class then read our policy for that.

Introduces a setting
cluster.deprecation_indexing.x_opaque_id_used.enabled to disable use of
x-opaque-id in RateLimitingFilter. This will be used for deprecation
logs indexing and will not affect logging to files (it uses different
instance of RateLimitingFilter with this flag enabled by default)

Changes the indices backing a deprecation log data stream to be hidden.

Refactors DeprecationHttpIT to be more reliable

relates elastic#76292
closes elastic#77936
@pgomulka pgomulka added :Core/Infra/Logging Log management and logging utilities v8.0.0 v7.16.0 labels Oct 11, 2021
@pgomulka pgomulka self-assigned this Oct 11, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Oct 11, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@pgomulka
Copy link
Contributor Author

I split this PR from the main PR that was meant to enable deprecation logs indexing by default.
This will help to make the PR more cohesive and easier to review. Also easier to identify the what is causing tests to fail.
#78319

This applies to both indexed deprecation logs and logs emitted to log files.
You can disable the use of `x-opaque-id` in throttling by changing
`cluster.deprecation_indexing.x_opaque_id_used.enabled` to false
See link:./server/src/main/java/org/elasticsearch/common/logging/RateLimitingFilter.java[RateLimitingFilter]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we should be linked to the source code. It implies we can't or don't want to explain what's going on. cc @jrodewig for his input.

Also, can we link x-opaque-id to something descriptive?

Copy link
Contributor Author

@pgomulka pgomulka Oct 11, 2021

Choose a reason for hiding this comment

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

I thought I will link to a javadoc for more low level internals documentation.

@@ -28,9 +28,20 @@
import static org.elasticsearch.common.logging.DeprecatedMessage.KEY_FIELD_NAME;
import static org.elasticsearch.common.logging.DeprecatedMessage.X_OPAQUE_ID_FIELD_NAME;

/**
* A log4j filter used for throttling deprecation logs. Should be used in pair with a log4j2 appender.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to explain log4j here. You could link to https://logging.apache.org/log4j/2.x/manual/filters.html if you want to provide a reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do. I thought to comment about log4j so that someone won't bother trying to reuse this in some other context

@@ -2,6 +2,7 @@
"template": {
"settings": {
"index": {
"hidden" : true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this change is related?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not necessarily related, not even covered in testing here (index backing data stream is implementation detail)
do you recon we should do this in a separate PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't suppose it matters either way, we can leave this in.

final DeprecationIndexingComponent component = new DeprecationIndexingComponent(client,
environment.settings(),
rateLimitingFilterForIndexing,
WRITE_DEPRECATION_LOGS_TO_INDEX.getDefault(environment.settings())// default is true, enable on start.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment is wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, will fix. I will leave the code for passing of the default value though.
I want to have the PR that will switch the default to true as small as possible. (previous problems with tests failing due this value being enabled on startup in CI)

pgomulka and others added 2 commits October 11, 2021 15:19
…asticsearch/xpack/deprecation/DeprecationHttpIT.java

Co-authored-by: Rory Hunter <pugnascotia@users.noreply.github.com>
@pgomulka
Copy link
Contributor Author

@elasticmachine update branch

@pgomulka
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/part-2

@pgomulka pgomulka merged commit f5e4228 into elastic:master Oct 12, 2021
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Oct 12, 2021
)

Introduces a setting cluster.deprecation_indexing.x_opaque_id_used.enabled to disable use of
x-opaque-id in RateLimitingFilter. This will be used for deprecation
logs indexing and will not affect logging to files (it uses different
instance of RateLimitingFilter with this flag enabled by default)

Changes the indices backing a deprecation log data stream to be hidden.

Refactors DeprecationHttpIT to be more reliable

relates elastic#76292
closes elastic#77936
pgomulka added a commit that referenced this pull request Oct 12, 2021
…78982)

Introduces a setting cluster.deprecation_indexing.x_opaque_id_used.enabled to disable use of
x-opaque-id in RateLimitingFilter. This will be used for deprecation
logs indexing and will not affect logging to files (it uses different
instance of RateLimitingFilter with this flag enabled by default)

Changes the indices backing a deprecation log data stream to be hidden.

Refactors DeprecationHttpIT to be more reliable

relates #76292
closes #77936

backport #78911
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Logging Log management and logging utilities >non-issue Team:Core/Infra Meta label for core/infra team v7.16.0 v8.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document "cluster.deprecation_indexing.enabled"
5 participants