forked from xndlnk/microservice-visualization
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made annotation analyzer configurable and moved to custom analyzer ex…
…ample
- Loading branch information
Showing
9 changed files
with
106 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# TADIS - Tool for Architecture Discovery | ||
|
||
- [tadis-analyzer](sources/tadis-analyzer) - analyzer backend | ||
- [tadis-analyzer-custom-example](sources/tadis-analyzer-custom-example) - example customization of tadis-analyzer | ||
- [tadis-viewer-d3](sources/tadis-viewer-d3) - web-frontend based on D3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 63 additions & 3 deletions
66
sources/acmi-analyzer-custom-example/src/CustomCollector.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,74 @@ | ||
import { Injectable } from '@nestjs/common' | ||
import { System, MicroService } from 'acmi-analyzer' | ||
|
||
import { | ||
System, MicroService, Metadata, KubernetesCollectorService, RabbitMqCollectorService, | ||
FeignClientsFromSourceCodeProducer, AnnotationAnalyzer, SourceLocationDecorator, | ||
ExcludedNodesRemover, MicroserviceWithMessageExchangeMerger, CabinetTransformer, ElementMapping, GitStorageService, ConfigService | ||
} from 'acmi-analyzer' | ||
|
||
@Injectable() | ||
export class CustomCollectorService { | ||
|
||
constructor( | ||
private readonly kubernetesCollector: KubernetesCollectorService, | ||
private readonly rabbitMqCollector: RabbitMqCollectorService, | ||
private readonly feignClientsFromSourceCodeProducer: FeignClientsFromSourceCodeProducer, | ||
private readonly annotationAnalyzer: AnnotationAnalyzer, | ||
private readonly sourceLocationDecorator: SourceLocationDecorator, | ||
private readonly excludedNodesRemover: ExcludedNodesRemover, | ||
private readonly microserviceWithMessageExchangeMerger: MicroserviceWithMessageExchangeMerger, | ||
private readonly cabinetTransformer: CabinetTransformer, | ||
private readonly gitStorage: GitStorageService, | ||
private readonly configService: ConfigService | ||
) { } | ||
|
||
public async getAllMicroservices(): Promise<MicroService[]> { | ||
return [] | ||
return this.kubernetesCollector.getAllMicroservices() | ||
} | ||
|
||
public async getSystem(): Promise<System> { | ||
return new System('my') | ||
let system = new System('') | ||
|
||
system = await this.getAllMicroservicesFromSourceFolder() | ||
// system = await this.kubernetesCollector.transform(system) | ||
// system = await this.rabbitMqCollector.transform(system) | ||
|
||
system = await this.feignClientsFromSourceCodeProducer.transform(system) | ||
|
||
const elementMappings: ElementMapping[] = [ | ||
{ | ||
elementName: 'sendToExchange', | ||
nodeTypeToCreate: 'MessageExchange', | ||
nodeTypeDirection: 'target', | ||
edgeType: 'AsyncEventFlow' | ||
}, | ||
{ | ||
elementName: 'receiveFromExchange', | ||
nodeTypeToCreate: 'MessageExchange', | ||
nodeTypeDirection: 'source', | ||
edgeType: 'AsyncEventFlow' | ||
} | ||
] | ||
system = await this.annotationAnalyzer.transform(system, 'EventProcessor', elementMappings) | ||
system = await this.sourceLocationDecorator.transform(system) | ||
|
||
system = await this.excludedNodesRemover.transform(system) | ||
system = await this.microserviceWithMessageExchangeMerger.transform(system) | ||
system = await this.cabinetTransformer.transform(system) | ||
|
||
return system | ||
} | ||
|
||
private async getAllMicroservicesFromSourceFolder(): Promise<System> { | ||
const storageStatus = await this.gitStorage.getStorageStatus() | ||
const metadata: Metadata = { | ||
transformer: 'custom git sources to microservices', | ||
context: this.configService.getSourceFolder() | ||
} | ||
const system = new System('source') | ||
storageStatus.forEach(status => { | ||
system.addMicroService(status.name, undefined, metadata) | ||
}) | ||
return system | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters