> On Nov 7, 2017, at 1:39 PM, Zelkowitz, Evan <evan_zelkow...@comcast.com> > wrote: > > If that would be picked up by stats that would probably work, but seems to > generate a segv for me: > TSMgmtStringCreate(TS_RECORDTYPE_PROCESS, "my.interface.name", "default > value", > TS_RECORDUPDATE_DYNAMIC, TS_RECORDCHECK_NULL, NULL /* check_regex */, > TS_RECORDACCESS_READ_ONLY); > > traffic_server: received signal 11 (Segmentation fault: 11) > traffic_server - STACK TRACE: > 0 traffic_server 0x0000000107ef361b > _Z19crash_logger_invokeiP9__siginfoPv + 139 > 1 libsystem_platform.dylib 0x00007fff977e3b3a _sigtramp + 26 > 2 ??? 0x0000000023500180 0x0 + 592445824 > 3 traffic_server 0x0000000108201b48 > _ZN18raw_stat_sync_cont14exec_callbacksEiP5Event + 24 > 4 traffic_server 0x0000000107ef4a60 > _ZN12Continuation11handleEventEiPv + 112 > 5 traffic_server 0x0000000108206616 > _ZN7EThread13process_eventEP5Eventi + 294 > 6 traffic_server 0x0000000108206c30 > _ZN7EThread15execute_regularEv + 256 > 7 traffic_server 0x0000000108206f95 > _ZN7EThread7executeEv + 213 > 8 traffic_server 0x00000001082059ec > _ZL21spawn_thread_internalPv + 156 > 9 libsystem_pthread.dylib 0x00007fff977ed93b _pthread_body + 180 > 10 libsystem_pthread.dylib 0x00007fff977ed887 _pthread_body + 0 > 11 libsystem_pthread.dylib 0x00007fff977ed08d thread_start + 13 > > only happens with that line added, got it on both osx and linux
Bug? Though that stack trace doesn’t inspire confidence. At any rate, TSMgmtStringCreate fronts the same subsystem that TSStat (eventually) does, so this would be the right way to do it today. TSStatCreate can’t directly support string stats; we should make it check the data type and fail appropriately. FWIW, stats and configuration records are all backed by the same internal subsystem, so they are basically the same thing internally. Configuration values are either TS_RECORDTYPE_CONFIG or TS_RECORDTYPE_LOCAL; other record types are metrics. > > On 11/7/17, 10:46 AM, "James Peach" <jpe...@apache.org> wrote: > > >> On Nov 7, 2017, at 8:35 AM, Zelkowitz, Evan <evan_zelkow...@comcast.com> >> wrote: >> >> Proposing adding stat string support >> >> TSReturnCode TSStatGetString(int id, char *string, int len); >> TSReturnCode TSStatSetString(int id, char *string, int len); >> >> This way we can store stat strings for retrieval by TS stats. Some examples >> of things we currently have work arounds for are the interface name that TS >> is running on, its negotiated speed, load averages, other proc values, etc. >> >> I believe the stats will currently allow you to create a string stat, there >> is just no way to interface with it. I will create a plugin that uses the >> string functionality since the main reason of this is to be able to open >> source a currently proprietary plugin that uses this sort of functionality. > > To do this, you'd just create the record directly. > > TSMgmtStringCreate(TS_RECORDTYPE_PROCESS, "my.great.metric.name", "default > value", > TS_RECORDUPDATE_DYNAMIC, TS_RECORDCHECK_NULL, nullptr /* check_regex > */, TS_RECORDACCESS_READ_ONLY); > > J > > > >