const fetch = require('node-fetch');
let url = 'https://api.coralogix.com/mgmt/openapi/api/v2/events2metrics/atomic_batch_execute';
let options = {
method: 'POST',
headers: {Authorization: 'Bearer <API_KEY>', 'content-type': 'application/json'},
body: '{"requests":[{"create":{"e2m":{"name":"Service catalog latency","description":"avg and max the latency of catalog service","permutationsLimit":30000,"metricLabels":[{"targetLabel":"alias_label_name","sourceField":"log_obj.string_value"}],"metricFields":[{"targetBaseMetricName":"alias_field_name","sourceField":"log_obj.numeric_field","aggregations":[{"enabled":true,"aggType":"AGG_TYPE_UNSPECIFIED","targetMetricName":"alias_field_name_agg_func","samples":{"sampleType":"SAMPLE_TYPE_UNSPECIFIED"},"histogram":{"buckets":2}}]}],"type":"E2M_TYPE_UNSPECIFIED","spansQuery":{"lucene":"applicationName:myApp","applicationnameFilters":"myApp","subsystemnameFilters":"mySubsystem","actionFilters":"myAction","serviceFilters":"myService"},"logsQuery":{"lucene":"log_obj.numeric_field: [50 TO 100]","alias":"new_query","applicationnameFilters":"app_name","subsystemnameFilters":"sub_name","severityFilters":["SEVERITY_UNSPECIFIED"]}}},"replace":{"e2m":{"id":"d6a3658e-78d2-47d0-9b81-b2c551f01b09","name":"Service_catalog_latency","description":"avg and max the latency of catalog service","createTime":"2022-06-30T12:30:00Z\'","updateTime":"2022-06-30T12:30:00Z\'","permutations":{"limit":30000,"hasExceededLimit":true},"metricLabels":[{"targetLabel":"alias_label_name","sourceField":"log_obj.string_value"}],"metricFields":[{"targetBaseMetricName":"alias_field_name","sourceField":"log_obj.numeric_field","aggregations":[{"enabled":true,"aggType":"AGG_TYPE_UNSPECIFIED","targetMetricName":"alias_field_name_agg_func","samples":{"sampleType":"SAMPLE_TYPE_UNSPECIFIED"},"histogram":{"buckets":2}}]}],"type":"E2M_TYPE_UNSPECIFIED","spansQuery":{"lucene":"applicationName:myApp","applicationnameFilters":"myApp","subsystemnameFilters":"mySubsystem","actionFilters":"myAction","serviceFilters":"myService"},"logsQuery":{"lucene":"log_obj.numeric_field: [50 TO 100]","alias":"new_query","applicationnameFilters":"app_name","subsystemnameFilters":"sub_name","severityFilters":["SEVERITY_UNSPECIFIED"]},"isInternal":true}},"delete":{"id":"d6a3658e-78d2-47d0-9b81-b2c551f01b09"}}]}'
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));{
"matchingResponses": [
{
"created": {
"e2m": {
"name": "Service_catalog_latency",
"type": "E2M_TYPE_UNSPECIFIED",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"description": "avg and max the latency of catalog service",
"createTime": "2022-06-30T12:30:00Z'",
"updateTime": "2022-06-30T12:30:00Z'",
"permutations": {
"limit": 30000,
"hasExceededLimit": true
},
"metricLabels": [
{
"targetLabel": "alias_label_name",
"sourceField": "log_obj.string_value"
}
],
"metricFields": [
{
"targetBaseMetricName": "alias_field_name",
"sourceField": "log_obj.numeric_field",
"aggregations": [
{
"enabled": true,
"aggType": "AGG_TYPE_UNSPECIFIED",
"targetMetricName": "alias_field_name_agg_func",
"samples": {
"sampleType": "SAMPLE_TYPE_UNSPECIFIED"
},
"histogram": {
"buckets": 2
}
}
]
}
],
"spansQuery": {
"lucene": "applicationName:myApp",
"applicationnameFilters": "myApp",
"subsystemnameFilters": "mySubsystem",
"actionFilters": "myAction",
"serviceFilters": "myService"
},
"logsQuery": {
"lucene": "log_obj.numeric_field: [50 TO 100]",
"alias": "new_query",
"applicationnameFilters": "app_name",
"subsystemnameFilters": "sub_name",
"severityFilters": [
"SEVERITY_UNSPECIFIED"
]
},
"isInternal": true
}
},
"replaced": {
"e2m": {
"name": "Service_catalog_latency",
"type": "E2M_TYPE_UNSPECIFIED",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"description": "avg and max the latency of catalog service",
"createTime": "2022-06-30T12:30:00Z'",
"updateTime": "2022-06-30T12:30:00Z'",
"permutations": {
"limit": 30000,
"hasExceededLimit": true
},
"metricLabels": [
{
"targetLabel": "alias_label_name",
"sourceField": "log_obj.string_value"
}
],
"metricFields": [
{
"targetBaseMetricName": "alias_field_name",
"sourceField": "log_obj.numeric_field",
"aggregations": [
{
"enabled": true,
"aggType": "AGG_TYPE_UNSPECIFIED",
"targetMetricName": "alias_field_name_agg_func",
"samples": {
"sampleType": "SAMPLE_TYPE_UNSPECIFIED"
},
"histogram": {
"buckets": 2
}
}
]
}
],
"spansQuery": {
"lucene": "applicationName:myApp",
"applicationnameFilters": "myApp",
"subsystemnameFilters": "mySubsystem",
"actionFilters": "myAction",
"serviceFilters": "myService"
},
"logsQuery": {
"lucene": "log_obj.numeric_field: [50 TO 100]",
"alias": "new_query",
"applicationnameFilters": "app_name",
"subsystemnameFilters": "sub_name",
"severityFilters": [
"SEVERITY_UNSPECIFIED"
]
},
"isInternal": true
}
},
"deleted": {
"id": "<string>"
}
}
]
}No description available
const fetch = require('node-fetch');
let url = 'https://api.coralogix.com/mgmt/openapi/api/v2/events2metrics/atomic_batch_execute';
let options = {
method: 'POST',
headers: {Authorization: 'Bearer <API_KEY>', 'content-type': 'application/json'},
body: '{"requests":[{"create":{"e2m":{"name":"Service catalog latency","description":"avg and max the latency of catalog service","permutationsLimit":30000,"metricLabels":[{"targetLabel":"alias_label_name","sourceField":"log_obj.string_value"}],"metricFields":[{"targetBaseMetricName":"alias_field_name","sourceField":"log_obj.numeric_field","aggregations":[{"enabled":true,"aggType":"AGG_TYPE_UNSPECIFIED","targetMetricName":"alias_field_name_agg_func","samples":{"sampleType":"SAMPLE_TYPE_UNSPECIFIED"},"histogram":{"buckets":2}}]}],"type":"E2M_TYPE_UNSPECIFIED","spansQuery":{"lucene":"applicationName:myApp","applicationnameFilters":"myApp","subsystemnameFilters":"mySubsystem","actionFilters":"myAction","serviceFilters":"myService"},"logsQuery":{"lucene":"log_obj.numeric_field: [50 TO 100]","alias":"new_query","applicationnameFilters":"app_name","subsystemnameFilters":"sub_name","severityFilters":["SEVERITY_UNSPECIFIED"]}}},"replace":{"e2m":{"id":"d6a3658e-78d2-47d0-9b81-b2c551f01b09","name":"Service_catalog_latency","description":"avg and max the latency of catalog service","createTime":"2022-06-30T12:30:00Z\'","updateTime":"2022-06-30T12:30:00Z\'","permutations":{"limit":30000,"hasExceededLimit":true},"metricLabels":[{"targetLabel":"alias_label_name","sourceField":"log_obj.string_value"}],"metricFields":[{"targetBaseMetricName":"alias_field_name","sourceField":"log_obj.numeric_field","aggregations":[{"enabled":true,"aggType":"AGG_TYPE_UNSPECIFIED","targetMetricName":"alias_field_name_agg_func","samples":{"sampleType":"SAMPLE_TYPE_UNSPECIFIED"},"histogram":{"buckets":2}}]}],"type":"E2M_TYPE_UNSPECIFIED","spansQuery":{"lucene":"applicationName:myApp","applicationnameFilters":"myApp","subsystemnameFilters":"mySubsystem","actionFilters":"myAction","serviceFilters":"myService"},"logsQuery":{"lucene":"log_obj.numeric_field: [50 TO 100]","alias":"new_query","applicationnameFilters":"app_name","subsystemnameFilters":"sub_name","severityFilters":["SEVERITY_UNSPECIFIED"]},"isInternal":true}},"delete":{"id":"d6a3658e-78d2-47d0-9b81-b2c551f01b09"}}]}'
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));{
"matchingResponses": [
{
"created": {
"e2m": {
"name": "Service_catalog_latency",
"type": "E2M_TYPE_UNSPECIFIED",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"description": "avg and max the latency of catalog service",
"createTime": "2022-06-30T12:30:00Z'",
"updateTime": "2022-06-30T12:30:00Z'",
"permutations": {
"limit": 30000,
"hasExceededLimit": true
},
"metricLabels": [
{
"targetLabel": "alias_label_name",
"sourceField": "log_obj.string_value"
}
],
"metricFields": [
{
"targetBaseMetricName": "alias_field_name",
"sourceField": "log_obj.numeric_field",
"aggregations": [
{
"enabled": true,
"aggType": "AGG_TYPE_UNSPECIFIED",
"targetMetricName": "alias_field_name_agg_func",
"samples": {
"sampleType": "SAMPLE_TYPE_UNSPECIFIED"
},
"histogram": {
"buckets": 2
}
}
]
}
],
"spansQuery": {
"lucene": "applicationName:myApp",
"applicationnameFilters": "myApp",
"subsystemnameFilters": "mySubsystem",
"actionFilters": "myAction",
"serviceFilters": "myService"
},
"logsQuery": {
"lucene": "log_obj.numeric_field: [50 TO 100]",
"alias": "new_query",
"applicationnameFilters": "app_name",
"subsystemnameFilters": "sub_name",
"severityFilters": [
"SEVERITY_UNSPECIFIED"
]
},
"isInternal": true
}
},
"replaced": {
"e2m": {
"name": "Service_catalog_latency",
"type": "E2M_TYPE_UNSPECIFIED",
"id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
"description": "avg and max the latency of catalog service",
"createTime": "2022-06-30T12:30:00Z'",
"updateTime": "2022-06-30T12:30:00Z'",
"permutations": {
"limit": 30000,
"hasExceededLimit": true
},
"metricLabels": [
{
"targetLabel": "alias_label_name",
"sourceField": "log_obj.string_value"
}
],
"metricFields": [
{
"targetBaseMetricName": "alias_field_name",
"sourceField": "log_obj.numeric_field",
"aggregations": [
{
"enabled": true,
"aggType": "AGG_TYPE_UNSPECIFIED",
"targetMetricName": "alias_field_name_agg_func",
"samples": {
"sampleType": "SAMPLE_TYPE_UNSPECIFIED"
},
"histogram": {
"buckets": 2
}
}
]
}
],
"spansQuery": {
"lucene": "applicationName:myApp",
"applicationnameFilters": "myApp",
"subsystemnameFilters": "mySubsystem",
"actionFilters": "myAction",
"serviceFilters": "myService"
},
"logsQuery": {
"lucene": "log_obj.numeric_field: [50 TO 100]",
"alias": "new_query",
"applicationnameFilters": "app_name",
"subsystemnameFilters": "sub_name",
"severityFilters": [
"SEVERITY_UNSPECIFIED"
]
},
"isInternal": true
}
},
"deleted": {
"id": "<string>"
}
}
]
}API key authentication
Show child attributes
This is used to create a new event to metric definition
Show child attributes
This data structure is used to create a new event to metric definition
Show child attributes
"Service catalog latency"
"avg and max the latency of catalog service"
30000
Show child attributes
"alias_field_name"
"log_obj.numeric_field"
Show child attributes
AGG_TYPE_UNSPECIFIED, AGG_TYPE_MIN, AGG_TYPE_MAX, AGG_TYPE_COUNT, AGG_TYPE_AVG, AGG_TYPE_SUM, AGG_TYPE_HISTOGRAM, AGG_TYPE_SAMPLES "alias_field_name_agg_func"
This data structure represents the e2m aggregate samples
Show child attributes
SAMPLE_TYPE_UNSPECIFIED, SAMPLE_TYPE_MIN, SAMPLE_TYPE_MAX E2M_TYPE_UNSPECIFIED, E2M_TYPE_LOGS2METRICS, E2M_TYPE_SPANS2METRICS This data structure represents a query for spans.
Show child attributes
"applicationName:myApp"
"myApp"
"mySubsystem"
"myAction"
"myService"
This data structure represents a query for logs.
Show child attributes
"log_obj.numeric_field: [50 TO 100]"
"new_query"
"app_name"
"sub_name"
SEVERITY_UNSPECIFIED, SEVERITY_DEBUG, SEVERITY_VERBOSE, SEVERITY_INFO, SEVERITY_WARNING, SEVERITY_ERROR, SEVERITY_CRITICAL This data structure is used to replace an existing event to metric definition
Show child attributes
This data structure represents an Event to Metrics (E2M) object.
Show child attributes
"Service_catalog_latency"
E2M_TYPE_UNSPECIFIED, E2M_TYPE_LOGS2METRICS, E2M_TYPE_SPANS2METRICS 36"d6a3658e-78d2-47d0-9b81-b2c551f01b09"
"avg and max the latency of catalog service"
"2022-06-30T12:30:00Z'"
"2022-06-30T12:30:00Z'"
10Show child attributes
"alias_field_name"
"log_obj.numeric_field"
Show child attributes
AGG_TYPE_UNSPECIFIED, AGG_TYPE_MIN, AGG_TYPE_MAX, AGG_TYPE_COUNT, AGG_TYPE_AVG, AGG_TYPE_SUM, AGG_TYPE_HISTOGRAM, AGG_TYPE_SAMPLES "alias_field_name_agg_func"
This data structure represents the e2m aggregate samples
Show child attributes
SAMPLE_TYPE_UNSPECIFIED, SAMPLE_TYPE_MIN, SAMPLE_TYPE_MAX This data structure represents a query for spans.
Show child attributes
"applicationName:myApp"
"myApp"
"mySubsystem"
"myAction"
"myService"
This data structure represents a query for logs.
Show child attributes
"log_obj.numeric_field: [50 TO 100]"
"new_query"
"app_name"
"sub_name"
SEVERITY_UNSPECIFIED, SEVERITY_DEBUG, SEVERITY_VERBOSE, SEVERITY_INFO, SEVERITY_WARNING, SEVERITY_ERROR, SEVERITY_CRITICAL A successful response.
Show child attributes
Show child attributes
This data structure represents an Event to Metrics (E2M) object.
Show child attributes
"Service_catalog_latency"
E2M_TYPE_UNSPECIFIED, E2M_TYPE_LOGS2METRICS, E2M_TYPE_SPANS2METRICS 36"d6a3658e-78d2-47d0-9b81-b2c551f01b09"
"avg and max the latency of catalog service"
"2022-06-30T12:30:00Z'"
"2022-06-30T12:30:00Z'"
10Show child attributes
"alias_field_name"
"log_obj.numeric_field"
Show child attributes
AGG_TYPE_UNSPECIFIED, AGG_TYPE_MIN, AGG_TYPE_MAX, AGG_TYPE_COUNT, AGG_TYPE_AVG, AGG_TYPE_SUM, AGG_TYPE_HISTOGRAM, AGG_TYPE_SAMPLES "alias_field_name_agg_func"
This data structure represents the e2m aggregate samples
Show child attributes
SAMPLE_TYPE_UNSPECIFIED, SAMPLE_TYPE_MIN, SAMPLE_TYPE_MAX This data structure represents a query for spans.
Show child attributes
"applicationName:myApp"
"myApp"
"mySubsystem"
"myAction"
"myService"
This data structure represents a query for logs.
Show child attributes
"log_obj.numeric_field: [50 TO 100]"
"new_query"
"app_name"
"sub_name"
SEVERITY_UNSPECIFIED, SEVERITY_DEBUG, SEVERITY_VERBOSE, SEVERITY_INFO, SEVERITY_WARNING, SEVERITY_ERROR, SEVERITY_CRITICAL This data structure is obtained when replacing an existing event to metric definition
Show child attributes
This data structure represents an Event to Metrics (E2M) object.
Show child attributes
"Service_catalog_latency"
E2M_TYPE_UNSPECIFIED, E2M_TYPE_LOGS2METRICS, E2M_TYPE_SPANS2METRICS 36"d6a3658e-78d2-47d0-9b81-b2c551f01b09"
"avg and max the latency of catalog service"
"2022-06-30T12:30:00Z'"
"2022-06-30T12:30:00Z'"
10Show child attributes
"alias_field_name"
"log_obj.numeric_field"
Show child attributes
AGG_TYPE_UNSPECIFIED, AGG_TYPE_MIN, AGG_TYPE_MAX, AGG_TYPE_COUNT, AGG_TYPE_AVG, AGG_TYPE_SUM, AGG_TYPE_HISTOGRAM, AGG_TYPE_SAMPLES "alias_field_name_agg_func"
This data structure represents the e2m aggregate samples
Show child attributes
SAMPLE_TYPE_UNSPECIFIED, SAMPLE_TYPE_MIN, SAMPLE_TYPE_MAX This data structure represents a query for spans.
Show child attributes
"applicationName:myApp"
"myApp"
"mySubsystem"
"myAction"
"myService"
This data structure represents a query for logs.
Show child attributes
"log_obj.numeric_field: [50 TO 100]"
"new_query"
"app_name"
"sub_name"
SEVERITY_UNSPECIFIED, SEVERITY_DEBUG, SEVERITY_VERBOSE, SEVERITY_INFO, SEVERITY_WARNING, SEVERITY_ERROR, SEVERITY_CRITICAL Was this page helpful?