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: introduce ErrorDetailer interface #453

Merged
merged 2 commits into from
Feb 26, 2019
Merged

Conversation

axw
Copy link
Member

@axw axw commented Feb 22, 2019

Introduce the ErrorDetailer interface, along with
top-level functions RegisterTypeErrorDetailer and
RegisterErrorDetailer. The former register an
ErrorDetailer with a specific error type, and the
latter registers an ErrorDetailer for all errors.

When an error is created with NewError or NewErrorLog,
we pass the error details through these ErrorDetailers,
giving instrumentation modules and application-specific
code an opportunity to extract details from custom
error types.

In module/apmmongo, we register an ErrorDetailer
that extracts details from mongo.CommandErrors.

Closes #447
Closes #443

@codecov-io
Copy link

codecov-io commented Feb 22, 2019

Codecov Report

Merging #453 into master will increase coverage by 0.63%.
The diff coverage is 92.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #453      +/-   ##
==========================================
+ Coverage   83.39%   84.02%   +0.63%     
==========================================
  Files         107      108       +1     
  Lines        6546     6580      +34     
==========================================
+ Hits         5459     5529      +70     
+ Misses        796      763      -33     
+ Partials      291      288       -3
Impacted Files Coverage Δ
error_unix.go 100% <100%> (ø)
modelwriter.go 95.93% <100%> (+1.62%) ⬆️
module/apmmongo/monitor.go 93.05% <100%> (+0.86%) ⬆️
error.go 92.82% <91.35%> (+13.93%) ⬆️
model/marshal_fastjson.go 67.87% <0%> (+0.25%) ⬆️
model/marshal.go 78.07% <0%> (+1.6%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5028e1b...08a73c6. Read the comment docs.

@axw axw marked this pull request as ready for review February 25, 2019 03:25
@axw axw closed this Feb 25, 2019
@axw axw reopened this Feb 25, 2019
@axw axw force-pushed the error-details branch 3 times, most recently from 7241407 to 447cc27 Compare February 26, 2019 02:18
Introduce the ErrorDetailer interface, along with
top-level functions RegisterTypeErrorDetailer and
RegisterErrorDetailer. The former register an
ErrorDetailer with a specific error type, and the
latter registers an ErrorDetailer for all errors.

When an error is created with NewError or NewErrorLog,
we pass the error details through these ErrorDetailers,
giving instrumentation modules and application-specific
code an opportunity to extract details from custom
error types.
Register an ErrorDetailer for mongo.CommandError,
extract the error code and labels.
@axw axw merged commit b82952f into elastic:master Feb 26, 2019
@axw axw deleted the error-details branch February 26, 2019 03:35
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.

None yet

2 participants