Skip to content

Commit 3712a28

Browse files
committed
fix cmake and doc for pullclient
1 parent dc349d0 commit 3712a28

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ foreach (example ${EXAMPLES})
248248
target_link_libraries(${example_name}
249249
PRIVATE
250250
Monitoring Boost::program_options
251+
$<$<BOOL:${CURL_FOUND}>:CURL::libcurl>
251252
)
252253
endforeach()
253254

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,18 @@ for (;;) {
250250
auto metrics = client->pull();
251251
if (!metrics.empty()) {
252252
/// metric.first => topic name; metric.second => metric itself
253+
} else {
254+
// wait a bit if no data available
255+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
253256
}
254-
std::this_thread::sleep_for(std::chrono::milliseconds(100));
255-
}
256257
```
257258
258259
Run-time parameters:
259260
- `<topic-to-subscribe>` - List of topics to subscribe
260261
- `<kafka-server:9092>` - Kafka broker (staging or production)
261262
- `<client_id>` - unique, self-explainable string describing the client, eg. `dcs-link-status` or `its-link-status`.
262263
264+
Metrics are returned in batch of maximum 100 for each pull() call.
265+
263266
### Data format
264267
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/

examples/13-PullClient.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ using namespace o2::monitoring;
99

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

0 commit comments

Comments
 (0)