Populate service type for deleted connectors (#181614)

## Summary

This PR updates the connectors usage collector, to populate the
`serviceType` field for deleted connectors.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Chenhui Wang 2024-05-03 15:08:29 +08:00 committed by GitHub
parent 389025e814
commit 3e32e0187c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View file

@ -113,6 +113,7 @@ export const collectConnectorStats = async (
const connectorStats: ConnectorStats = {
id: connectorId,
isDeleted: true,
serviceType: orphanedSyncJobs[0].connector.service_type,
syncJobs: syncJobsStats(orphanedSyncJobs),
};
connectorStatsArray.push(connectorStats);

View file

@ -249,6 +249,7 @@ export const orphanedSyncJob: ConnectorSyncJob = {
trigger_method: TriggerMethod.ON_DEMAND,
connector: {
id: '3',
service_type: 'github',
configuration: {
use_text_extraction_service: {
value: false,
@ -581,6 +582,7 @@ export const expectedMysqlConnectorStats: ConnectorStats = {
export const expectedDeletedConnectorStats: ConnectorStats = {
id: orphanedSyncJob.connector.id,
isDeleted: true,
serviceType: 'github',
syncJobs: {
overall: {
total: 1,