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

Ilm alias #3826

Merged
merged 9 commits into from
May 29, 2020
Merged

Ilm alias #3826

merged 9 commits into from
May 29, 2020

Conversation

simitt
Copy link
Contributor

@simitt simitt commented May 27, 2020

Motivation/summary

With this PR we allow users to customize the ILM rollover_alias for every event type.
It also improves the ILM specific config handling and separates code for unmanaged indices into a dedicated package for easier distinction between setup for ILM and unmanaged (old) indices.

Docs Update

Users need to be aware that whenever they switch to a different prefix than apm-version* they also need to modify setup.template.name and setup.template.pattern as otherwise the generic index template will not match the event indices. This is similar to what's already true when users configure output.elasticsearch.indices.
@bmorelli25 I'd appreciate your eyes on the docs changes I made.

Checklist

-[ ] I have signed the Contributor License Agreement.

I have considered changes for:

How to test these changes

Configure different settings for apm-server.ilm.setup.mapping and check that event aliases, policies, indices and templates get set up accordingly. The event specific templates must match against the customized indices and reference the aliases correctly.

Related issues

#3779

* rename default to unmanaged indices
* move index selector config to ilm and unmanaged packages
* ilm: replace variable index part when loading config
* ensure index and template names are correctly resolved
@simitt simitt requested a review from a team May 27, 2020 16:03
@codecov-commenter
Copy link

codecov-commenter commented May 27, 2020

Codecov Report

Merging #3826 into master will decrease coverage by 0.27%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3826      +/-   ##
==========================================
- Coverage   79.92%   79.64%   -0.28%     
==========================================
  Files         137      135       -2     
  Lines        6166     6142      -24     
==========================================
- Hits         4928     4892      -36     
- Misses       1238     1250      +12     
Impacted Files Coverage Δ
idxmgmt/ilm/supporter_factory.go 83.33% <0.00%> (-4.91%) ⬇️
idxmgmt/manager.go 80.32% <0.00%> (-4.10%) ⬇️
idxmgmt/supporter.go 85.57% <0.00%> (ø)
idxmgmt/supporter_factory.go 69.23% <0.00%> (ø)
idxmgmt/ilm/policy.go
idxmgmt/indices.go
idxmgmt/ilm/config.go 80.31% <0.00%> (+2.05%) ⬆️

@apmmachine
Copy link
Contributor

apmmachine commented May 27, 2020

❕ Build Aborted

There is a new build on-going so the previous on-going builds have been aborted.

Pipeline View Test View Changes Artifacts

Expand to view the summary

Build stats

  • Build Cause: [Pull request #3826 updated]

  • Reason: Aborted from #5

  • Start Time: 2020-05-28T09:03:58.771+0000

  • Duration: 7 min 49 sec

  • Commit: 8b36b4e

Log output

Expand to view the last 100 lines of log output

[2020-05-28T09:09:04.058Z] go: finding github.com/Masterminds/semver v1.4.2
[2020-05-28T09:09:04.058Z] go: finding github.com/urso/diag v0.0.0-20200210123136-21b3cc8eb797
[2020-05-28T09:09:04.058Z] go: finding github.com/urso/diag-ecs v0.0.0-20200210114345-ab085841dcb9
[2020-05-28T09:09:04.058Z] go: finding github.com/urso/sderr v0.0.0-20200210124243-c2a16f3d43ec
[2020-05-28T09:10:25.657Z] exec: git update-index -q --refresh
[2020-05-28T09:10:25.658Z] exec: git diff-index HEAD -- .
[2020-05-28T09:10:25.658Z] go build -o build/linux/golint golang.org/x/lint/golint
[2020-05-28T09:10:25.658Z] go: downloading golang.org/x/lint v0.0.0-20200302205851-738671d3881b
[2020-05-28T09:10:25.658Z] go: extracting golang.org/x/lint v0.0.0-20200302205851-738671d3881b
[2020-05-28T09:10:25.658Z] go: finding golang.org/x/lint v0.0.0-20200302205851-738671d3881b
[2020-05-28T09:10:25.658Z] go build -o build/linux/reviewdog github.com/reviewdog/reviewdog/cmd/reviewdog
[2020-05-28T09:10:25.658Z] go: downloading github.com/reviewdog/reviewdog v0.9.17
[2020-05-28T09:10:25.658Z] go: extracting github.com/reviewdog/reviewdog v0.9.17
[2020-05-28T09:10:25.658Z] go: downloading github.com/haya14busa/go-actions-toolkit v0.0.0-20200105081403-ca0307860f01
[2020-05-28T09:10:25.658Z] go: downloading github.com/xanzy/go-gitlab v0.22.3
[2020-05-28T09:10:25.658Z] go: downloading github.com/reviewdog/errorformat v0.0.0-20200109134752-8983be9bc7dd
[2020-05-28T09:10:25.658Z] go: downloading github.com/mattn/go-shellwords v1.0.7
[2020-05-28T09:10:25.658Z] go: downloading github.com/google/go-github/v29 v29.0.2
[2020-05-28T09:10:25.658Z] go: downloading cloud.google.com/go v0.51.0
[2020-05-28T09:10:25.658Z] go: downloading github.com/bradleyfalzon/ghinstallation v1.1.0
[2020-05-28T09:10:25.658Z] go: extracting github.com/bradleyfalzon/ghinstallation v1.1.0
[2020-05-28T09:10:25.658Z] go: extracting github.com/reviewdog/errorformat v0.0.0-20200109134752-8983be9bc7dd
[2020-05-28T09:10:25.658Z] go: downloading github.com/dgrijalva/jwt-go v3.2.1-0.20190620180102-5e25c22bd5d6+incompatible
[2020-05-28T09:10:25.658Z] go: downloading github.com/google/go-github/v28 v28.1.1
[2020-05-28T09:10:25.658Z] go: extracting github.com/dgrijalva/jwt-go v3.2.1-0.20190620180102-5e25c22bd5d6+incompatible
[2020-05-28T09:10:25.658Z] go: extracting github.com/haya14busa/go-actions-toolkit v0.0.0-20200105081403-ca0307860f01
[2020-05-28T09:10:25.658Z] go: extracting github.com/mattn/go-shellwords v1.0.7
[2020-05-28T09:10:25.658Z] go: extracting github.com/xanzy/go-gitlab v0.22.3
[2020-05-28T09:10:25.658Z] go: extracting github.com/google/go-github/v29 v29.0.2
[2020-05-28T09:10:25.658Z] go: extracting github.com/google/go-github/v28 v28.1.1
[2020-05-28T09:10:25.658Z] go: downloading github.com/google/go-querystring v1.0.0
[2020-05-28T09:10:25.658Z] go: extracting github.com/google/go-querystring v1.0.0
[2020-05-28T09:10:25.658Z] go: extracting cloud.google.com/go v0.51.0
[2020-05-28T09:10:25.658Z] go: downloading cloud.google.com/go/datastore v1.0.0
[2020-05-28T09:10:25.658Z] go: extracting cloud.google.com/go/datastore v1.0.0
[2020-05-28T09:10:25.658Z] go: downloading google.golang.org/api v0.15.0
[2020-05-28T09:10:25.658Z] go: downloading go.opencensus.io v0.22.2
[2020-05-28T09:10:25.658Z] go: downloading github.com/googleapis/gax-go/v2 v2.0.5
[2020-05-28T09:10:25.658Z] go: extracting github.com/googleapis/gax-go/v2 v2.0.5
[2020-05-28T09:10:25.658Z] go: extracting go.opencensus.io v0.22.2
[2020-05-28T09:10:25.658Z] go: downloading github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7
[2020-05-28T09:10:25.658Z] go: extracting github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7
[2020-05-28T09:10:25.919Z] go: extracting google.golang.org/api v0.15.0
[2020-05-28T09:10:26.874Z] go: finding github.com/reviewdog/reviewdog v0.9.17
[2020-05-28T09:10:26.874Z] go: finding github.com/mattn/go-shellwords v1.0.7
[2020-05-28T09:10:26.874Z] go: finding github.com/reviewdog/errorformat v0.0.0-20200109134752-8983be9bc7dd
[2020-05-28T09:10:26.874Z] go: finding github.com/google/go-github/v29 v29.0.2
[2020-05-28T09:10:26.874Z] go: finding github.com/haya14busa/go-actions-toolkit v0.0.0-20200105081403-ca0307860f01
[2020-05-28T09:10:26.874Z] go: finding github.com/xanzy/go-gitlab v0.22.3
[2020-05-28T09:10:26.874Z] go: finding github.com/google/go-querystring v1.0.0
[2020-05-28T09:10:26.874Z] go: finding github.com/bradleyfalzon/ghinstallation v1.1.0
[2020-05-28T09:10:26.874Z] go: finding cloud.google.com/go v0.51.0
[2020-05-28T09:10:26.874Z] go: finding cloud.google.com/go/datastore v1.0.0
[2020-05-28T09:10:26.874Z] go: finding github.com/dgrijalva/jwt-go v3.2.1-0.20190620180102-5e25c22bd5d6+incompatible
[2020-05-28T09:10:26.874Z] go: finding github.com/google/go-github/v28 v28.1.1
[2020-05-28T09:10:26.874Z] go: finding github.com/googleapis/gax-go/v2 v2.0.5
[2020-05-28T09:10:26.874Z] go: finding go.opencensus.io v0.22.2
[2020-05-28T09:10:26.874Z] go: finding google.golang.org/api v0.15.0
[2020-05-28T09:10:26.874Z] go: finding github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7
[2020-05-28T09:10:41.648Z] Sending interrupt signal to process
[2020-05-28T09:10:45.023Z] go/build: importGo github.com/elastic/apm-server/cmd: signal: terminated
[2020-05-28T09:10:45.023Z] 
[2020-05-28T09:10:45.023Z] 
[2020-05-28T09:10:45.023Z] Terminated
[2020-05-28T09:10:45.023Z] Terminated
[2020-05-28T09:10:45.023Z] ./script/jenkins/intake.sh: line 13:  2739 Terminated              make check-full
[2020-05-28T09:10:45.023Z] + cleanup
[2020-05-28T09:10:45.023Z] + rm -rf /tmp/tmp.ganM5akFgv
[2020-05-28T09:10:45.023Z] Terminated
[2020-05-28T09:10:45.033Z] script returned exit code 143
[2020-05-28T09:10:46.270Z] Stage "Build and Test" skipped due to earlier failure(s)
[2020-05-28T09:10:46.361Z] Stage "linux build" skipped due to earlier failure(s)
[2020-05-28T09:10:46.362Z] Stage "windows build-test" skipped due to earlier failure(s)
[2020-05-28T09:10:46.363Z] Stage "OSX build-test" skipped due to earlier failure(s)
[2020-05-28T09:10:46.364Z] Stage "Unit Test" skipped due to earlier failure(s)
[2020-05-28T09:10:46.365Z] Stage "System and Environment Tests" skipped due to earlier failure(s)
[2020-05-28T09:10:46.366Z] Stage "Benchmarking" skipped due to earlier failure(s)
[2020-05-28T09:10:46.366Z] Stage "Check kibana Obj. Updated" skipped due to earlier failure(s)
[2020-05-28T09:10:46.367Z] Stage "Hey-Apm" skipped due to earlier failure(s)
[2020-05-28T09:10:46.368Z] Stage "Package" skipped due to earlier failure(s)
[2020-05-28T09:10:46.369Z] Stage "APM Integration Tests" skipped due to earlier failure(s)
[2020-05-28T09:10:46.402Z] Stage "Package" skipped due to earlier failure(s)
[2020-05-28T09:10:46.553Z] Failed in branch linux build
[2020-05-28T09:10:46.555Z] Failed in branch windows build-test
[2020-05-28T09:10:46.556Z] Failed in branch OSX build-test
[2020-05-28T09:10:46.557Z] Failed in branch Unit Test
[2020-05-28T09:10:46.558Z] Failed in branch System and Environment Tests
[2020-05-28T09:10:46.558Z] Failed in branch Benchmarking
[2020-05-28T09:10:46.559Z] Failed in branch Check kibana Obj. Updated
[2020-05-28T09:10:46.560Z] Failed in branch Hey-Apm
[2020-05-28T09:10:46.560Z] Failed in branch APM Integration Tests
[2020-05-28T09:10:46.610Z] Stage "Package" skipped due to earlier failure(s)
[2020-05-28T09:10:46.679Z] Failed in branch Package
[2020-05-28T09:10:47.257Z] Running on Jenkins in /var/lib/jenkins/workspace/pm-server_apm-server-mbp_PR-3826@2
[2020-05-28T09:10:47.532Z] [INFO] getVaultSecret: Getting secrets
[2020-05-28T09:10:47.595Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-05-28T09:10:48.379Z] + chmod 755 generate-build-data.sh
[2020-05-28T09:10:48.379Z] + ./generate-build-data.sh https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-server/apm-server-mbp/PR-3826/ https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-server/apm-server-mbp/PR-3826/runs/4 ABORTED 409347
[2020-05-28T09:10:48.929Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-server/apm-server-mbp/PR-3826/runs/4/steps/?limit=10000 -o steps-info.json
[2020-05-28T09:10:49.180Z] INFO: curl https://apm-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/apm-server/apm-server-mbp/PR-3826/runs/4/tests/?status=FAILED -o tests-errors.json

Copy link
Member

@bmorelli25 bmorelli25 left a comment

Choose a reason for hiding this comment

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

Docs are looking good. A few more changes need to be made:

  • The ILM reference docs (docs/ilm-reference.asciidoc):
    • I think we should update the "Default configuration" section to include rollover_alias:
        mapping:
          - event_type: "error"
            policy_name: "apm-rollover-30-days"
            rollover_alias: "apm-%{[observer.version]}-error"
          - event_type: "span"
            policy_name: "apm-rollover-30-days"
            rollover_alias: "apm-%{[observer.version]}-span"
          - event_type: "transaction"
            policy_name: "apm-rollover-30-days"
            rollover_alias: "apm-%{[observer.version]}-transaction"
          - event_type: "metric"
            policy_name: "apm-rollover-30-days"
            rollover_alias: "apm-%{[observer.version]}-metric"
    
    • We also need to update the configuration reference entry for apm-server.ilm.setup.mapping at the bottom of the page. Something like this:
    [float]
    [[ilm-setup-mapping-config]]
    ===== `apm-server.ilm.setup.mapping`
    
    Maps each event type to a corresponding `policy_name` and `rollover_alias`.
    APM event types can only be `error`, `span`, `transaction`, and `metric`.
    If you attempt to map an index lifecycle policy to a different event type, APM Server will not start.
    If you only map a subset of APM event types, the default values will be used for omitted event types.  
    If a policy is defined, it must be mapped to an event type; if it isn't, it will not be sent to Elasticsearch.
    When customizing `rollover_alias`, it is strongly recommended to keep the prefix `apm-%{[observer.version]}` unchanged;
     if the prefix must be changed, `setup.template.name` and `setup.template.pattern` need to be changed accordingly,
    to match the created indices.
    

docs/ilm.asciidoc Outdated Show resolved Hide resolved
docs/ilm.asciidoc Outdated Show resolved Hide resolved
docs/ilm.asciidoc Outdated Show resolved Hide resolved
docs/ilm.asciidoc Show resolved Hide resolved
idxmgmt/ilm/config.go Outdated Show resolved Hide resolved
idxmgmt/ilm/config_test.go Outdated Show resolved Hide resolved
tests/system/test_setup_index_management.py Outdated Show resolved Hide resolved
idxmgmt/ilm/config.go Outdated Show resolved Hide resolved
* create common package with index defaults
* improve `assert_alias` in system tests
* minor test improvements
@apmmachine
Copy link
Contributor

apmmachine commented May 28, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Branch indexing]

  • Start Time: 2020-05-28T18:52:06.812+0000

  • Duration: 47 min 30 sec

Test stats 🧪

Test Results
Failed 0
Passed 3201
Skipped 146
Total 3347

@simitt simitt merged commit 4c7f516 into elastic:master May 29, 2020
@simitt simitt deleted the ilm-alias branch June 2, 2020 13:25
simitt added a commit to simitt/apm-server that referenced this pull request Jun 10, 2020
Change implementation to only allow configuring an
`apm-server.ilm.setup.mapping.*.index_suffix` rather than the whole
rollover alias.
This change intends to make the ILM setup less error prone and to make
the transition to the new index_templates and data streams easier.

Follow up on elastic#3826
simitt added a commit to simitt/apm-server that referenced this pull request Jun 18, 2020
Change how rollover aliases can be configured to only allow
customizingi a suffix.This change intends to make the ILM
setup less error prone and to make the transition to the
new index_templates and data streams easier.

Follow up on elastic#3826
simitt added a commit to simitt/apm-server that referenced this pull request Jun 18, 2020
Change how rollover aliases can be configured to only allow
customizingi a suffix.This change intends to make the ILM
setup less error prone and to make the transition to the
new index_templates and data streams easier.

Follow up on elastic#3826
closes elastic#3895
simitt added a commit to simitt/apm-server that referenced this pull request Jun 18, 2020
Change how rollover aliases can be configured to only allow
customizingi a suffix.This change intends to make the ILM
setup less error prone and to make the transition to the
new index_templates and data streams easier.

Follow up on elastic#3826
closes elastic#3895
simitt added a commit that referenced this pull request Jun 23, 2020
Change how rollover aliases can be configured to only allow
customizing a suffix. This change intends to make the ILM
setup less error prone and to make the transition to the
new index_templates and data streams easier.

Follow up on #3826
closes #3895

Co-authored-by: Brandon Morelli <[email protected]>
simitt added a commit to simitt/apm-server that referenced this pull request Jun 23, 2020
* Refactor ILM config loading and conditional index selection

* Make rollover_alias configurable and document it

closes elastic#3779
simitt added a commit that referenced this pull request Jun 23, 2020
* Refactor ILM config loading and conditional index selection

* Make rollover_alias configurable and document it

closes #3779
simitt added a commit to simitt/apm-server that referenced this pull request Jun 23, 2020
Change how rollover aliases can be configured to only allow
customizing a suffix. This change intends to make the ILM
setup less error prone and to make the transition to the
new index_templates and data streams easier.

Follow up on elastic#3826
closes elastic#3895

Co-authored-by: Brandon Morelli <[email protected]>
simitt added a commit that referenced this pull request Jun 23, 2020
Change how rollover aliases can be configured to only allow
customizing a suffix. This change intends to make the ILM
setup less error prone and to make the transition to the
new index_templates and data streams easier.

Follow up on #3826
closes #3895

Co-authored-by: Brandon Morelli <[email protected]>
@axw
Copy link
Member

axw commented Jul 21, 2020

Replaced by #3905, removing this from test plan

@axw axw removed the test-plan label Jul 21, 2020
simitt added a commit to simitt/apm-server that referenced this pull request Oct 27, 2020
When configuring `ilm.setup.require_policy:false` the customized policy name has been ignored. This fixes the issue
by ensuring the policy name is added to the ILM setup.
The regression was introduced with elastic#3826

fixes 4349
simitt added a commit that referenced this pull request Oct 27, 2020
When configuring `ilm.setup.require_policy:false` the customized policy name has been ignored. This fixes the issue
by ensuring the policy name is added to the ILM setup.
The regression was introduced with #3826

fixes 4349
simitt added a commit to simitt/apm-server that referenced this pull request Oct 27, 2020
When configuring `ilm.setup.require_policy:false` the customized policy name has been ignored. This fixes the issue
by ensuring the policy name is added to the ILM setup.
The regression was introduced with elastic#3826

fixes 4349
simitt added a commit to simitt/apm-server that referenced this pull request Oct 27, 2020
When configuring `ilm.setup.require_policy:false` the customized policy name has been ignored. This fixes the issue
by ensuring the policy name is added to the ILM setup.
The regression was introduced with elastic#3826

fixes 4349
simitt added a commit that referenced this pull request Oct 27, 2020
When configuring `ilm.setup.require_policy:false` the customized policy name has been ignored. This fixes the issue
by ensuring the policy name is added to the ILM setup.
The regression was introduced with #3826

fixes 4349
simitt added a commit that referenced this pull request Oct 27, 2020
When configuring `ilm.setup.require_policy:false` the customized policy name has been ignored. This fixes the issue
by ensuring the policy name is added to the ILM setup.
The regression was introduced with #3826

fixes 4349
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants