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

Add support for sourcemap uploads #302

Merged
merged 5 commits into from
Nov 28, 2017
Merged

Conversation

jalvz
Copy link
Contributor

@jalvz jalvz commented Nov 14, 2017

No description provided.

@jalvz jalvz self-assigned this Nov 14, 2017
@jalvz jalvz force-pushed the sourcemap-upload branch 6 times, most recently from e85b55c to 4d6ccc4 Compare November 17, 2017 15:26
@jalvz jalvz added review and removed in progress labels Nov 17, 2017
@jalvz
Copy link
Contributor Author

jalvz commented Nov 17, 2017

@roncohen this is ready for review!

@roncohen
Copy link
Contributor

roncohen commented Nov 20, 2017

Nice @jalvz!

A couple comments:

  • We discussed this briefly earlier, but how would you feel about letting the sourcemap library handle validation of the uploaded sourcemap instead of doing it in JSON Schema? We can still use JSON Schema to validate the other fields (app_name, app_version), but just let the sourcemap itself be validated as a string and then make the sourcemap validator validate by passing the sourcemap to the library. There might be other things than just the JSON structure that it needs to validate and we can't validate those with JSON Schema anyway. Just an idea. EDIT: I think the overhead of the library parsing the sourcemap again is OK.

  • Did you check how the sourcemap is stored in ES? We need to make sure it's not being indexed.

  • TestProcessSourcemapNullValues.approved.json and TestProcessSourcemapMinimalPayload.approved.json look the same to me. Do you know what the difference is? Maybe we can skip some of those tests?

  • Error messages given by the JSON validation for sourcemaps will refer to field names that are unknown to the user (app.name vs app-name, bundle-filepath vs. bundle_filepath etc.). We have to align the map we create here so it has the same names as what the users puts in, so that the error messages refer to the same fields.

@jalvz
Copy link
Contributor Author

jalvz commented Nov 21, 2017

re. handling validation with parsing library:
not sure what you have in mind, like this c319f55?

re. approved files: they look the same because tests ensure that passing attributes with null values is equivalent to not passing attributes.

@jalvz
Copy link
Contributor Author

jalvz commented Nov 22, 2017

4th point above implemented here d4ab32d

@@ -36,6 +37,7 @@ const (
BackendErrorsURL = "/v1/errors"
FrontendErrorsURL = "/v1/client-side/errors"
HealthCheckURL = "/healthcheck"
SourcemapsURL = "/sourcemaps"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not versioned. It might be fine, but could you explain the rationale briefly?

_meta/beat.yml Outdated
@@ -7,7 +7,7 @@ apm-server:
# Defines the host and port the server is listening on
host: "localhost:8200"

frontend.enabled: false
frontend.enabled: true
Copy link
Contributor

@roncohen roncohen Nov 23, 2017

Choose a reason for hiding this comment

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

I think this would enable frontend endpoints by default. I suggest we keep it off by default for now and reevaluate once we have sourcemap processing of errors in.

type: keyword
description: >
App version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Tiny thing: Could we put the sourcemap field in here so it shows up in the docs but it will still not get indexed?

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 don't know. How do you do that? I can't find anywhere else where we do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

No that's not possible, see #28

Copy link
Contributor

Choose a reason for hiding this comment

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

right 👍

@roncohen
Copy link
Contributor

Good work @jalvz! Getting close 👍

Copy link
Contributor

@simitt simitt left a comment

Choose a reason for hiding this comment

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

Can you please add a changelog entry.
Otherwise LGTM

@roncohen
Copy link
Contributor

Cool @jalvz. Could you squash?

@jalvz
Copy link
Contributor Author

jalvz commented Nov 27, 2017

done. i wouldnt like to squash more than this, but if you are not happy with it feel free to squash and merge yourself.

@@ -28,7 +28,7 @@ func generate() error {

for path, mapping := range beater.Routes {

if path == beater.HealthCheckURL {
if path == beater.HealthCheckURL || path == beater.SourcemapsURL {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there still a reason for skipping sourcemaps here?

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about adding sourcemaps to a docs/generated/sourcemaps folder, and not to the intake-api ? So we would have it documented but clearly distinguished from standard intake API.
I suggest to merge this and add the doc script in a seperate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, updated

Juan A added 5 commits November 28, 2017 14:12
Refactor based on suggestions from @roncohen

* Move sourcemap decoding to the sourcemap package
* Change the way to build the payload
* Make the decoder return a buffer
…essage as it is input'ed by the user, as per @roncohen code review.

This requires to flatten the app attributes, so they are no longer reusable. This reverts commit b7174c2.

generate ES output for sourcemap
@simitt simitt merged commit e0d7999 into elastic:master Nov 28, 2017
@roncohen
Copy link
Contributor

awesome! Great work @jalvz !

@jalvz jalvz deleted the sourcemap-upload branch February 1, 2018 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants