Skip to content

Commit

Permalink
Merge pull request #32526 from vespa-engine/hmusum/use-feature-flag-t…
Browse files Browse the repository at this point in the history
…o-forward-all-logs

Use feature flag to control whether to forward debug and spam log mes…
  • Loading branch information
Harald Musum authored Oct 5, 2024
2 parents 5bf78cf + c4536b3 commit 0c52243
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
3 changes: 2 additions & 1 deletion config-model-api/abi-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,8 @@
"public boolean symmetricPutAndActivateReplicaSelection()",
"public boolean enforceStrictlyIncreasingClusterStateVersions()",
"public boolean distributionConfigFromClusterController()",
"public boolean useLegacyWandQueryParsing()"
"public boolean useLegacyWandQueryParsing()",
"public boolean forwardAllLogLevels()"
],
"fields" : [ ]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ interface FeatureFlags {
@ModelFeatureFlag(owners = {"vekterli"}) default boolean enforceStrictlyIncreasingClusterStateVersions() { return false; }
@ModelFeatureFlag(owners = {"vekterli"}) default boolean distributionConfigFromClusterController() { return false; }
@ModelFeatureFlag(owners = {"arnej"}) default boolean useLegacyWandQueryParsing() { return true; }
@ModelFeatureFlag(owners = {"hmusum"}) default boolean forwardAllLogLevels() { return false; }
}

/** Warning: As elsewhere in this package, do not make backwards incompatible changes that will break old config models! */
Expand Down
16 changes: 11 additions & 5 deletions config-model/src/main/java/com/yahoo/vespa/model/admin/Admin.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.yahoo.cloud.config.ZookeepersConfig;
import com.yahoo.cloud.config.log.LogdConfig;
import com.yahoo.config.model.ConfigModelContext.ApplicationType;
import com.yahoo.config.model.api.ModelContext.FeatureFlags;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AnyConfigProducer;
import com.yahoo.config.model.producer.TreeConfigProducer;
Expand Down Expand Up @@ -81,20 +82,23 @@ public void setLogForwarderConfig(LogForwarder.Config cfg, boolean includeAdmin)

private ZooKeepersConfigProvider zooKeepersConfigProvider;
private final boolean multitenant;
private final FeatureFlags featureFlags;

public Admin(TreeConfigProducer<AnyConfigProducer> parent,
Monitoring monitoring,
Metrics metrics,
boolean multitenant,
boolean isHostedVespa,
ApplicationType applicationType) {
ApplicationType applicationType,
FeatureFlags featureFlags) {
super(parent, "admin");
this.isHostedVespa = isHostedVespa;
this.monitoring = monitoring;
this.metrics = metrics;
this.multitenant = multitenant;
this.applicationType = applicationType;
this.logctlSpecs.addAll(defaultLogctlSpecs());
this.featureFlags = featureFlags;
}

public Configserver getConfigserver() { return defaultConfigserver; }
Expand Down Expand Up @@ -144,7 +148,7 @@ public List<Configserver> getConfigservers() {

public void addConfigservers(List<Configserver> configservers) {
this.configservers.addAll(configservers);
if (this.configservers.size() > 0) {
if ( ! this.configservers.isEmpty()) {
this.defaultConfigserver = configservers.get(0);
}
this.zooKeepersConfigProvider = new ZooKeepersConfigProvider(configservers);
Expand Down Expand Up @@ -197,11 +201,13 @@ public void getConfig(LogdConfig.Builder builder) {
builder.logserver(new LogdConfig.Logserver.Builder().use(false));
}
else {
builder.
logserver(new LogdConfig.Logserver.Builder().
builder.logserver(new LogdConfig.Logserver.Builder().
use(logServerContainerCluster.isPresent() || !isHostedVespa).
host(logserver.getHostName()).
rpcport(logserver.getRelativePort(0)));
rpcport(logserver.getRelativePort(0)))
.loglevel(new LogdConfig.Loglevel.Builder().
debug(new LogdConfig.Loglevel.Debug.Builder().forward(featureFlags.forwardAllLogLevels())).
spam(new LogdConfig.Loglevel.Spam.Builder().forward(featureFlags.forwardAllLogLevels())));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected Admin doBuild(DeployState deployState, TreeConfigProducer<AnyConfigPro
Monitoring monitoring = getMonitoring(XML.getChild(adminElement,"monitoring"), deployState.isHosted());
Metrics metrics = new MetricsBuilder(applicationType, PredefinedMetricSets.get())
.buildMetrics(XML.getChild(adminElement, "metrics"));
Admin admin = new Admin(parent, monitoring, metrics, multitenant, deployState.isHosted(), applicationType);
Admin admin = new Admin(parent, monitoring, metrics, multitenant, deployState.isHosted(), applicationType, deployState.featureFlags());
doBuildAdmin(deployState, admin, adminElement);
new ModelConfigProvider(admin);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public static ContentCluster createCluster(String clusterXml, MockRoot root) {
new Metrics(),
root.getDeployState().getProperties().multitenant(),
root.getDeployState().isHosted(),
applicationType);
applicationType,
root.getDeployState().featureFlags());
Document doc = XML.getDocument(clusterXml);
ConfigModelContext context = ConfigModelContext.create(applicationType, root.getDeployState(),
null,null, root, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ public static class FeatureFlags implements ModelContext.FeatureFlags {
private final boolean launchApplicationAthenzService;
private final boolean distributionConfigFromClusterController;
private final boolean useLegacyWandQueryParsing;
private final boolean forwardAllLogLevels;

public FeatureFlags(FlagSource source, ApplicationId appId, Version version) {
this.defaultTermwiseLimit = Flags.DEFAULT_TERM_WISE_LIMIT.bindTo(source).with(appId).with(version).value();
Expand Down Expand Up @@ -265,6 +266,7 @@ public FeatureFlags(FlagSource source, ApplicationId appId, Version version) {
this.launchApplicationAthenzService = Flags.LAUNCH_APPLICATION_ATHENZ_SERVICE.bindTo(source).with(appId).with(version).value();
this.distributionConfigFromClusterController = Flags.DISTRIBUTION_CONFIG_FROM_CLUSTER_CONTROLLER.bindTo(source).with(appId).with(version).value();
this.useLegacyWandQueryParsing = Flags.USE_LEGACY_WAND_QUERY_PARSING.bindTo(source).with(appId).with(version).value();
this.forwardAllLogLevels = Flags.FORWARD_ALL_LOG_LEVELS.bindTo(source).with(appId).with(version).value();
}

@Override public int heapSizePercentage() { return heapPercentage; }
Expand Down Expand Up @@ -321,6 +323,7 @@ public FeatureFlags(FlagSource source, ApplicationId appId, Version version) {
@Override public boolean enforceStrictlyIncreasingClusterStateVersions() { return enforceStrictlyIncreasingClusterStateVersions; }
@Override public boolean distributionConfigFromClusterController() { return distributionConfigFromClusterController; }
@Override public boolean useLegacyWandQueryParsing() { return useLegacyWandQueryParsing; }
@Override public boolean forwardAllLogLevels() { return forwardAllLogLevels; }
}

public static class Properties implements ModelContext.Properties {
Expand Down

0 comments on commit 0c52243

Please sign in to comment.