boundary / folsom_cowboy Goto Github PK
View Code? Open in Web Editor NEWA Cowboy based Folsom HTTP Wrapper.
License: Apache License 2.0
A Cowboy based Folsom HTTP Wrapper.
License: Apache License 2.0
Hi,
I'm guessing this could be an incompatibility between folsom and folsom_cowboy, but folsom_cowboy doesn't have any tags, so I'm not sure which version I am supposed to use :)
I am able to create a meter metric called msg_per_sec:
folsom_metrics:new_meter(msg_per_sec)
Then I update it every time I receive a new message:
folsom_metrics:notify({msg_per_sec, 1}),
I can see the stats are being collected okay because get_metric_value works fine:
5> folsom_metrics:get_metric_value(msg_per_sec).
[{count,2257},
{one,9.793870473767395},
{five,7.6517299033567285},
{fifteen,6.22315210736992},
{mean,9.818651166080544e-6},
{acceleration,[{one_to_five,0.007140468568035556},
{five_to_fifteen,0.0023809629933113476},
{one_to_fifteen,0.003967464851552751}]}]
If I try to look at the available metrics from a browser with "http://localhost:5565/_metrics" I get:
["msg_per_sec"]
But if I try "http://localhost:5565/_metrics/msg_per_sec" I get a 500 error with this in the Erlang console:
14:05:24.844 [error] ** Handler folsom_cowboy_metrics_handler terminating in handle/2
for the reason error:undef
** Options were []
** Handler state was undefined
** Request was [{socket,#Port<0.4793>},{transport,cowboy_tcp_transport},{connection,keepalive},{pid,<0.371.0>},{method,'GET'},{version,{1,1}},{peer,undefined},{host,[<<"localhost">>]},{host_info,undefined},{raw_host,<<"localhost">>},{port,5565},{path,[<<"_metrics">>,<<"msg_per_sec">>]},{path_info,undefined},{raw_path,<<"/_metrics/msg_per_sec">>},{qs_vals,undefined},{raw_qs,<<>>},{bindings,[]},{headers,[{'Accept-Charset',<<"ISO-8859-1,utf-8;q=0.7,*;q=0.3">>},{'Accept-Language',<<"en-US,en;q=0.8">>},{'Accept-Encoding',<<"gzip,deflate,sdch">>},{'Accept',<<"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8">>},{'User-Agent',<<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11">>},{'Connection',<<"keep-alive">>},{'Host',<<"localhost:5565">>}]},{p_headers,[{'Connection',[<<"keep-alive">>]}]},{cookies,undefined},{meta,[]},{body_state,waiting},{buffer,<<>>},{resp_state,waiting},{resp_headers,[]},{resp_body,<<>>},{onresponse,undefined},{urldecode,{#Fun<cowboy_http.urldecode.2>,crash}}]
** Stacktrace: [{mochinum,digits,[9.889871914675805],[]},{mochijson2,'-json_encode_proplist/2-fun-0-',3,[{file,"src/mochijson2.erl"},{line,167}]},{lists,foldl,3,[{file,"lists.erl"},{line,1197}]},{mochijson2,json_encode_proplist,2,[{file,"src/mochijson2.erl"},{line,170}]},{mochijson2,'-json_encode_proplist/2-fun-0-',3,[{file,"src/mochijson2.erl"},{line,167}]},{lists,foldl,3,[{file,"lists.erl"},{line,1197}]},{mochijson2,json_encode_proplist,2,[{file,"src/mochijson2.erl"},{line,170}]},{folsom_cowboy_metrics_handler,get_request,1,[{file,"src/folsom_cowboy_metrics_handler.erl"},{line,45}]}]
Basically I'm not sure whether it's something I'm doing wrong, a version compatibility issue or something else :)
This repo is forked and likely unmaintained.
I no longer have access the folsom related projects and it seems like I probably won't in the near future. To continue maintaining them I have moved the project to https://github.com/folsom-project Please update your projects.
The error looks like this:
08:41:57.114 [error] Error in process <0.319.0> with exit value: {{badmatch,false},[{cowboy_router,execute,2,[{file,"src/cowboy_router.erl"},{line,171}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,500}]}]}
08:41:57.118 [error] Supervisor ranch_conns_sup had child ranch_conns_sup started with {ranch_conns_sup,start_protocol,undefined} at <0.319.0> exit with reason no match of right hand value false in cowboy_router:execute/2 line 171 in context child_terminated
May I also suggest you fixing a version of cowboy in your rebar.config?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.