Commit Graph

65 Commits

Author SHA1 Message Date
Sergey Yelin
d9fca6da55
Prepare for Erlang 24 (#150)
* Update deps with support for Erlang 24
* Remove generated artefacts from test
* Fix compiler warning
* Format
2021-05-21 13:28:56 +03:00
dinama
f2cd30883d
upgrade: +alpine +rebar +dialyzer +deps (#149) 2021-01-15 15:35:41 +03:00
Andrew Mayorov
feadc0d103
Increase request id length limit up to 64 (#146)
* Increase request id length limit up to 64

According to rbkmoney/coredocs#226.

* Bump joint worker timeout in tests

So they would flap less frequently, hopefully.
2020-08-26 19:02:05 +03:00
Andrew Mayorov
d106ef66bd
Use new performant thrift codec infrastructure (#145)
* Implement woody_client_thrift_v2 over new thrift codec facility, make it default
* Move tracing facilities into woody_trace_h
* Implement woody_server_thrift_v2 over thrift codec facility, make it default
* Bump to rbkmoney/genlib@54920e76
* Enforce tuple-based args representation
* Enable cross tests between impls
* Switch to master rbkmoney/thrift_erlang@4eda678c
2020-08-18 13:01:47 +03:00
Andrew Mayorov
42dbb91b2b
Drop legacy headers support (#144) 2020-08-11 13:49:06 +03:00
Andrew Mayorov
33b6991373
Downgrade hacnkey to 1.15.2 (#143)
Since benoitc/hackney#638 affects us consistently and still needs fixing.
2020-08-04 14:47:06 +03:00
Andrew Mayorov
a434e55e14
Bump to rbkmoney/thrift_erlang@aa233e2 (#139)
* Bump to rbkmoney/image-build@07d3946f
* Bump hackney to 1.16.0
2020-06-30 15:19:53 +03:00
Sergei Shuvatov
8b8c0e2779
MSPF-532: fix check for UTC in RFC 3339 date and time (#132) 2020-02-18 19:35:33 +03:00
Sergei Shuvatov
3ddd842a33
MSPF-532: get rid of rfc3339 lib (#131) 2020-02-17 19:36:29 +03:00
Sergey Yelin
d55dbf551a
HG-534: Fix 'unknown message error' in event handler (#130)
* HG-534: Fix 'unknown message error' in event handler

* Revert "HG-534: Fix 'unknown message error' in event handler"

This reverts commit efd6c51129adeca1369296f360f3e931732f5c76.

* HG-534: Fix unknown message error

* More accurate test

* Fix lint error
2020-02-14 21:56:29 +03:00
Toporkov Igor
ed644d7d70
MSPF-490: Monitor to detect client disconnection (#111)
* Monitor to detect client disconnetion on server side

* Renaming save_woody_state

* Rework monitor to use one per connection

* Changed event type

* wip: stream handler skeleton

* wip: log abnormal termination

* Upgrade cowboy to 2.7.0

* Finish migration to stream_handler

* Upgrade more dependencies

* Fix state type, remove early_error logging

* rename woody_monitor to comply with cowboy naming

* remove redundant monitor pid from state

* Log only socket errors

* wrap put_woody_state

* experimental: monitor for woody_events

* add missing update

* match on handle_event return, don't monitor tracing

* Rework update_woody_state

* Slightly increase min_complexity in linter config

* Make event state transition explicit

* Remove handle_event wraper

* Revert "Slightly increase min_complexity in linter config"

This reverts commit 38301e3b5b66967cb08c0bf7f27a2a8042a40a19.

* match unmetched returns

* Add test

* Erase trailing whitespace

* Refactor test

* Delete mistakenly added file

* Rename function

* Review fixes

* Match supervisor return

Co-Authored-By: Andrew Mayorov <a.mayorov@rbkmoney.com>

Co-authored-by: Andrew Mayorov <encube.ul@gmail.com>
2020-02-05 14:35:43 +03:00
Andrew Mayorov
295b864cf7
Host processes under tc_sup in tests (#129)
To avoid piling ct logs up with error report noise.
2020-02-05 14:14:08 +03:00
Andrew Mayorov
e615c85d70
Implement binary-first event formatter (#122)
* Add compex term formatting microbenchmark
* Format FP numbers more neatly
* Provide fast-path verbatim term formatter
* Add memory pressure benchmark runner
* Switch to rebar3_bench 0.2.1 package
* Employ assert macros throughout main ct suite
2019-12-31 12:52:56 +03:00
Sergey Yelin
2dc2ed1297
Add naive bench for formatter (#119)
* Add naive bench for formatter

* Review fixes
2019-12-11 19:07:16 +03:00
Sergey Yelin
59ec572466
Add depth and limit to formatter (#110)
* Force print trace_id and Co

* Use integer control char for formtatting numbers

* Sync

* Fix format for "wrong" struct

* Replace string formatting with inplace string representation

* Replace foldl with tail call

* Added opts comntainer

* Add formatting with depth

* Simplify depth increment

* More depth tests

* Format test data

* lint fixes

* Fix dialyzer errors

* Introduce current_length and max_length

* Add first tests for max_length

* Add length options

* Fix state in format_struct

* Fix test

* Move depth to stack from state

* Move length from state to stack

* Added more test on chars limit

* More tests

* Try to log more data nj logs

* Cleanup

* Fix line count in arguments

* Add missing formatted text in list and map

* Add comment to raw_string

* Formating

* Replace format with concatenation

* Fix dialyzer errors

* Fix lint errors

* Ignore false positives

* Added tests for max_length and max_depth

* Let logger decide how to format data in case of error

* Add formatter options to meta

* Fix lint error

* Increase complexity for dont_repeat_yourself

* Increase compliexity - 2

* Decrease complexity to minimal for current codebase

* Do not add '...' if no more argemunts in call

* Unify arguments for maybe_add_delimiter and may_be_add_more_marker

* Fix formating for list/set/map

* Simplify format build

* Log error

* Review fixes

* Move formatter options to environment

* Minor fixes and code cleanup

* Fix Opts

* Review fix

* Rework exception handling

* Move list and set format to separate functions

* Fix possible injection

* Eliminate possible badmatch

* Allow more complex dry

* Add test for sets

* Rework list formatter

* More strict limit for length

* Minor cleanup

* Remove unreachable code

* Switch back to formatter

* Remove unneeded flatten

* Do not format last list element if there is no room for it

* Remove unused Param

* Fix

* Simplify formatting call

* Add missing delimiter length

* Fix woody_event_formatter:format_reply/3

* Cleanup

* Add Opts to formatters

* Make skip message compact

* use ~w instead of ~p

* Typo

* Add formatter_opts to woody:options()

* Rework options

* Added escape for "'"

* Rework tests

* Fix tests

* Rework
2019-12-03 16:12:17 +03:00
Toporkov Igor
649a8aba30
Created hay handler to monitor connections (#104)
* Created hay handler to monitor connections

* Review fixes #1

* Added hay as app dependency

* Created metrics receiver for hackney

* Removed filtering, added key tagging

* Added metrics to tests

* Removed non list key tagging option

* Refactored metric updates

* Moved hay to test deps

* Strictened allowed metrics, enabled key mapping

* Added privkey to dialyze CI step

* Reordered privkey

* Changed cache location

* Hardcoded allowed metrics

* Use tag for test deps

* Collect info for all ranch listeners
2019-07-05 16:31:58 +03:00
Sergei Shuvatov
5ee89dd0b2
CDS-64: pass client cert through woody context (#107) 2019-06-24 19:44:45 +03:00
Sergey Elin
f0df3414cf
MSPF-458: Fix ssl SUITE tests (#106)
* MSPF-458: Fix ssl SUITE tests

* MSPF-458: Remove extra newline
2019-06-19 18:32:52 +03:00
Sergei Shuvatov
a4921bde49
CDS-64: add options for SSL support (#103)
* Get rid of acceptors_pool_size environment variable
* Fix end_per_testcase/2 in the main test suite
2019-06-06 13:11:48 +03:00
Andrey Fadeev
90eca45089
Add more details to unsupported_url_scheme resolver error (#94) 2019-04-19 20:29:30 +03:00
Alexey
533d2a6d81
MSPF-429: Graceful shutdowns (#89) 2019-04-19 14:18:32 +03:00
Sergey Elin
09506cdd10
MSPF-413: Add execition_time (#92)
List of changes:
* Use thrift plugin compiler 0.3.0
* Update build_tools to latest
* Update build image to Erlang 21
* Added execution_start_time, execution_end_time, execution_duration_ms to woody state
2019-04-19 10:08:35 +03:00
Toporkov Igor
862358ee62
MSPF-428: Erlang OTP 21 to master (#86)
* MSPF-394/Migrate woody_erlang to cowboy 2.5.0 (#82)

* Renewed some old cowboy syntax

* Reworked types to fit new cowboy/ranch versions

* Replaced cowboy tuples with separate values

* Fixed types, deleted testing logs, deleted redundant errors

* Moved to new StackTrace retrieval syntax for Erlang/OTP 21

* Restored default config, fixed typing

* Cleaned unnessesary changes, removed export_all

* Restored genlib cached version

* Downgraded to old stacktrace retrieval syntax, fixed codestyle

* Restored new StackTrace retrieval syntax, updated build image

* Changed rebar3 version for CI

* Corrected typing and spelling, removed unnessesary supervisor

* Created stream handler to replace hooks

* Added options for reading body

* Simplified stream handler

* Fixed wrong module name, added read body options support in stream handler

* Puted read body opts to env, renamed stream handler

* Codestyle, types and config fixes

* Moved response tracing to a separate function, now tracing failed requests too

* Changed options to map (#83)

* Fixed wrong timeout override logic (#84)

* Patch merge conflict

* Bump dependencies  (#87)

* bumped hackney

* bumped erlang thrift commit
2019-03-28 17:52:17 +03:00
Alexey
4f5f7337e6
MSPF-416: No aggressive keepalives (#85) 2019-03-28 13:37:37 +03:00
Andrew Mayorov
71475b5d3d
Relax test assertion to make it realistic (#80)
* Update README with mentions of new and updated options
2018-11-07 15:37:24 +03:00
Andrew Mayorov
7a57a10d02
Expose ranch transport opts (#79)
It will allow library users to tune things like number of max allowed concurrent connections.
2018-11-07 12:54:54 +03:00
Andrey Fadeev
94eb44904e
MSPF-351 Add headers transition (#71) 2018-07-31 11:37:13 +03:00
Petr Kozorezov
996f6d5b2c
Task/mspf 374/woody caching (#73)
* add stale cache and joint workers

* add caching client

* add test, refactor code a little bit

* apply review fixes

* apply review fixes

* apply review fixes

* add caching client events

* apply review comments

* add thrift meta info to cache events

* update tests
2018-07-31 10:51:12 +03:00
Andrey Fadeev
98469234e4
MG-128 Fix deadline without milliseconds part parsing (#69)
Switch to our own rfc3339 fork
2018-07-03 19:48:43 +03:00
Anton Belyaev
74fb666e87
MSPF-313: introduce deadlines (#62)
* introduce woody deadline
* refactor cowboy handler init checks order
  1. start with basic http checks
  2. proceed with woody related stuff
2018-01-30 12:50:18 +03:00
Anton Belyaev
ad1e91050c MSPF-281: add event meta formatting interface and introduce woody_state (#61)
* add event meta formatting
* introduce woody_state
* freshen up the build image
* add  tag for internal error on cowboy unhealthy termination
2017-10-20 14:34:01 +03:00
Anton Belyaev
62e6e19f4a MSPF-232-235: fixes after M pen testing (#56)
* MSPF-232: optionally configure max_heap_size limit for server handler.
* MSPF-233: check vm total memory against configurable threshold before
            starting to handle request on the server.

* MSPF-234: improve introspection for result_unexpected errors on the client.
* MSPF-234: send thrift decode error details from server to client
* MSPF-234: pass stacktrace for result_unexpected error from server to client as error details
* MSPF-235: use input Id as a span_id, instead of trace_id in woody_context:new_rpc_id/1.
            trace_id is used across the entire requst tree and is rather safer
            as woody snowflake id.

* fix a bug in server net_opts handling
* fix event formatting types
2017-05-18 17:17:37 +04:00
Artem Ocheredko
8f1f42e209 Fix getting context meta by key when there is no meta (#54) 2017-03-31 20:18:04 +04:00
Anton Belyaev
d6f0de5a35 MG-64: correct woody_client:child_spec name (#52) 2017-03-04 14:37:17 +04:00
Dmitry Manik
7650c1f9f1 Fix flowed child_spec abstraction (#48)
* MG-64: Add find_pool function

* MG-64: Refactor options

* MG-64: Fix linter and dialyzer errors

* MG-64: Fix tests

* MG-64: Add review fixes

Remove unnecessary functionality
Rename pool_name -> name option
Define child_spec as woody_client_behaviour

* MG-64: Add review fixes 2
2017-03-03 17:34:41 +03:00
Anton Belyaev
66884b7020 MSPF-200: bump up erlang to 19.1 and fix some bugs along the way (#50)
* bump up erlang to 19.1
* fix Issue https://github.com/rbkmoney/woody_erlang/issues/44
* fix Issue https://github.com/rbkmoney/woody_erlang/issues/41
* fix some other bugs
2017-02-22 15:45:51 +03:00
Dmitry Manik
75c4b97608 Add an opportunity to obtain pool child spec (#45)
* Add an opportunity to obtain pool child spec

* Rework options passing while creating pools

* Add some info about child_spec usage
2017-02-09 19:56:09 +03:00
Anton Belyaev
ac84da3d5b MSPF-108: transient errors implementation (#38)
* align rpc id handling with new requirements
* add new interface woody.erl, mv woody_t -> woody
* bump up thrift for the latest thrift_membuffer_transport
* remove woody:call_safe/3, woody_client:call_safe/3 from client API
* add cowboy net_opts to Server API
* Introduce event formatter to woody_event_handler
* Refactor events
* Remove outdated exception from the elvis rules
* Update woody_server_thrift_handler internal API
* make Opts optional for handlers
* add default event handler
* bump up hackney
* update README
* fix issues: 12, 18, 20, 21, 25, 26, 31, 37
2016-12-19 14:11:05 +03:00
Anton Belyaev
ebf5b86e99 MSPF-18: new woody context (#36)
* MSPF-18: introduce woody_context
* MSPF-18: use Jenkins cache for dialyze; bump up build utils (add colors to wc_%), build-image
* MSPF-18: add bugfix for [Issue 20]
* MSPF-18: add bugfix for [Issue 27]
* MSPF-18: add bugfix for [Issue 29]
* MSPF-18: add bugfix for [Issue 34]
* MSPF-18: update README
2016-11-18 16:49:05 +03:00
Anton Belyaev
2157a34651 HG-64: pass any transport opts to underlying hackney. (#32)
HG-64: fix several issues
* pass any transport opts to underlying hackney.
* remove TC for allowed options
* fix Issue https://github.com/rbkmoney/woody_erlang/issues/19
* bump up build_image
* bump up build_utils
2016-10-18 16:41:45 +03:00
Anton Belyaev
49f47a8b3d MSPF-61: switch to build utils and refactor (#17)
* start using build_utils
* simplify woody_client:result_ok() type (issue 10)
* use integer snowflake id
* rename woody_client_thrift:format_return/3 (issue 11)
* provide details to event_handler for http errors (issue 15)
* clarify net_opts() for woody_server_thrift_http_handler:options() type
* switch snoflake to rbkmoney fork
* update readme
* introduce lint and fix lint warnings
* add woody_client:make_id_int/0 API function
2016-08-26 19:15:48 +04:00
Anton Belyaev
db30966138 MG-16: fix handler spec validation (#9)
* MG-16: fix handler spec validation

* MG-16: add a test
2016-08-04 13:25:49 +04:00
Anton Belyaev
5ca1cde242 MSPF-31: thirift idiomatic is prohibited 2016-05-25 15:59:01 +03:00
Anton Belyaev
f39ae8776c MSPF-31: generate thrift erlang files via thrift_compiler plugin 2016-05-24 16:08:39 +03:00
Anton Belyaev
04e41d92aa MSPF-31: pass through defined thrift results and exceptions for hierarchical Rpc requests 2016-05-21 21:08:16 +03:00
Anton Belyaev
2c232d2f37 MSPF-31: update thrift_handler behaviour
* remove useless handle_error/4
* handle_function/4 should include woody_client:context() in all return cases
2016-05-20 23:07:43 +03:00
Anton Belyaev
132efd80d9 MSPF-31: add woody_client:make_id/1; new thrift_erlang; minor refactoring 2016-05-20 18:55:02 +03:00
Anton Belyaev
25e9996a71 Update thrift dep 2016-05-06 20:45:11 +03:00
Anton Belyaev
85c894ead9 Refactor woody_event_handler. Update README
* Make rpc_id (triple: span_id, parent_id and trace_id) a separate argument for handle_event/3.
* Sync README with refactored API in woody_event_handler, woody_server_thrift_handler and woody_client.
2016-05-05 17:22:55 +03:00
Anton Belyaev
7bebc67294 Refactor woody_clinet, woody_server_thrift_handler behaviour
* woody_clinet:client -> context
* woody_client:new -> new_context
* woody_server_thrift_handler behaviour: RpcId is not available as handle_function/handle_error argument anymore.
  It should be fetched from the provided Context value: woody_client:get_rpc_id(Context).
2016-05-05 14:31:33 +03:00