Quantcast
Channel: Compass - The Atlassian Developer Community
Viewing all articles
Browse latest Browse all 30

Data provider events not being saved

$
0
0

I’m working on a Forge app with a data provider which will ingest incidents and alerts from New Relic into Compass.

I have followed the tutorials and reviewed the example code in the sample Statuspage repo.

I can’t see any errors or any obvious problems, but when adding a New Relic link, I don’t have any incident events recorded in my Compass component. For now I’m using a hard-coded DataProviderIncidentEvent object just to get everything all wired up correctly. Code details and behaviour as follows.

Snippet from my data provider function:

const response = new DataProviderResponse(nrLink.entityGuid, {
    eventTypes: [DataProviderEventTypes.INCIDENTS, DataProviderEventTypes.ALERTS],
    builtInMetricDefinitions: [ BuiltinMetricDefinitions.AVAILABILITY_28D,
      BuiltinMetricDefinitions.CHANGE_FAILURE_RATE_28D,
      BuiltinMetricDefinitions.INCIDENT_COUNT_28D,
      BuiltinMetricDefinitions.MTTR_LAST_10,
      BuiltinMetricDefinitions.RELIABILITY_28D
     ]
  });

  const testIncident = {
    displayName: 'Test Incident',
    description: 'Hard coded incident',
    lastUpdated: 1705276975141,
    updateSequenceNumber: 1702766907438,
    url: 'https://onenr.io/foo',
    id: '3564ffe9-9f6e-460d-8800-3583b2fbae67',
    state: CompassIncidentEventState.Resolved,
    severity: {
      label: 'MEDIUM',
      level: CompassIncidentEventSeverityLevel.Three,
    },
    startTime: 1705276255051,
    endTime: 1705276975141,
  };
  
  console.log('Adding test incident event', JSON.stringify(testIncident)); // TODO: update to add real incidents array
  response.addIncidents([ testIncident ]);

  const responsePayload = response.build();
  console.log('Response payload check', responsePayload, responsePayload.events.incidents);
  return responsePayload;

If I add a link to a New Relic dashboard, I can see the following:

  • Link is decorated with the “data connection” status and shows it’s configured to send incidents and alerts to the activity feed
  • Appropriate metric panels have been added to the Component overview
  • Log outputs show the expected log lines and no errors, the response payload definitely includes the test incident object in an array
  • Data provider callback function is not reporting an error

However, I cannot see:

  • Test Incident doesn’t appear in the Activity feed
  • I don’t see any record of the event via GraphQL query, either

Maybe I’m missing something with the correct format of the DataProviderIncidentEvent? I have double checked that I’ve copied this correctly from the sample app and checked the type definition from the forge-graphql package and can’t spot anything glaringly wrong.

Any help would be greatly appreciated!

3 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 30

Latest Images

Trending Articles



Latest Images