Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
lucamolteni committed Apr 7, 2023
1 parent 7625f5f commit 4351d70
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ public Optional<Secret> getSecret(String namespaceId, String deploymentId) {
.get());
}


public Optional<Secret> getProcessorSecret(String namespaceId, String deploymentId) {
return Optional.ofNullable(
kubernetesClient.secrets()
Expand Down Expand Up @@ -325,7 +324,6 @@ public List<ManagedConnector> getAllConnectors() {
return connectorsInformer.getIndexer().list();
}


public List<ManagedProcessor> getAllProcessors() {
if (processorsInformer == null) {
throw new IllegalStateException("Informer must be started before adding handlers");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,44 +48,44 @@ public void update(ManagedProcessor processor) {
processor.getMetadata().getName(),
processor.getStatus().getPhase());

// try {
// ProcessorDeploymentStatus ProcessorDeploymentStatus = Process.extract(processor);

// fleetManagerClient.updateConnectorStatus(processor, ProcessorDeploymentStatus);

// LOGGER.debug("Updating Connector status metrics (Connector_id: {}, state: {})",
// processor.get(), ProcessorDeploymentStatus.getPhase());
//
// switch (ProcessorDeploymentStatus.getPhase()) {
// case READY:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_READY);
// break;
// case FAILED:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_FAILED);
// break;
// case DELETED:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_DELETED);
// break;
// case STOPPED:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_STOPPED);
// break;
// default:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_IN_PROCESS);
// break;
// }

// } catch (FleetManagerClientException e) {
// if (e.getStatusCode() == 410) {
// LOGGER.info("Connector " + processor.getMetadata().getName() + " does not exists anymore, deleting it");
// if (connectorClient.deleteConnector(processor)) {
// LOGGER.info("Connector " + processor.getMetadata().getName() + " deleted");
// }
// } else {
// LOGGER.warn("Error updating status of connector " + processor.getMetadata().getName(), e);
// }
// } catch (Exception e) {
// LOGGER.warn("Error updating status of connector " + processor.getMetadata().getName(), e);
// }
// try {
// ProcessorDeploymentStatus ProcessorDeploymentStatus = Process.extract(processor);

// fleetManagerClient.updateConnectorStatus(processor, ProcessorDeploymentStatus);

// LOGGER.debug("Updating Connector status metrics (Connector_id: {}, state: {})",
// processor.get(), ProcessorDeploymentStatus.getPhase());
//
// switch (ProcessorDeploymentStatus.getPhase()) {
// case READY:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_READY);
// break;
// case FAILED:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_FAILED);
// break;
// case DELETED:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_DELETED);
// break;
// case STOPPED:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_STOPPED);
// break;
// default:
// measure(processor, ProcessorDeploymentStatus, CONNECTOR_STATE_IN_PROCESS);
// break;
// }

// } catch (FleetManagerClientException e) {
// if (e.getStatusCode() == 410) {
// LOGGER.info("Connector " + processor.getMetadata().getName() + " does not exists anymore, deleting it");
// if (connectorClient.deleteConnector(processor)) {
// LOGGER.info("Connector " + processor.getMetadata().getName() + " deleted");
// }
// } else {
// LOGGER.warn("Error updating status of connector " + processor.getMetadata().getName(), e);
// }
// } catch (Exception e) {
// LOGGER.warn("Error updating status of connector " + processor.getMetadata().getName(), e);
// }
}

/*
Expand All @@ -102,7 +102,7 @@ private void measure(ManagedProcessor processor, ProcessorDeploymentStatus Proce
tags.add(Tag.of("cos.deployment.id", processor.getSpec().getDeploymentId()));
tags.add(Tag.of("cos.namespace", processor.getMetadata().getNamespace()));

// String connectorResourceVersion = String.valueOf(processor.getSpec().getDeployment().getConnectorResourceVersion());
// String connectorResourceVersion = String.valueOf(processor.getSpec().getDeployment().getConnectorResourceVersion());

Gauge gauge = registry.find(config.metrics().baseName() + "." + CONNECTOR_STATE).tags(tags).gauge();

Expand All @@ -123,7 +123,7 @@ private void measure(ManagedProcessor processor, ProcessorDeploymentStatus Proce
Counter.builder(config.metrics().baseName() + "." + CONNECTOR_STATE_COUNT)
.tags(tags)
.tag("cos.connector.state", ProcessorDeploymentStatus.getPhase().getValue())
// .tag("cos.connector.resourceversion", connectorResourceVersion)
// .tag("cos.connector.resourceversion", connectorResourceVersion)
.register(registry)
.increment();

Expand All @@ -138,7 +138,7 @@ private void measure(ManagedProcessor processor, ProcessorDeploymentStatus Proce
Counter.builder(config.metrics().baseName() + "." + CONNECTOR_STATE_COUNT)
.tags(tags)
.tag("cos.connector.state", "failed_but_ready")
// .tag("cos.connector.resourceversion", connectorResourceVersion)
// .tag("cos.connector.resourceversion", connectorResourceVersion)
.register(registry)
.increment();
}
Expand Down

0 comments on commit 4351d70

Please sign in to comment.