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

Refactor processors and move remaining models into "models". #1137

Merged
merged 6 commits into from
Jul 18, 2018

Conversation

roncohen
Copy link
Contributor

This moves error, transaction, sourcemap and metric models into directories in the "model" directory. It changes processors to be simple structs which can potentially override Decode/Validate (only sourcemaps overrides these). This removes a bunch of boilerplate from the processors. It will help move towards decoding and validating models individually, which is needed in the future for intake-v2.

I also got rid of the healthcheck processor, which is now a simple http.Handler.

There are still more we can do to separate models from processing, for example, counting (validation, transformations etc.) is spread between models and processor now, but I was unable to completely fix it in this PR. Subsequent PRs will address this.

@roncohen roncohen force-pushed the processor-refactor branch 2 times, most recently from 3369068 to 5b1f4aa Compare July 16, 2018 16:48
@roncohen roncohen mentioned this pull request Jul 17, 2018
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.

I appreciate the separate PR for this refactoring!

Since this is the first bit of the code restructure, have you thought about moving eg. the decoding part to the decoder package, the transformation part to a transformer package (probably not the best name), etc. I am not a huge fan of having logic within models, but rather use models as pure domain types that get handled by services or processors or what not.

@@ -15,30 +15,22 @@
// specific language governing permissions and limitations
// under the License.

package healthcheck
package processor
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be package error I guess

errorCounter = monitoring.NewInt(Metrics, "errors")
stacktraceCounter = monitoring.NewInt(Metrics, "stacktraces")
frameCounter = monitoring.NewInt(Metrics, "frames")
processorEntry = common.MapStr{"name": processorName, "event": errorDocType}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you move these counters to the event when they are used in the payload?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rifght. They'll be used in the event instead in the future, but I'll moved them back for now.


// its ok to ignore the outcome of this cast here because
// we assert everything below
payload, _ := payloadInterface.(*Payload)
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I'd say that this should even be a require.NoError, as if this conversion is not ok, the other checks don't make any sense and would just result in weird error messages.

assert.True(t, ok)
assert.IsType(t, &processor{}, p)
}
package metric
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this file good for?

@@ -15,20 +15,13 @@
// specific language governing permissions and limitations
// under the License.

Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the files get moved in a weird way, e.g. this one moves from processor/error/processor_test.go to model/payload.go. Could you maybe solve this by applying explicit git rm and git mv?

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 wasn't able to fix this easily unfortunately. It's possible to adjust the similarity index, but we also have some renames that are correctly detected as renames and changing the similarity index could jeopardize those. If you think it's important i can another stab at it


"github.com/elastic/apm-server/model"
"github.com/elastic/apm-server/validation"
"github.com/elastic/beats/libbeat/monitoring"
)

type NewProcessor func() Processor
Copy link
Contributor

Choose a reason for hiding this comment

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

not needed anymore


type PayloadDecoder func(map[string]interface{}) (model.Payload, error)

type PayloadProcessor struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I find this naming very confusing.
Now you have a Processor interface, that is implemented by one type PayloadProcessor. That actually returns a payload for the decoding part, instead of acting on a payload. Then the actual model.payload types again do some decoding and validation.
I suggest to avoid having a name Payload in the processor package.

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 can see why this would be confusing. It's partly due to the fact that it's been split out from the mega PR initially had.

I'll share my mental model to see if that helps:
"Processing" to me includes taking the raw data and validating it, decoding it into a go structure and eventually transformining it into an event (transformation happens by way of a method on the go struct, so it's not technically defined by the processor, but a separate refactor can change this if we want). In intake v1, the APM Server deals only with Payloads. For intake v2, we'll also have to deal with individual objects/models.

There's a general interface Processor today is only implemented by the PayloadProcessors. In the future we would have a ModelProcessor that would know how to take individual data pieces and validate, decode and transform them.

Let me know if it makes more sense in this context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for explaining. I think I am clear on the context. I still think that this is very confusing to call this PayloadProcessor as it doesn't operate on what is called a payload further on.
I'd rather call it something like ProcessorImpl than adding Payload.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We discussed offline and decided to keep as is for now given that subsequent PRs will address this.


var (
validateCount = monitoring.NewInt(sm.Metrics, "validation.count")
validateError = monitoring.NewInt(sm.Metrics, "validation.errors")
Copy link
Contributor

Choose a reason for hiding this comment

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

why instantiating the validationCount and validationError outside of the processor.PayloadProcessor?

@simitt
Copy link
Contributor

simitt commented Jul 17, 2018

@roncohen could you please also provide benchmark results? I don't expect any big changes, but we should rely on numbers for refactoring PRs.

@@ -36,11 +36,11 @@ import (
conf "github.com/elastic/apm-server/config"
"github.com/elastic/apm-server/decoder"
"github.com/elastic/apm-server/processor"
perr "github.com/elastic/apm-server/processor/error"
"github.com/elastic/apm-server/processor/healthcheck"
err "github.com/elastic/apm-server/processor/error"
Copy link
Member

Choose a reason for hiding this comment

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

this will end up shadowed a bunch, some other alias would be better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point

@roncohen roncohen force-pushed the processor-refactor branch from 6963569 to 13f1317 Compare July 17, 2018 15:21
@roncohen
Copy link
Contributor Author

benchmark results show there that are no difference in the number of allocations at all. The performance number for this PR looks better than master, but I suspect there's no real difference and that any difference in the benchmarks results stem from the computer idling a little more or a little less at any given time.

Benchmark details
benchmark                                                                              old ns/op     new ns/op     delta
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceValidate-4                     8422          8101          -3.81%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceDecode-4                       3788          3793          +0.13%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceTransform-4                    7361          7340          -0.29%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceProcessRequest-4               16318         16378         +0.37%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessValidate-4                     10393         10448         +0.53%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessDecode-4                       4277          4423          +3.41%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessTransform-4                    7747          7936          +2.44%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessProcessRequest-4               19483         20542         +5.44%
BenchmarkBackendProcessor/TestProcessErrorFullValidate-4                               62240         62598         +0.58%
BenchmarkBackendProcessor/TestProcessErrorFullDecode-4                                 15654         16423         +4.91%
BenchmarkBackendProcessor/TestProcessErrorFullTransform-4                              39192         39852         +1.68%
BenchmarkBackendProcessor/TestProcessErrorFullProcessRequest-4                         112946        114968        +1.79%
BenchmarkBackendProcessor/TestProcessErrorNullValuesValidate-4                         37541         38295         +2.01%
BenchmarkBackendProcessor/TestProcessErrorNullValuesDecode-4                           8254          7937          -3.84%
BenchmarkBackendProcessor/TestProcessErrorNullValuesTransform-4                        19331         19176         -0.80%
BenchmarkBackendProcessor/TestProcessErrorNullValuesProcessRequest-4                   64054         63170         -1.38%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPValidate-4                        8951          8617          -3.73%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPDecode-4                          5853          4164          -28.86%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPTransform-4                       8616          7964          -7.57%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPProcessRequest-4                  22934         18178         -20.74%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionValidate-4            5372          3749          -30.21%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionDecode-4              2966          2788          -6.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionTransform-4           7079          6376          -9.93%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionProcessRequest-4      12853         11789         -8.28%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogValidate-4                  7699          5798          -24.69%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogDecode-4                    3246          2696          -16.94%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogTransform-4                 7851          6450          -17.84%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogProcessRequest-4            19496         13401         -31.26%
BenchmarkFrontendProcessor/TestProcessErrorFrontendValidate-4                          28232         22405         -20.64%
BenchmarkFrontendProcessor/TestProcessErrorFrontendDecode-4                            9989          8926          -10.64%
BenchmarkFrontendProcessor/TestProcessErrorFrontendTransform-4                         832673        690101        -17.12%
BenchmarkFrontendProcessor/TestProcessErrorFrontendProcessRequest-4                    1029582       731704        -28.93%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapValidate-4                    25161         20880         -17.01%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapDecode-4                      7749          7411          -4.36%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapTransform-4                   555828        539060        -3.02%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapProcessRequest-4              591717        566949        -4.19%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapValidate-4              32354         31215         -3.52%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapDecode-4                10252         8695          -15.19%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapTransform-4             75796         70658         -6.78%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapProcessRequest-4        115295        111418        -3.36%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPValidate-4           8834          8119          -8.09%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPDecode-4             4573          4132          -9.64%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPTransform-4          7961          7033          -11.66%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPProcessRequest-4     17672         16424         -7.06%
BenchmarkProcessor/TestProcessMetricValidate-4                                         80466         77129         -4.15%
BenchmarkProcessor/TestProcessMetricDecode-4                                           10322         9132          -11.53%
BenchmarkProcessor/TestProcessMetricTransform-4                                        15199         13677         -10.01%
BenchmarkProcessor/TestProcessMetricProcessRequest-4                                   102735        101347        -1.35%
BenchmarkProcessor/TestProcessMetricMinimalValidate-4                                  16976         16101         -5.15%
BenchmarkProcessor/TestProcessMetricMinimalDecode-4                                    4754          4077          -14.24%
BenchmarkProcessor/TestProcessMetricMinimalTransform-4                                 4461          3832          -14.10%
BenchmarkProcessor/TestProcessMetricMinimalProcessRequest-4                            22441         21659         -3.48%
BenchmarkProcessor/TestProcessMetricMultipleSamplesValidate-4                          41663         38095         -8.56%
BenchmarkProcessor/TestProcessMetricMultipleSamplesDecode-4                            7998          7451          -6.84%
BenchmarkProcessor/TestProcessMetricMultipleSamplesTransform-4                         23402         19484         -16.74%
BenchmarkProcessor/TestProcessMetricMultipleSamplesProcessRequest-4                    79588         62665         -21.26%
BenchmarkProcessor/TestProcessMetricNullValidate-4                                     27701         24969         -9.86%
BenchmarkProcessor/TestProcessMetricNullDecode-4                                       5418          4855          -10.39%
BenchmarkProcessor/TestProcessMetricNullTransform-4                                    4997          4392          -12.11%
BenchmarkProcessor/TestProcessMetricNullProcessRequest-4                               34942         29590         -15.32%
BenchmarkBackendProcessor/TestProcessTransactionFullValidate-4                         115246        100464        -12.83%
BenchmarkBackendProcessor/TestProcessTransactionFullDecode-4                           19866         17098         -13.93%
BenchmarkBackendProcessor/TestProcessTransactionFullTransform-4                        49920         41893         -16.08%
BenchmarkBackendProcessor/TestProcessTransactionFullProcessRequest-4                   244533        152353        -37.70%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesValidate-4                   71966         53796         -25.25%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesDecode-4                     16439         11750         -28.52%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesTransform-4                  31357         26577         -15.24%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesProcessRequest-4             106171        92811         -12.58%
BenchmarkBackendProcessor/TestProcessSystemNullValidate-4                              11387         10414         -8.54%
BenchmarkBackendProcessor/TestProcessSystemNullDecode-4                                4058          4095          +0.91%
BenchmarkBackendProcessor/TestProcessSystemNullTransform-4                             8718          6188          -29.02%
BenchmarkBackendProcessor/TestProcessSystemNullProcessRequest-4                        20046         16422         -18.08%
BenchmarkBackendProcessor/TestProcessProcessNullValidate-4                             10897         8766          -19.56%
BenchmarkBackendProcessor/TestProcessProcessNullDecode-4                               4160          3774          -9.28%
BenchmarkBackendProcessor/TestProcessProcessNullTransform-4                            6771          6149          -9.19%
BenchmarkBackendProcessor/TestProcessProcessNullProcessRequest-4                       19271         16406         -14.87%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanValidate-4                  13598         11517         -15.30%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanDecode-4                    5748          4705          -18.15%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanTransform-4                 10394         8421          -18.98%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanProcessRequest-4            30108         23850         -20.79%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceValidate-4               10187         8647          -15.12%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceDecode-4                 4810          3756          -21.91%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceTransform-4              8311          6604          -20.54%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceProcessRequest-4         18834         16943         -10.04%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessValidate-4               11452         9958          -13.05%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessDecode-4                 4924          4248          -13.73%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessTransform-4              8008          7065          -11.78%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessProcessRequest-4         21622         18698         -13.52%
BenchmarkBackendProcessor/TestProcessTransactionEmptyValidate-4                        10087         9094          -9.84%
BenchmarkBackendProcessor/TestProcessTransactionEmptyDecode-4                          4136          3995          -3.41%
BenchmarkBackendProcessor/TestProcessTransactionEmptyTransform-4                       7558          6316          -16.43%
BenchmarkBackendProcessor/TestProcessTransactionEmptyProcessRequest-4                  21220         16642         -21.57%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPValidate-4                  9470          8481          -10.44%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPDecode-4                    4640          3931          -15.28%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPTransform-4                 7726          6417          -16.94%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPProcessRequest-4            18982         17574         -7.42%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadValidate-4               8668          6963          -19.67%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadDecode-4                 3499          2564          -26.72%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadTransform-4              7621          5972          -21.64%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadProcessRequest-4         17626         13681         -22.38%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendValidate-4                    16566         13935         -15.88%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendDecode-4                      6901          5595          -18.92%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendTransform-4                   20418         18147         -11.12%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendProcessRequest-4              45221         35125         -22.33%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeValidate-4              10160         8025          -21.01%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeDecode-4                3605          3164          -12.23%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeTransform-4             8231          7139          -13.27%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeProcessRequest-4        17610         16261         -7.66%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedValidate-4                   7976          7842          -1.68%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedDecode-4                     3205          3336          +4.09%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedTransform-4                  7166          7612          +6.22%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedProcessRequest-4             16409         15843         -3.45%

benchmark                                                                              old allocs     new allocs     delta
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceValidate-4                     8              8              +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceDecode-4                       10             10             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceTransform-4                    38             38             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceProcessRequest-4               56             56             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessValidate-4                     14             14             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessDecode-4                       12             12             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessTransform-4                    41             41             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessProcessRequest-4               67             67             +0.00%
BenchmarkBackendProcessor/TestProcessErrorFullValidate-4                               161            161            +0.00%
BenchmarkBackendProcessor/TestProcessErrorFullDecode-4                                 93             93             +0.00%
BenchmarkBackendProcessor/TestProcessErrorFullTransform-4                              207            207            +0.00%
BenchmarkBackendProcessor/TestProcessErrorFullProcessRequest-4                         461            461            +0.00%
BenchmarkBackendProcessor/TestProcessErrorNullValuesValidate-4                         93             93             +0.00%
BenchmarkBackendProcessor/TestProcessErrorNullValuesDecode-4                           22             22             +0.00%
BenchmarkBackendProcessor/TestProcessErrorNullValuesTransform-4                        87             87             +0.00%
BenchmarkBackendProcessor/TestProcessErrorNullValuesProcessRequest-4                   202            202            +0.00%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPValidate-4                        8              8              +0.00%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPDecode-4                          15             15             +0.00%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPTransform-4                       42             42             +0.00%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPProcessRequest-4                  65             65             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionValidate-4            0              0              +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionDecode-4              9              9              +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionTransform-4           36             36             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionProcessRequest-4      45             45             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogValidate-4                  8              8              +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogDecode-4                    9              9              +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogTransform-4                 36             36             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogProcessRequest-4            53             53             +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendValidate-4                          72             72             +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendDecode-4                            57             57             +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendTransform-4                         752            752            +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendProcessRequest-4                    881            881            +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapValidate-4                    61             61             +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapDecode-4                      44             44             +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapTransform-4                   714            714            +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapProcessRequest-4              819            819            +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapValidate-4              105            105            +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapDecode-4                56             56             +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapTransform-4             426            426            +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapProcessRequest-4        587            587            +0.00%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPValidate-4           8              8              +0.00%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPDecode-4             12             12             +0.00%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPTransform-4          38             38             +0.00%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPProcessRequest-4     58             58             +0.00%
BenchmarkProcessor/TestProcessMetricValidate-4                                         428            428            +0.00%
BenchmarkProcessor/TestProcessMetricDecode-4                                           41             41             +0.00%
BenchmarkProcessor/TestProcessMetricTransform-4                                        99             99             +0.00%
BenchmarkProcessor/TestProcessMetricProcessRequest-4                                   568            568            +0.00%
BenchmarkProcessor/TestProcessMetricMinimalValidate-4                                  44             44             +0.00%
BenchmarkProcessor/TestProcessMetricMinimalDecode-4                                    9              9              +0.00%
BenchmarkProcessor/TestProcessMetricMinimalTransform-4                                 21             21             +0.00%
BenchmarkProcessor/TestProcessMetricMinimalProcessRequest-4                            74             74             +0.00%
BenchmarkProcessor/TestProcessMetricMultipleSamplesValidate-4                          175            175            +0.00%
BenchmarkProcessor/TestProcessMetricMultipleSamplesDecode-4                            32             32             +0.00%
BenchmarkProcessor/TestProcessMetricMultipleSamplesTransform-4                         155            155            +0.00%
BenchmarkProcessor/TestProcessMetricMultipleSamplesProcessRequest-4                    362            362            +0.00%
BenchmarkProcessor/TestProcessMetricNullValidate-4                                     96             96             +0.00%
BenchmarkProcessor/TestProcessMetricNullDecode-4                                       10             10             +0.00%
BenchmarkProcessor/TestProcessMetricNullTransform-4                                    24             24             +0.00%
BenchmarkProcessor/TestProcessMetricNullProcessRequest-4                               130            130            +0.00%
BenchmarkBackendProcessor/TestProcessTransactionFullValidate-4                         415            415            +0.00%
BenchmarkBackendProcessor/TestProcessTransactionFullDecode-4                           92             92             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionFullTransform-4                        241            241            +0.00%
BenchmarkBackendProcessor/TestProcessTransactionFullProcessRequest-4                   748            748            +0.00%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesValidate-4                   143            143            +0.00%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesDecode-4                     36             36             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesTransform-4                  137            137            +0.00%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesProcessRequest-4             316            316            +0.00%
BenchmarkBackendProcessor/TestProcessSystemNullValidate-4                              6              6              +0.00%
BenchmarkBackendProcessor/TestProcessSystemNullDecode-4                                9              9              +0.00%
BenchmarkBackendProcessor/TestProcessSystemNullTransform-4                             45             45             +0.00%
BenchmarkBackendProcessor/TestProcessSystemNullProcessRequest-4                        60             60             +0.00%
BenchmarkBackendProcessor/TestProcessProcessNullValidate-4                             6              6              +0.00%
BenchmarkBackendProcessor/TestProcessProcessNullDecode-4                               9              9              +0.00%
BenchmarkBackendProcessor/TestProcessProcessNullTransform-4                            45             45             +0.00%
BenchmarkBackendProcessor/TestProcessProcessNullProcessRequest-4                       60             60             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanValidate-4                  20             20             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanDecode-4                    14             14             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanTransform-4                 60             60             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanProcessRequest-4            94             94             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceValidate-4               6              6              +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceDecode-4                 10             10             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceTransform-4              47             47             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceProcessRequest-4         63             63             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessValidate-4               12             12             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessDecode-4                 12             12             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessTransform-4              50             50             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessProcessRequest-4         74             74             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionEmptyValidate-4                        6              6              +0.00%
BenchmarkBackendProcessor/TestProcessTransactionEmptyDecode-4                          10             10             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionEmptyTransform-4                       46             46             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionEmptyProcessRequest-4                  62             62             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPValidate-4                  6              6              +0.00%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPDecode-4                    11             11             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPTransform-4                 48             48             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPProcessRequest-4            65             65             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadValidate-4               6              6              +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadDecode-4                 9              9              +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadTransform-4              45             45             +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadProcessRequest-4         60             60             +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendValidate-4                    32             32             +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendDecode-4                      28             28             +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendTransform-4                   120            120            +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendProcessRequest-4              180            180            +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeValidate-4              6              6              +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeDecode-4                12             12             +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeTransform-4             47             47             +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeProcessRequest-4        65             65             +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedValidate-4                   6              6              +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedDecode-4                     12             12             +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedTransform-4                  51             51             +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedProcessRequest-4             69             69             +0.00%

benchmark                                                                              old bytes     new bytes     delta
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceValidate-4                     225           225           +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceDecode-4                       504           504           +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceTransform-4                    3280          3280          +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalServiceProcessRequest-4               4010          4010          +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessValidate-4                     401           401           +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessDecode-4                       568           568           +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessTransform-4                    3616          3616          +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalProcessProcessRequest-4               4570          4570          +0.00%
BenchmarkBackendProcessor/TestProcessErrorFullValidate-4                               13046         13044         -0.02%
BenchmarkBackendProcessor/TestProcessErrorFullDecode-4                                 3632          3632          +0.00%
BenchmarkBackendProcessor/TestProcessErrorFullTransform-4                              16914         16914         +0.00%
BenchmarkBackendProcessor/TestProcessErrorFullProcessRequest-4                         33581         33579         -0.01%
BenchmarkBackendProcessor/TestProcessErrorNullValuesValidate-4                         11097         11097         +0.00%
BenchmarkBackendProcessor/TestProcessErrorNullValuesDecode-4                           1184          1184          +0.00%
BenchmarkBackendProcessor/TestProcessErrorNullValuesTransform-4                        7840          7840          +0.00%
BenchmarkBackendProcessor/TestProcessErrorNullValuesProcessRequest-4                   20125         20125         +0.00%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPValidate-4                        226           226           +0.00%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPDecode-4                          600           600           +0.00%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPTransform-4                       3344          3344          +0.00%
BenchmarkBackendProcessor/TestProcessErrorAugmentedIPProcessRequest-4                  4171          4170          -0.02%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionValidate-4            0             0             +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionDecode-4              520           520           +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionTransform-4           2976          2976          +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadExceptionProcessRequest-4      3496          3496          +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogValidate-4                  225           225           +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogDecode-4                    488           488           +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogTransform-4                 2976          2976          +0.00%
BenchmarkBackendProcessor/TestProcessErrorMinimalPayloadLogProcessRequest-4            3690          3690          +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendValidate-4                          1972          1972          +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendDecode-4                            2528          2528          +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendTransform-4                         145480        145486        +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendProcessRequest-4                    149985        149982        -0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapValidate-4                    1715          1715          +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapDecode-4                      2088          2088          +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapTransform-4                   120768        120764        -0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendNoSmapProcessRequest-4              124561        124564        +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapValidate-4              4557          4557          +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapDecode-4                2680          2680          +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapTransform-4             28386         28387         +0.00%
BenchmarkFrontendProcessor/TestProcessErrorFrontendMinifiedSmapProcessRequest-4        35624         35624         +0.00%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPValidate-4           225           225           +0.00%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPDecode-4             568           568           +0.00%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPTransform-4          3008          3008          +0.00%
BenchmarkFrontendProcessor/TestProcessErrorAugmentedUserAgentAndIPProcessRequest-4     3802          3802          +0.00%
BenchmarkProcessor/TestProcessMetricValidate-4                                         39794         39795         +0.00%
BenchmarkProcessor/TestProcessMetricDecode-4                                           1480          1480          +0.00%
BenchmarkProcessor/TestProcessMetricTransform-4                                        8182          8182          +0.00%
BenchmarkProcessor/TestProcessMetricProcessRequest-4                                   49458         49456         -0.00%
BenchmarkProcessor/TestProcessMetricMinimalValidate-4                                  4938          4938          +0.00%
BenchmarkProcessor/TestProcessMetricMinimalDecode-4                                    440           440           +0.00%
BenchmarkProcessor/TestProcessMetricMinimalTransform-4                                 2320          2320          +0.00%
BenchmarkProcessor/TestProcessMetricMinimalProcessRequest-4                            7699          7699          +0.00%
BenchmarkProcessor/TestProcessMetricMultipleSamplesValidate-4                          14671         14671         +0.00%
BenchmarkProcessor/TestProcessMetricMultipleSamplesDecode-4                            1056          1056          +0.00%
BenchmarkProcessor/TestProcessMetricMultipleSamplesTransform-4                         15152         15152         +0.00%
BenchmarkProcessor/TestProcessMetricMultipleSamplesProcessRequest-4                    30883         30883         +0.00%
BenchmarkProcessor/TestProcessMetricNullValidate-4                                     10764         10765         +0.01%
BenchmarkProcessor/TestProcessMetricNullDecode-4                                       488           488           +0.00%
BenchmarkProcessor/TestProcessMetricNullTransform-4                                    2656          2656          +0.00%
BenchmarkProcessor/TestProcessMetricNullProcessRequest-4                               13910         13909         -0.01%
BenchmarkBackendProcessor/TestProcessTransactionFullValidate-4                         35930         35923         -0.02%
BenchmarkBackendProcessor/TestProcessTransactionFullDecode-4                           3048          3048          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionFullTransform-4                        24504         24504         +0.00%
BenchmarkBackendProcessor/TestProcessTransactionFullProcessRequest-4                   63490         63483         -0.01%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesValidate-4                   12880         12880         +0.00%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesDecode-4                     1832          1832          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesTransform-4                  14640         14640         +0.00%
BenchmarkBackendProcessor/TestProcessTransactionNullValuesProcessRequest-4             29353         29353         +0.00%
BenchmarkBackendProcessor/TestProcessSystemNullValidate-4                              225           225           +0.00%
BenchmarkBackendProcessor/TestProcessSystemNullDecode-4                                504           504           +0.00%
BenchmarkBackendProcessor/TestProcessSystemNullTransform-4                             3896          3896          +0.00%
BenchmarkBackendProcessor/TestProcessSystemNullProcessRequest-4                        4626          4626          +0.00%
BenchmarkBackendProcessor/TestProcessProcessNullValidate-4                             225           225           +0.00%
BenchmarkBackendProcessor/TestProcessProcessNullDecode-4                               504           504           +0.00%
BenchmarkBackendProcessor/TestProcessProcessNullTransform-4                            3896          3896          +0.00%
BenchmarkBackendProcessor/TestProcessProcessNullProcessRequest-4                       4626          4626          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanValidate-4                  673           673           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanDecode-4                    656           656           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanTransform-4                 5736          5736          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalSpanProcessRequest-4            7067          7067          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceValidate-4               225           225           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceDecode-4                 520           520           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceTransform-4              4200          4200          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalServiceProcessRequest-4         4946          4946          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessValidate-4               401           401           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessDecode-4                 584           584           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessTransform-4              4552          4552          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalProcessProcessRequest-4         5522          5522          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionEmptyValidate-4                        225           225           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionEmptyDecode-4                          520           520           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionEmptyTransform-4                       3912          3912          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionEmptyProcessRequest-4                  4658          4658          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPValidate-4                  225           225           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPDecode-4                    552           552           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPTransform-4                 4248          4248          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionAugmentedIPProcessRequest-4            5026          5026          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadValidate-4               225           225           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadDecode-4                 504           504           +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadTransform-4              3896          3896          +0.00%
BenchmarkBackendProcessor/TestProcessTransactionMinimalPayloadProcessRequest-4         4626          4626          +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendValidate-4                    867           867           +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendDecode-4                      1280          1280          +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendTransform-4                   7192          7192          +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionFrontendProcessRequest-4              9326          9326          +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeValidate-4              225           225           +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeDecode-4                584           584           +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeTransform-4             3928          3928          +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedMergeProcessRequest-4        4739          4739          +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedValidate-4                   225           225           +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedDecode-4                     584           584           +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedTransform-4                  4600          4600          +0.00%
BenchmarkFrontendProcessor/TestProcessTransactionAugmentedProcessRequest-4             5410          5410          +0.00%


import (
pr "github.com/elastic/apm-server/processor"
err "github.com/elastic/apm-server/model/error"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please also change err here.

er "github.com/elastic/apm-server/processor/error"
"github.com/elastic/apm-server/processor/error/generated/schema"
"github.com/elastic/apm-server/model/error/generated/schema"
err "github.com/elastic/apm-server/processor/error"
Copy link
Contributor

Choose a reason for hiding this comment

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

same for err

@@ -27,7 +27,7 @@ import (
s "github.com/go-sourcemap/sourcemap"

"github.com/elastic/apm-server/config"
er "github.com/elastic/apm-server/processor/error"
err "github.com/elastic/apm-server/processor/error"
Copy link
Contributor

Choose a reason for hiding this comment

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

same

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.

Apart from the missing rebase and the view minor comments left, LGTM

Ron cohen added 6 commits July 18, 2018 10:19
This moves error, transaction, sourcemap and metric models into
directories in the "model" directory. It changes processors to
be simple structs which can potentially override Decode/Validate
(only sourcemaps do this). This removes a bunch of boilerplate
from the processors. This will help move towards decoding and
validating models individually, which is needed in the future.
@roncohen roncohen force-pushed the processor-refactor branch from aa1ebb0 to 3236b6e Compare July 18, 2018 08:20
@roncohen roncohen merged commit 3daa4fe into elastic:master Jul 18, 2018
@roncohen
Copy link
Contributor Author

backport waiting for elastic/beats#7629

roncohen added a commit to roncohen/apm-server that referenced this pull request Jul 24, 2018
…#1137)

This moves error, transaction, sourcemap and metric models into
directories in the "model" directory. It changes processors to
be simple structs which can potentially override Decode/Validate
(only sourcemaps do this). This removes a bunch of boilerplate
from the processors. This will help move towards decoding and
validating models individually, which is needed in the future.

And healthcheck processor is now a simple http.Handler.
roncohen added a commit that referenced this pull request Jul 24, 2018
…1176)

This moves error, transaction, sourcemap and metric models into
directories in the "model" directory. It changes processors to
be simple structs which can potentially override Decode/Validate
(only sourcemaps do this). This removes a bunch of boilerplate
from the processors. This will help move towards decoding and
validating models individually, which is needed in the future.

And healthcheck processor is now a simple http.Handler.
@roncohen roncohen mentioned this pull request Aug 16, 2018
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants