Coder Social home page Coder Social logo

Comments (3)

fstab avatar fstab commented on July 17, 2024

Thanks @nicu-da, I'm happy to make it configurable. Do you think 0 is a reasonable default?

from client_java.

nicu-da avatar nicu-da commented on July 17, 2024

Thank you for the quick response @fstab.

Checking the docs for close:

    /**
     * Stops this server by closing the listening socket and disallowing
     * any new exchanges from being processed. The method will then block
     * until all current exchange handlers have completed or else when
     * approximately <i>delay</i> seconds have elapsed (whichever happens
     * sooner). Then, all open TCP connections are closed, the background
     * thread created by {@link #start()} exits, and the method returns.
     * Once stopped, a {@code HttpServer} cannot be re-used.
     *
     * @param delay the maximum time in seconds to wait until exchanges have finished
     * @throws IllegalArgumentException if delay is less than zero
     */

it sounds like using a non 0 value as a default would be saner, giving 1 second for any scrape to finish before shutting down the server. It shouldn't have an impact in most cases as even if there is a scrape ongoing, in most cases it should finish a lot quicker.

from client_java.

friscoMad avatar friscoMad commented on July 17, 2024

+1 to this request probably giving 1 sec is a saner default but let others make it 0 if they need it.

Also, we would like to have a way to pass a custom metric handler
In our use case, we want to ensure that there was at least one scrape before closing as we want to scrape tasks that can have a variable duration, and we also want to be sure that the last values are scraped.

In the old version (0.16) we could use a fake name filter to detect when it was scraped and then close the server (adding some extra delay) with the newer versions there is no way to do that so it will be nice if you could make the handler configurable (or implement an option that when close is called it waits for a last scrape until it does the server).

from client_java.

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.