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

Disable sourcemap upload endpoint when data streams enabled #4735

Merged
merged 2 commits into from
Feb 16, 2021

Conversation

jalvz
Copy link
Contributor

@jalvz jalvz commented Feb 16, 2021

Motivation/summary

If we don't do this, users will see a 202 - Accepted response, but apm-server will fail to index sourcemaps due to lack of permissions.

Checklist

How to test these changes

Run apm-server with data streams enabled and send a POST request to http://localhost:8200/assets/v1/sourcemaps.
The request should fail.

@jalvz jalvz requested a review from a team February 16, 2021 10:22
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Nice catch.

Just one thing with the error message. Generally I'd like to minimise cognitive overhead for users by tailoring the error message to the running configuration.

"If you are not using the RUM agent, you can safely ignore this error."
enabled := cfg.RumConfig.IsEnabled() && cfg.RumConfig.SourceMapping.IsEnabled()
"If you are not using the RUM agent, you can safely ignore this error. " +
"If you are running APM Server managed by Fleet, you need to upload Sourcemaps directly to Elasticsearch."
Copy link
Member

Choose a reason for hiding this comment

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

We know whether or not APM Server is managed by Fleet - can we change the error message based on that knowledge? Saves the user trying to figure out whether source maps are explicitly disabled, or implicitly because data streams are enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just being lazy... you got me

@apmmachine
Copy link
Contributor

apmmachine commented Feb 16, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #4735 updated

  • Start Time: 2021-02-16T11:03:20.760+0000

  • Duration: 55 min 25 sec

  • Commit: 5b837b5

Test stats 🧪

Test Results
Failed 0
Passed 4751
Skipped 124
Total 4875

Trends 🧪

Image of Build Times

Image of Tests

Steps errors 4

Expand to view the steps failures

Run Window tests
  • Took 11 min 41 sec . View more details on here
Compress
  • Took 0 min 0 sec . View more details on here
  • Description: tar --exclude=coverage-files.tgz -czf coverage-files.tgz coverage
Compress
  • Took 0 min 0 sec . View more details on here
  • Description: tar --exclude=system-tests-linux-files.tgz -czf system-tests-linux-files.tgz system-tests
Test Sync
  • Took 4 min 4 sec . View more details on here
  • Description: ./.ci/scripts/sync.sh

@jalvz jalvz requested a review from axw February 16, 2021 11:04
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

Thanks :)

@jalvz jalvz merged commit b2ea0fc into elastic:master Feb 16, 2021
axw pushed a commit to axw/apm-server that referenced this pull request Feb 20, 2021
axw pushed a commit to axw/apm-server that referenced this pull request Feb 20, 2021
axw added a commit that referenced this pull request Feb 20, 2021
…4849)

Co-authored-by: Juan Álvarez <juan.alvarez@elastic.co>
axw added a commit that referenced this pull request Feb 20, 2021
…4848)

Co-authored-by: Juan Álvarez <juan.alvarez@elastic.co>
v1v added a commit to v1v/apm-server that referenced this pull request Feb 22, 2021
…chemas-to-agents

* upstream/master: (111 commits)
  Introduce metricset.name (elastic#4857)
  processor/otel: test service.version handling (elastic#4853)
  docs: Add PHP agent information to shared docs (elastic#4740)
  Script for faster development workflow (elastic#4731)
  Update to elastic/beats@1b31c26 (elastic#4763)
  backport: add 7.12 to .backportrc.json (elastic#4807)
  backport: enable auto-merge on backport PRs (elastic#4777)
  Support for Node.js profiles (elastic#4728)
  docs: readds .NET link (elastic#4764)
  [DOCS] Fixes URLs on Secure communication with APM Agents page (elastic#4746)
  ci: set proper parameters for the tar step (elastic#4696)
  docs: add 7.11.1 release notes (elastic#4727)
  Disable sourcemap upload endpoint when data streams enabled (elastic#4735)
  Add service name to dataset field (elastic#4674)
  Update to elastic/beats@ba423212a660 (elastic#4733)
  sampling: require a default policy (elastic#4729)
  processor/otel: add unit test for span status (elastic#4734)
  Add support for consuming OTLP/gRPC metrics (elastic#4722)
  [apmpackage] Add config options supported in ESS (elastic#4690)
  Use the apm-server version everywhere* (elastic#4725)
  ...
v1v added a commit to v1v/apm-server that referenced this pull request Feb 22, 2021
…te-schema-json-1

* upstream/master: (111 commits)
  Introduce metricset.name (elastic#4857)
  processor/otel: test service.version handling (elastic#4853)
  docs: Add PHP agent information to shared docs (elastic#4740)
  Script for faster development workflow (elastic#4731)
  Update to elastic/beats@1b31c26 (elastic#4763)
  backport: add 7.12 to .backportrc.json (elastic#4807)
  backport: enable auto-merge on backport PRs (elastic#4777)
  Support for Node.js profiles (elastic#4728)
  docs: readds .NET link (elastic#4764)
  [DOCS] Fixes URLs on Secure communication with APM Agents page (elastic#4746)
  ci: set proper parameters for the tar step (elastic#4696)
  docs: add 7.11.1 release notes (elastic#4727)
  Disable sourcemap upload endpoint when data streams enabled (elastic#4735)
  Add service name to dataset field (elastic#4674)
  Update to elastic/beats@ba423212a660 (elastic#4733)
  sampling: require a default policy (elastic#4729)
  processor/otel: add unit test for span status (elastic#4734)
  Add support for consuming OTLP/gRPC metrics (elastic#4722)
  [apmpackage] Add config options supported in ESS (elastic#4690)
  Use the apm-server version everywhere* (elastic#4725)
  ...
@axw axw self-assigned this Feb 25, 2021
@axw
Copy link
Member

axw commented Feb 25, 2021

Confirmed with BC2:

$ curl http://localhost:8200/assets/v1/sourcemaps -F sourcemap=@app.e2e-bundle.min.js.map -F bundle_filepath=/index.js -F service_name=service_name -F service_version=123
{
  "error": "forbidden request: When APM Server is managed by Fleet, Sourcemaps must be uploaded directly to Elasticsearch."
}

@axw
Copy link
Member

axw commented Feb 25, 2021

Also confirmed that the old message is returned from a standalone APM Server when RUM is disabled:

{
  "error": "forbidden request: Sourcemap upload endpoint is disabled. Configure the `apm-server.rum` section in apm-server.yml to enable sourcemap uploads. If you are not using the RUM agent, you can safely ignore this error."
}

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.

3 participants