Code Monkey home page Code Monkey logo

Comments (8)

craff avatar craff commented on May 26, 2024

And this should be optional ?

from tiny_httpd.

c-cube avatar c-cube commented on May 26, 2024

This should definitely be outside of tiny-httpd, I think it just has to provide some core primitives (like number of active connections), and maybe some instrumentation.

if we get an optional wrap_query parameter (maybe a begin_query: ip -> port -> 'a and end_query: 'a -> unit pair), then you can instrument however you want: prometheus, tracy, hand rolled sqlite-based analytics, etc. Mechanism, not policy 😉

from tiny_httpd.

c-cube avatar c-cube commented on May 26, 2024

Of course a very basic statistics module can be provided alongside Tiny_httpd_utils, like Tiny_httpd_stats with exactly that kind of pair to pass to Tiny_httpd.create.

from tiny_httpd.

craff avatar craff commented on May 26, 2024

I like the idea of a wrapper for connection, the wrapper could have access to both the request and the response though ?
For the default stats, I think something usefull ought to write in a Db from which it is easy to compute average and so on... And therefore hard to provide a default. Except if you have something specific in mind ?

from tiny_httpd.

c-cube avatar c-cube commented on May 26, 2024

from tiny_httpd.

c-cube avatar c-cube commented on May 26, 2024

We already have an internal handler type, which could probably be compatible with a middleware type handler -> handler:

(* a request handler. handles a single request. *)
type cb_path_handler =
  out_channel ->
  byte_stream Request.t ->
  resp:(Response.t -> unit) ->
  unit

from tiny_httpd.

craff avatar craff commented on May 26, 2024

The middleware patch + example of stat in echo.ml solves this issue ?

from tiny_httpd.

c-cube avatar c-cube commented on May 26, 2024

yeah it's easy to done oneself. done.

from tiny_httpd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.