From 76477159ecdfd36315d0f2f8f0d7b1edc7eedffd Mon Sep 17 00:00:00 2001 From: jeffj6123 Date: Mon, 23 May 2022 10:23:47 -0700 Subject: [PATCH 1/3] container process exited events. --- .../Models/eventstore/timelineGenerators.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/SfxWeb/src/app/Models/eventstore/timelineGenerators.ts b/src/SfxWeb/src/app/Models/eventstore/timelineGenerators.ts index 1601608ee..960b1de0f 100644 --- a/src/SfxWeb/src/app/Models/eventstore/timelineGenerators.ts +++ b/src/SfxWeb/src/app/Models/eventstore/timelineGenerators.ts @@ -455,6 +455,7 @@ export class ApplicationTimelineGenerator extends TimeLineGeneratorBase(); @@ -464,6 +465,7 @@ export class ApplicationTimelineGenerator extends TimeLineGeneratorBase = {}; const processExitedGroups: Record = {}; + const containerExitedGroups: Record = {}; events.forEach( event => { // we want the oldest upgrade started before finding any previousApplicationUpgrade @@ -477,6 +479,8 @@ export class ApplicationTimelineGenerator extends TimeLineGeneratorBase { + nestedContainerProcessExited.nestedGroups.push(groupName); + groups.add(containerExitedGroups[groupName]); + }); + + groups.add(nestedContainerProcessExited); + return { groups, items @@ -542,6 +559,25 @@ export class ApplicationTimelineGenerator extends TimeLineGeneratorBase, processExitedGroups: Record) { + + const groupLabel = `${event.eventProperties.ServicePackageName}`; + processExitedGroups[groupLabel] = {id: groupLabel, content: groupLabel}; + + const start = event.timeStamp; + const label = event.eventProperties.ExeName; + + items.add({ + id: event.eventInstanceId + label, + content: '', + start, + group: groupLabel, + type: 'point', + className: event.eventProperties.UnexpectedTermination ? 'red-point' : 'green-point', + title: EventStoreUtils.tooltipFormat(event.eventProperties, event.timeStamp), + }); + } } export class PartitionTimelineGenerator extends TimeLineGeneratorBase { From 11cb795dbf753f2f3ae7b604a3d313edf5316d3d Mon Sep 17 00:00:00 2001 From: jeffj6123 Date: Tue, 24 May 2022 09:05:42 -0700 Subject: [PATCH 2/3] added a test for new event. --- .../eventstore/timelineGenerator.spec.ts | 47 +++++++++++++++++-- .../Models/eventstore/timelineGenerators.ts | 3 +- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/SfxWeb/src/app/Models/eventstore/timelineGenerator.spec.ts b/src/SfxWeb/src/app/Models/eventstore/timelineGenerator.spec.ts index a9b157bc4..dc006207a 100644 --- a/src/SfxWeb/src/app/Models/eventstore/timelineGenerator.spec.ts +++ b/src/SfxWeb/src/app/Models/eventstore/timelineGenerator.spec.ts @@ -1,5 +1,5 @@ -import { NodeTimelineGenerator, EventStoreUtils } from './timelineGenerators'; -import { NodeEvent } from './Events'; +import { NodeTimelineGenerator, EventStoreUtils, ApplicationTimelineGenerator } from './timelineGenerators'; +import { ApplicationEvent, NodeEvent } from './Events'; describe('TimelineGenerators', () => { @@ -215,5 +215,46 @@ describe('TimelineGenerators', () => { expect(events.potentiallyMissingEvents).toBeFalse(); }); }); - }); + + describe('Application', () => { + + const generator = new ApplicationTimelineGenerator(); + + fit('container exit', () => { + const endDateRange = new Date('2020-10-17T05:41:22.8992645Z'); + + const containerExitEvent = new ApplicationEvent(); + containerExitEvent.fillFromJSON({ + "ServiceName": "fabric:/test", + "ServicePackageName": "test.HostPkg", + "ServicePackageActivationId": "b8505a1e-ac6f-43be-a76a-bc4652c98975", + "IsExclusive": true, + "CodePackageName": "Code", + "EntryPointType": "ContainerHost", + "ImageName": "somecontainer.net/image", + "ContainerName": "b8505a1e-ac6f-43be-a76a-bc4652c98975", + "HostId": "ffa6bc13-b8a2-44e8-8a00-fe707c9b63d7", + "ExitCode": 7147, + "UnexpectedTermination": false, + "StartTime": "2022-05-18T16:42:13Z", + "ExitReason": "The process/container terminated with exit code:7147. Restarting the container because HEALTHCHECK for Docker container ContainerName=-a76a-bc4652c98975, reported health_status=unhealthy, TimeStamp=2022-05-23 12:43:48.000.. For information about common termination errors, please visit https://aka.ms/service-fabric-termination-errors", + "ApplicationId": "testapp", + "Kind": "ApplicationContainerInstanceExited", + "EventInstanceId": "0dbbfb66-5e0c-40f0-af6b-249ffb4d5770", + "TimeStamp": "2022-05-23T12:44:30.929434Z", + "Category": "StateTransition", + "HasCorrelatedEvents": false + }) + + const data = [containerExitEvent]; + const events = generator.consume(data, startDate, endDateRange); + console.log(events) + + expect(events.items.length).toBe(1); + expect(events.potentiallyMissingEvents).toBeFalse(); + }); + }) + +}); + diff --git a/src/SfxWeb/src/app/Models/eventstore/timelineGenerators.ts b/src/SfxWeb/src/app/Models/eventstore/timelineGenerators.ts index 960b1de0f..2e67d5eaa 100644 --- a/src/SfxWeb/src/app/Models/eventstore/timelineGenerators.ts +++ b/src/SfxWeb/src/app/Models/eventstore/timelineGenerators.ts @@ -536,7 +536,8 @@ export class ApplicationTimelineGenerator extends TimeLineGeneratorBase Date: Tue, 24 May 2022 09:14:28 -0700 Subject: [PATCH 3/3] removed console.log --- src/SfxWeb/src/app/Models/eventstore/timelineGenerator.spec.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/SfxWeb/src/app/Models/eventstore/timelineGenerator.spec.ts b/src/SfxWeb/src/app/Models/eventstore/timelineGenerator.spec.ts index dc006207a..f3e9fe40c 100644 --- a/src/SfxWeb/src/app/Models/eventstore/timelineGenerator.spec.ts +++ b/src/SfxWeb/src/app/Models/eventstore/timelineGenerator.spec.ts @@ -248,8 +248,6 @@ describe('TimelineGenerators', () => { const data = [containerExitEvent]; const events = generator.consume(data, startDate, endDateRange); - console.log(events) - expect(events.items.length).toBe(1); expect(events.potentiallyMissingEvents).toBeFalse(); });