-
Notifications
You must be signed in to change notification settings - Fork 97
[controller] integrate OpenTelemetry into Controller & add log compaction metrics #1665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[controller] integrate OpenTelemetry into Controller & add log compaction metrics #1665
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Left some very initial review.
@@ -34,6 +34,7 @@ dependencies { | |||
|
|||
implementation project(':internal:venice-common') | |||
implementation project(':clients:venice-thin-client') | |||
implementation project(':internal:venice-client-common') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this not under venice-common rather than under venice-client-common. We can fix this if needed separately, no AI for you on this.
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
|
||
public class RepushJobRequest { | ||
public static final String SCHEDULED_TRIGGER = "Scheduled"; | ||
public static final String MANUAL_TRIGGER = "Manual"; | ||
public static final RepushStoreTriggerSource SCHEDULED_TRIGGER = RepushStoreTriggerSource.SCHEDULED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can directly use RepushStoreTriggerSource.SCHEDULED
or MANUAL
where ever its needed or use the new member variable triggerSource
. No need to have another static variable for this.
package com.linkedin.venice.stats.dimensions; | ||
|
||
public enum LogCompactionSelectionReason implements VeniceDimensionInterface { | ||
TIME_SINCE_LAST_VERSION_CREATION_EXCEEDS_THRESHOLD; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there another reason which we are thinking to add in the future?
@@ -62,6 +67,11 @@ public class VeniceController { | |||
private static final Logger LOGGER = LogManager.getLogger(VeniceController.class); | |||
private static final String CONTROLLER_GRPC_SERVER_THREAD_NAME = "ControllerGrpcServer"; | |||
static final String CONTROLLER_SERVICE_NAME = "venice-controller"; | |||
public static final String CONTROLLER_SERVICE_METRIC_PREFIX = "controller"; | |||
public static final Collection<MetricEntity> CONTROLLER_SERVICE_METRIC_ENTITIES = Collections.unmodifiableList( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why duplicated?
@@ -375,11 +378,15 @@ public class VeniceParentHelixAdmin implements Admin { | |||
private final Map<String, Map<String, ControllerClient>> newFabricControllerClientMap = | |||
new VeniceConcurrentHashMap<>(); | |||
|
|||
/** Metrics */ | |||
private final Map<String, LogCompactionStats> logCompactionStatsMap = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets use VeniceConcurrentHashMap
// initialise logCompactionStatsMap | ||
for (String clusterName: multiClusterConfigs.getClusters()) { | ||
if (multiClusterConfigs.getControllerConfig(clusterName).isLogCompactionEnabled()) { | ||
logCompactionStatsMap.put(clusterName, new LogCompactionStats(metricsRepository, clusterName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use putIfAbsent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inside LogCompactionStats
, I see we use MetricEntityStateGeneric
, the MES that doesn't have a caching layer. In that case, can we just use the clusterName
as a dimension when we record
, instead of building per cluster stats?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally yes, but we are adding per cluster stats for tehuti metrics to keep it similar to other controller stats.
.recordRepushStoreCall( | ||
repushJobRequest.getStoreName(), | ||
repushJobRequest.getTriggerSource(), | ||
response.isError() ? VeniceResponseStatusCategory.FAIL : VeniceResponseStatusCategory.SUCCESS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JOB_EXECUTION_STATUS was defined but never used. where is the plan to use this?
@@ -38,10 +42,20 @@ public class LogCompactionService extends AbstractVeniceService { | |||
private final Admin admin; | |||
private final VeniceControllerMultiClusterConfig multiClusterConfigs; | |||
final ScheduledExecutorService executor; | |||
private final Map<String, LogCompactionStats> statsMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find who uses this map?
// initialise logCompactionStatsMap | ||
for (String clusterName: multiClusterConfigs.getClusters()) { | ||
if (multiClusterConfigs.getControllerConfig(clusterName).isLogCompactionEnabled()) { | ||
logCompactionStatsMap.put(clusterName, new LogCompactionStats(metricsRepository, clusterName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inside LogCompactionStats
, I see we use MetricEntityStateGeneric
, the MES that doesn't have a caching layer. In that case, can we just use the clusterName
as a dimension when we record
, instead of building per cluster stats?
contains wip code
…eniceControllerContext
- add RepushStoreTriggerSource enum for metric dimension - import `venice-client-common` in `venice-controller` to allow `VeniceParentHelixAdmin` to access `VeniceResponseStatusCategory` to emit metric - add clusterName to RepushJobRequest for metric dimension - in RepushJobRequest, streamline triggerSource to `RepushStoreTriggerSource`
- VeniceParentHelixAdmin::getStoresForCompaction call VeniceHelixAdmin::getStoresForCompaction directly rather than throw exception - VeniceController only creates LogCompactionService if is parent controller
…::initializeParentAdmin to pass in metricsRepository for testing metric emission in VeniceParentHelixAdmin
for metric to record which stores are nominated for compaction
6797aeb
to
2062312
Compare
Problem Statement
Solution
Code changes
Concurrency-Specific Checks
Both reviewer and PR author to verify
synchronized
,RWLock
) are used where needed.ConcurrentHashMap
,CopyOnWriteArrayList
).How was this PR tested?
Does this PR introduce any user-facing or breaking changes?