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

[APM] Make fleet optional again: Store source maps in APM index #146367

Closed
sorenlouv opened this issue Nov 28, 2022 · 2 comments · Fixed by #147208
Closed

[APM] Make fleet optional again: Store source maps in APM index #146367

sorenlouv opened this issue Nov 28, 2022 · 2 comments · Fixed by #147208
Labels
apm:fleet apm:release-feature APM UI - Release Feature Goal apm:test-plan-done Pull request that was successfully tested during the test plan Team:APM All issues that need APM UI Team support v8.7.0

Comments

@sorenlouv
Copy link
Member

sorenlouv commented Nov 28, 2022

Pitch: https://github.com/elastic/apm-dev/issues/852 (internal)

APM currently requires Fleet for powering several APM-specific features. To make Fleet optional we need to replicate those features.

Source maps

Source maps are currently stored as Fleet artifacts. In addition to this we should store source maps in an APM owned index that APM Server can query directly.

Privileges
The source map index should most likely be accessed using the internal kibana user. The reason for this is that we need to create an API token for APM Server with access to the index. We may also need to run the migrations in the background (with the system user)

The kibana system user may not have access to the source map index by default. Privileges for built in roles is defined her:

https://github.com/elastic/elasticsearch/blob/fb38095598953f1e5eb3ade7272f2c4e1064f7ed/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStore.java

Privilieges added to kibana_system in elastic/elasticsearch#92160.

Deprecate existing source map settings
There is a legacy setting xpack.apm.indices.sourcemap that is not longer used. This should be marked as deprecated (and later removed) to avoid confusion.

sourcemap: schema.string({ defaultValue: 'apm-*' }),

Index naming
Possible name for the index: .apm-source-map to align with other APM system indices:

// system indices, not configurable
apmAgentConfigurationIndex: '.apm-agent-configuration',
apmCustomLinkIndex: '.apm-custom-link',
};

@sorenlouv sorenlouv changed the title Make fleet optional: Store source maps in APM index Make fleet optional again: Store source maps in APM index Nov 28, 2022
@botelastic botelastic bot added the needs-team Issues missing a team label label Nov 28, 2022
@sorenlouv sorenlouv added the Team:APM All issues that need APM UI Team support label Nov 28, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:APM)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Nov 28, 2022
@sorenlouv sorenlouv added apm:release-feature APM UI - Release Feature Goal v8.7.0 apm:fleet labels Nov 28, 2022
@sorenlouv sorenlouv changed the title Make fleet optional again: Store source maps in APM index [APM] Make fleet optional again: Store source maps in APM index Nov 30, 2022
sorenlouv added a commit to elastic/elasticsearch that referenced this issue Dec 9, 2022
…92160)

In elastic/kibana#146367 Kibana will create a system index `.apm-source-map` at startup. All access to the index (creation, indexing, reading) will happen through the system user (`kibana_system`).  `kibana_system` already has access to `.apm-agent-configuration` and `.apm-custom-link`. Following this pattern the role should also be granted access to `.apm-source-map`.
@sorenlouv sorenlouv self-assigned this Dec 12, 2022
@sorenlouv sorenlouv removed their assignment Feb 27, 2023
@sorenlouv sorenlouv added the apm:test-plan-done Pull request that was successfully tested during the test plan label Feb 27, 2023
@sorenlouv
Copy link
Member Author

Upload source maps

for run in {1..1000}; do
  curl --request POST \
    --url https://deploy-kibana-mjgyh-custom.kb.us-west2.gcp.elastic-cloud.com/api/apm/sourcemaps \
    --header 'Authorization: ApiKey encodeApiKey' \
    --header 'Content-Type: multipart/form-data' \
    --header 'kbn-xsrf: true' \
    --form service_version=4.20.$run \
    --form service_name=opbeans-node \
    --form bundle_filepath=https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js \
    --form sourcemap=@/Users/sqren/Downloads/source-map-files/jquery.min.map
done

Verify source maps show up in new index:

GET .apm-source-map/_search

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:fleet apm:release-feature APM UI - Release Feature Goal apm:test-plan-done Pull request that was successfully tested during the test plan Team:APM All issues that need APM UI Team support v8.7.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants