cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Davis Forcast Issue in raising violation event

amita
Participant

We are trying to raise violation event using Davis Forecaster in Workflow.

However getting below error for violation task "An error of type UNCAUGHT_EXCEPTION occurred in an imported library: 400: Constraints violated.
at EventsClient.createEvent (file:///opt/sdk_modules/@dynatrace-sdk/client-classic-environment-v2/esm/index.js:9655:17)
at eventLoopTick (ext:core/01_core.js:169:"

Below is the "violation event" task code

import { eventsClient, EventIngestEventType } from "@dynatrace-sdk/client-classic-environment-v2";
import { execution } from '@dynatrace-sdk/automation-utils';

export default async function ({ execution_id }) {
const exe = await execution(execution_id);
const checkResult = await exe.result('check_prediction');
const violations = await checkResult.violations;
// Raise an event for each violation
violations.forEach(function (violation) {
eventsClient.createEvent({
body : {
eventType: EventIngestEventType.ResourceContentionEvent,
title: 'Custom Dummy Problem for Demo(kindlyignore)',
entitySelector: 'type(MEMORY),entityId("' + violation['dt.runtime.jvm.memory.free'] + '")',
properties: {
'dt.entity.process_group_instance' : violation['dt.entity.process_group_instance']
}
}
});
});
};

The DQL is timeseries exhausted_memory=avg(dt.runtime.jvm.memory.free) , by: { dt.entity.process_group_instance } , filter: { dt.entity.process_group_instance=="PROCESS_GROUP_INSTANCE-ID"}

 

Let us know if something is missing or need to change here

Thanks in Advance

 

Regards

Amita

4 REPLIES 4

SarahFaustmann
Dynatrace Helper
Dynatrace Helper

Hi @amita,

It's possible that the body has misconfigured information, which would result in a 400 range error (bad request). You could try an API development tool such as Insomnia or Postman to ensure that communication to the endpoint is working as expected. Have you checked out the guide for ingesting Davis events yet? It includes an example of ingesting events.

Kind regards,
Sarah

Roberto_Tonino
Dynatrace Enthusiast
Dynatrace Enthusiast

Hi @amita ,

to get more information, can you try to wrap the "eventsClient.createEvent" code in a try/catch block? You can find more information and examples in the docs: https://developer.dynatrace.com/preview/reference/sdks/#error-handling

PennyScully
Dynatrace Helper
Dynatrace Helper

Hi @amita - I hope the above answers were help you to solve your issue, if so, please 'accept as solution', to help us close this community question. 
Thanks, Penny 

amita
Participant

Thanks for the suggestions .Will try and get back to you incase of any query.

 

 

Amita

Featured Posts