예제 #1
0
    subscription_t(const std::string& cluster, const std::string& unicorn_prefix, peers_t& peers,
            std::chrono::seconds system_weights_ttl, std::chrono::seconds retry_after, api::unicorn_t& unicorn,
            executor::owning_asio_t& executor, logging::logger_t& logger)
        : cluster_(cluster)
        , path_(format("{}/{}/metrics", unicorn_prefix, cluster))
        , ttl_(system_weights_ttl)
        , retry_after_(retry_after)
        , expiration_timer_(executor.asio())
        , retry_timer_(executor.asio())
        , unicorn_(unicorn)
        , peers_(peers)
        , logger_(logger) {

        subscribe();
        schedule_expiration();
        COCAINE_LOG_INFO(logger_, "subscribed to metrics by path `{}`", path_);
    }
예제 #2
0
 updater_t(std::string path,
           std::string hostname,
           std::vector<tcp::endpoint> endpoints,
           dynamic_t::object_t extra,
           uniresis::resources_t resources,
           std::shared_ptr<api::unicorn_t> unicorn,
           std::shared_ptr<logging::logger_t> log) :
     path(std::move(path)),
     hostname(std::move(hostname)),
     endpoints(std::move(endpoints)),
     extra(std::move(extra)),
     resources(std::move(resources)),
     unicorn(std::move(unicorn)),
     scope(),
     subscope(),
     executor(),
     timer(executor.asio()),
     log(std::move(log))
 {}