You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm developing an ATS plugin for our company and I need few statistic counters in the plugin.
According to this page, I should use the new APIs from Metrics.h for this purpose. Correct me if I misunderstood the Note.
I glanced over the functionality in the Metrics.h and checked its usage inside the ATS core. I think, I understood how to use it.
// define the counter
ts::Metrics::Counter::AtomicType *counter_name;
...
// create/register the counter
counter_name = ts::Metrics::Counter::createPtr("the-name-of-the-counter");
...
// use the counter
ts::Metrics::Counter::increment(counter_name);
However, I'm wondering about the future binary compatibility.
So far, all of the other APIs are C functions and opaque types/pointers to hide the actual implementation.
However, this new functionality exposes lots of implementation details in the header file along with the Metrics data member.
Now if I use this functionality and for example:
my plugin is built against ATS version 10
ATS version 12 introduces some changes in the Metrics functionality which change the implementation of some of the inline functions and/or the data members of Metrics.
It seems to me, that In the above scenario the plugin may experience some UB (Undefined Behavior) effects if run along ATS version 12.
Did I misunderstood something?
Or there is no guarantee for binary compatibility between the ATS versions and I should always rebuild the plugins against the currently used ATS version?
The text was updated successfully, but these errors were encountered:
The common use case, using these APIs rather than the old APIs in ts.h (which also uses the new Metrics under the hood) would be
auto id1 = ts::Metrics::Counter::create(name);
auto id2 = ts::Metrics::Gauge::create(name);
If you want the pointer, you can get it from the id, e.g.
auto ptr1 = ts::Metrics::Counter::lookup(id1, nullptr);
auto ptr2 = ts::Metrics::Gauge::lookup(id2, nullptr);
or, you can also create them directly with createPtr() as above, e.g.
auto ptr1 = ts::Metrics::Counter::createPtr(name);
auto ptr2 = ts::Metrics::Gauge::createPtr(name);
Note that the lookup() functionalities requires locking around the lookup tables etc., so are not a good idea to do in critical code. The ID can be used to access the metric directly though, without locks, such as
static auto &instance = ts::Metrics::instance();
instance[id1].increment();
instance[id2].decrement(5);
Hi there,
I'm developing an ATS plugin for our company and I need few statistic counters in the plugin.
According to this page, I should use the new APIs from
Metrics.h
for this purpose. Correct me if I misunderstood the Note.I glanced over the functionality in the
Metrics.h
and checked its usage inside the ATS core. I think, I understood how to use it.However, I'm wondering about the future binary compatibility.
So far, all of the other APIs are C functions and opaque types/pointers to hide the actual implementation.
However, this new functionality exposes lots of implementation details in the header file along with the
Metrics
data member.Now if I use this functionality and for example:
Metrics
functionality which change the implementation of some of the inline functions and/or the data members ofMetrics
.It seems to me, that In the above scenario the plugin may experience some UB (Undefined Behavior) effects if run along ATS version 12.
Did I misunderstood something?
Or there is no guarantee for binary compatibility between the ATS versions and I should always rebuild the plugins against the currently used ATS version?
The text was updated successfully, but these errors were encountered: