Skip to content

Commit d307035

Browse files
committed
refactor tag
1 parent c6b2a34 commit d307035

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

src/toddog.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ char *metrictoddog(
1919
char *tmp;
2020
short len;
2121
char* themetric; // to store the metric we will send to datadog
22-
char* thekind; // to store the kind we will send to datadog
2322

2423
// Check for null inputs
25-
if (name_i == OCI_IND_NULL)
24+
if ( (name_i == OCI_IND_NULL) || (metric_i == OCI_IND_NULL) || (kind_i == OCI_IND_NULL) )
2625
{
2726
*ret_i = (short)OCI_IND_NULL;
2827

@@ -34,21 +33,7 @@ char *metrictoddog(
3433
}
3534

3635
// the main part
37-
38-
if (kind_i == OCI_IND_NOTNULL)
39-
{
40-
asprintf(&thekind,"%s",kind);
41-
} else {
42-
asprintf(&thekind,"%s","g"); // no kind, we default to gauge
43-
}
44-
45-
if (tag_i == OCI_IND_NOTNULL)
46-
{
47-
asprintf(&themetric,"%s:%d|%s|#%s",name, metric, thekind,tag);
48-
} else {
49-
asprintf(&themetric,"%s:%d|%s|",name, metric, thekind);
50-
}
51-
36+
asprintf(&themetric,"%s:%d|%s|#%s",name, metric, kind,tag);
5237
udp(8125, themetric); // we fire the metric to datadog
5338

5439
// the reply part
@@ -102,7 +87,6 @@ char *eventtoddog(
10287
// the main part
10388

10489
asprintf(&theevent,"_e{%d,%d}:%s|%s|#%s",strlen(title),strlen(text),title,text,tag);
105-
10690
udp(8125, theevent);
10791

10892
// the reply part

0 commit comments

Comments
 (0)