Skip to main content
node
const fetch = require('node-fetch');

let url = 'https://api.coralogix.com/mgmt/openapi/events2metrics/events2metrics/v2';

let options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <API_KEY>', 'content-type': 'application/json'},
  body: '{"createTime":"2022-06-30T12:30:00Z\'","description":"avg and max the latency of catalog service","id":"d6a3658e-78d2-47d0-9b81-b2c551f01b09","isInternal":true,"metricFields":[{"aggregations":[{"aggType":"AGG_TYPE_UNSPECIFIED","enabled":true,"samples":{"sampleType":"SAMPLE_TYPE_UNSPECIFIED"},"targetMetricName":"alias_field_name_agg_func"}],"sourceField":"log_obj.numeric_field","targetBaseMetricName":"alias_field_name"}],"metricLabels":[{"sourceField":"log_obj.string_value","targetLabel":"alias_label_name"}],"name":"Service_catalog_latency","permutations":{"hasExceededLimit":true,"limit":30000},"spansQuery":{"actionFilters":["myAction"],"applicationnameFilters":["myApp"],"lucene":"applicationName:myApp","serviceFilters":["myService"],"subsystemnameFilters":["mySubsystem"]},"type":"E2M_TYPE_UNSPECIFIED","updateTime":"2022-06-30T12:30:00Z\'"}'
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));
{
  "e2m": {
    "createTime": "2022-06-30T12:30:00Z'",
    "description": "avg and max the latency of catalog service",
    "id": "d6a3658e-78d2-47d0-9b81-b2c551f01b09",
    "isInternal": true,
    "metricFields": [
      {
        "aggregations": [
          {
            "aggType": "AGG_TYPE_UNSPECIFIED",
            "enabled": true,
            "samples": {
              "sampleType": "<any>"
            },
            "targetMetricName": "alias_field_name_agg_func"
          }
        ],
        "sourceField": "log_obj.numeric_field",
        "targetBaseMetricName": "alias_field_name"
      }
    ],
    "metricLabels": [
      {
        "sourceField": "log_obj.string_value",
        "targetLabel": "alias_label_name"
      }
    ],
    "name": "Service_catalog_latency",
    "permutations": {
      "hasExceededLimit": true,
      "limit": 30000
    },
    "spansQuery": {
      "actionFilters": [
        "myAction"
      ],
      "applicationnameFilters": [
        "myApp"
      ],
      "lucene": "applicationName:myApp",
      "serviceFilters": [
        "myService"
      ],
      "subsystemnameFilters": [
        "mySubsystem"
      ]
    },
    "type": "E2M_TYPE_UNSPECIFIED",
    "updateTime": "2022-06-30T12:30:00Z'"
  }
}

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json
  • E2M
  • E2M

This data structure represents an Event to Metrics (E2M) object.

name
string
required
Example:

"Service_catalog_latency"

type
enum<string>
required
Available options:
E2M_TYPE_UNSPECIFIED,
E2M_TYPE_LOGS2METRICS,
E2M_TYPE_SPANS2METRICS
createTime
string
Example:

"2022-06-30T12:30:00Z'"

description
string
Example:

"avg and max the latency of catalog service"

id
string
Required string length: 36
Example:

"d6a3658e-78d2-47d0-9b81-b2c551f01b09"

isInternal
boolean
metricFields
Metric Field · object[]
metricLabels
Metric Label · object[]
permutations
object

This data structure represents the limit of events2metrics permutations and if the limit was exceeded

spansQuery
object

This data structure represents a query for spans.

updateTime
string
Example:

"2022-06-30T12:30:00Z'"

Response

200 - application/json

This data structure is obtained when replacing an existing event to metric definition

e2m
object
required

This data structure represents an Event to Metrics (E2M) object.

  • E2M
  • E2M
I