我具有以下发布数据狗指标的功能
int PublishMetric(Metric* metric)
{
printf("Sending metric to datadog metric: %s value: %.2f\n",metric->metricName,metric->value);
DogFood::Tags datadogTags;
for (int idx=0; idx<metric->numOfTags; idx++)
{
datadogTags[metric->tags[idx].tagName] = metric->tags[idx].tagValue;
}
DogFood::Metric(
metric->metricName,metric->value,(DogFood::Type)metric->metricType,1,datadogTags
);
}
我现在正在尝试对其进行更改,以使其通过套接字,如下页所示:
UDS-Unix域套接字(自定义)下的https://github.com/garrettsickles/DogFood。
现在函数看起来像这样:
int PublishMetric(Metric* metric)
{
printf("Sending metric to datadog metric: %s value: %.2f\n",metric->value);
DogFood::Tags datadogTags;
for (int idx=0; idx<metric->numOfTags; idx++)
{
datadogTags[metric->tags[idx].tagName] = metric->tags[idx].tagValue;
}
DogFood::Send(
DogFood::Metric(
metric->metricName,datadogTags
),DogFood::UDS("/var/run/datadog/dsd.socket")
);
}
当我尝试编译它时,出现“不是成员”错误。我怎样才能将它们作为成员?
/TCP_Server/src/DatadogAdapter/DatadogAdapter.cpp: In function 'int PublishMetric(Metric*)':
/TCP_Server/src/DatadogAdapter/DatadogAdapter.cpp:30:14: error: 'Send' is not a member of 'DogFood'
DogFood::Send(
^~~~
/TCP_Server/src/DatadogAdapter/DatadogAdapter.cpp:30:14: note: suggested alternative: 'Set'
DogFood::Send(
^~~~
Set
/TCP_Server/src/DatadogAdapter/DatadogAdapter.cpp:38:18: error: 'UDS' is not a member of 'DogFood'
DogFood::UDS("/var/run/datadog/dsd.socket")
^~~
make[2]: *** [src/DatadogAdapter/CMakeFiles/DatadogAdapter.dir/DatadogAdapter.cpp.o] Error 1