Skip to content

Commit

Permalink
fix: initialize metrics client for connector builder server (#14872)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroslopez committed Dec 19, 2024
1 parent 7f580c8 commit d75be47
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2020-2024 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.connector_builder.config;

import io.airbyte.metrics.lib.MetricClient;
import io.airbyte.metrics.lib.MetricEmittingApps;
import io.micronaut.context.annotation.Factory;
import io.micronaut.context.annotation.Replaces;
import jakarta.inject.Singleton;

/**
* Micronaut singleton factory for the creation and initialization of the {@link MetricClient}.
*/
@Factory
public class MetricClientFactory {

/**
* Creates and initializes the {@link MetricClient}.
*
* @return The initialized {@link MetricClient}.
*/
@Singleton
@Replaces(MetricClient.class)
public MetricClient metricClient() {
// Initialize the metric client
io.airbyte.metrics.lib.MetricClientFactory.initialize(MetricEmittingApps.CONNECTOR_BUILDER_SERVER);
return io.airbyte.metrics.lib.MetricClientFactory.getMetricClient();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public enum MetricEmittingApps implements MetricEmittingApp {
WORKER("worker"),
WORKLOAD_API("workload-api"),
WORKLOAD_INIT("workload-init"),
WORKLOAD_LAUNCHER("workload-launcher");
WORKLOAD_LAUNCHER("workload-launcher"),
CONNECTOR_BUILDER_SERVER("connector-builder-server");

private final String applicationName;

Expand Down

0 comments on commit d75be47

Please sign in to comment.