Skip to content

Add datadog lib#4

Open
DHopkinson-DI wants to merge 27 commits intomainfrom
add_datadog_lib
Open

Add datadog lib#4
DHopkinson-DI wants to merge 27 commits intomainfrom
add_datadog_lib

Conversation

@DHopkinson-DI
Copy link
Contributor

Based on TorQ's datadog.q script
All funcs tested on q 4.1 on homer (Linux)
All funcs tested on q 4.1 locally (Windows 11)

@DHopkinson-DI DHopkinson-DI self-assigned this Jul 15, 2025
Co-authored-by: Jonathon McMurray <jonathon.mcmurray@aquaq.co.uk>
j-muldoon and others added 11 commits November 18, 2025 10:01
Co-authored-by: Joseph Muldoon <joseph.muldoon@dataintellect.com>
Co-authored-by: Ben Lord <ben.lord@dataintellect.com>
Example json objects (adapted from datadog docs) have been added in corresponding files. (These will of course be removed eventually and are just for reverse engineering the dictionary formats to go into .j.j)
opsys:.z.o;


/eventtitle,eventtext,eventdate,hostname,priority,alerttype,tags,aggregation_key,source_type_name,related_event_id,device,category,cr_name,cr_type,integration_id,message,timestamp,change_metadata,new_value,prev_value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

if[(first baseurlversion)=`v2;(
if[(`$category)=`$"alert";
json:.j.j(enlist`data)!enlist(`attributes`type!(enlist(`aggregation_key`attributes`category`integration_id`message`tags`timestamp`title!(aggregation_key;enlist(`custom`links`priority`status!(custom;enlist(`category`title`url!(linkcategory;linktitle;linkurl));priority;status));category;integration_id;message;tags;timestamp;title);alerttype)))];
/ if[(`$category)=`$"change";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't leave commented out code, if this isn't needed, remove it

};

/ the following two functions are used to push data to datadog through https post using .Q.hp
/ the following two functions are used to push data to datadog through https post usSingSS .Q.hp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seem to be a few extra Ss in this comment

metriclog,:(.z.p;.z.h;metric;metricname;`float$metricvalue;0b;response);
win.sendmetric:{[(pars!args):metfilter]
leaders:([metricname:"";metricvalue:":";metrictype:"|";samplerate:"|@";tags:"|#"]);
(metricname;metricvalue):args 0 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this assumes that metricname & metricvalue are first two keys of dictionary passed in, do we want to enforce that?

Comment on lines +56 to +59
if[useweb;(requiredpars:`metric`points;optionalpars:`interval`tags`type)];
if[useweb;(
if[(first baseurlversion)=`v1;optionalpars,:`host];
if[(first baseurlversion)=`v2;optionalpars,:`unit`source_typename`resource_name`resource_type`origin_metric_type`origin_product`origin_service])];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if[useweb;(requiredpars:`metric`points;optionalpars:`interval`tags`type)];
if[useweb;(
if[(first baseurlversion)=`v1;optionalpars,:`host];
if[(first baseurlversion)=`v2;optionalpars,:`unit`source_typename`resource_name`resource_type`origin_metric_type`origin_product`origin_service])];
if[useweb;requiredpars:`metric`points;optionalpars:`interval`tags`type;
if[(first baseurlversion)=`v1;optionalpars,:`host];
if[(first baseurlversion)=`v2;optionalpars,:`unit`source_typename`resource_name`resource_type`origin_metric_type`origin_product`origin_service]
];

I think this is the same, with less unnecessary brackets etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants