Skip to content

Commit

Permalink
fix cmake and doc for pullclient
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-c committed May 22, 2024
1 parent dc349d0 commit 3712a28
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ foreach (example ${EXAMPLES})
target_link_libraries(${example_name}
PRIVATE
Monitoring Boost::program_options
$<$<BOOL:${CURL_FOUND}>:CURL::libcurl>
)
endforeach()

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,18 @@ for (;;) {
auto metrics = client->pull();
if (!metrics.empty()) {
/// metric.first => topic name; metric.second => metric itself
} else {
// wait a bit if no data available
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
```
Run-time parameters:
- `<topic-to-subscribe>` - List of topics to subscribe
- `<kafka-server:9092>` - Kafka broker (staging or production)
- `<client_id>` - unique, self-explainable string describing the client, eg. `dcs-link-status` or `its-link-status`.
Metrics are returned in batch of maximum 100 for each pull() call.
### Data format
Native data format is [Influx Line Protocol](https://docs.influxdata.com/influxdb/latest/reference/syntax/line-protocol/) but metrics can be converted into any format listed in here: https://docs.influxdata.com/telegraf/latest/data_formats/output/
5 changes: 4 additions & 1 deletion examples/13-PullClient.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ using namespace o2::monitoring;

int main()
{
int ix=0;
/// List of topics to subscribe
std::vector<std::string> topics = {"cru.link_status"};
/// Connect to server
Expand All @@ -21,7 +22,9 @@ int main()
/// metric sample: link,serialId=983,endpoint=1,CRU=1,id=11,type=CRU pciAddress="b0:00.0",status=1i 1673940809860009855
std::cout << metric.second << std::endl;
}
} else {
// wait a bit if no data available
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}

0 comments on commit 3712a28

Please sign in to comment.