Commit f3c0fb0c authored by Luciano Orsini's avatar Luciano Orsini
Browse files

references #110: prometheus through infospace, test 2 counters

parent 9348e213
......@@ -46,6 +46,7 @@ namespace prometheus
protected:
xdata::Counter * counter_;
xdata::Counter * counter2_;
};
}
......
......@@ -254,7 +254,7 @@ void prometheus::Application::timeExpired(toolbox::task::TimerEvent& e)
///
auto exists = [this,registry]() {
auto exists = [this,registry,j]() {
for (auto&& wcollectable : collectables_)
{
auto collectable = wcollectable.lock();
......@@ -264,7 +264,7 @@ void prometheus::Application::timeExpired(toolbox::task::TimerEvent& e)
if ( collectable == registry ) // not sure it compares the actual fired item
{
std::cout << "---found collectable" << std::endl;
std::cout << "---found already registered collectable: " << j->first << " of type: " << j->second->type() << std::endl;
return true;
}
......
......@@ -32,6 +32,10 @@ prometheus::Example::Example (xdaq::ApplicationStub* s)
counter_ = new xdata::Counter("my_counter_total", "How many times it ticks?", {{"my_counter_total_label", "value"}});
counter_->add("my_counter", {{"my_example_label", "value"}});
// create a prometheus object ( e.g. xdata::Counter )
counter2_ = new xdata::Counter("my_counter_total2", "How many times it ticks2?", {{"my_counter_total_label2", "value"}});
counter2_->add("my_counter2", {{"my_example_label2", "value"}});
xgi::framework::deferredbind(this, this, &prometheus::Example::Default, "Default");
......@@ -55,6 +59,7 @@ void prometheus::Example::timeExpired(toolbox::task::TimerEvent& e)
{
// user example update
(*counter_)["my_counter"].Increment();
(*counter_)["my_counter2"].Increment(2);
return;
}
......@@ -80,6 +85,8 @@ void prometheus::Example::actionPerformed( xdata::Event& event)
// publish counter to prometheus
is->lock();
is->fireItemAvailable("another_time_running_seconds_total", counter_);
is->fireItemAvailable("another_time_running_seconds_total2", counter2_);
is->unlock();
// activate a timer for user example
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment