aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/ConsumersConfigGenerator.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/MetricsConsumer.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/builder/xml/MetricsBuilder.java3
-rw-r--r--config-model/src/main/javacc/SDParser.jj4
-rw-r--r--config-model/src/test/derived/rankprofiles/rankprofiles.sd18
-rw-r--r--config-model/src/test/examples/desktop.sd108
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsConsumersTest.java16
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/ValidationTester.java4
9 files changed, 32 insertions, 128 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/ConsumersConfigGenerator.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/ConsumersConfigGenerator.java
index 2c039118cb9..b0ed04f3013 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/ConsumersConfigGenerator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/ConsumersConfigGenerator.java
@@ -30,6 +30,7 @@ class ConsumersConfigGenerator {
var allConsumers = new LinkedHashMap<>(userConsumers);
allConsumers.put(MetricsConsumer.vespa.id(),
combineConsumers(defaultConsumer, allConsumers.get(MetricsConsumer.vespa.id())));
+ allConsumers.put(MetricsConsumer.autoscaling.id(), MetricsConsumer.autoscaling);
return allConsumers.values().stream()
.map(ConsumersConfigGenerator::toConsumerBuilder)
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/MetricsConsumer.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/MetricsConsumer.java
index 698b01c306a..6344e462e0f 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/MetricsConsumer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/MetricsConsumer.java
@@ -27,6 +27,7 @@ import static java.util.Collections.unmodifiableList;
public class MetricsConsumer {
// Pre-defined consumers
+ // See also ConsumersConfigGenerator and MetricsBuilder where these must be enumerated
public static final MetricsConsumer vespa =
consumer(VespaMetrics.vespaMetricsConsumerId.id, vespaMetricSet, systemMetricSet, networkMetricSet);
public static final MetricsConsumer defaultConsumer =
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/builder/xml/MetricsBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/builder/xml/MetricsBuilder.java
index 919830d912f..3efc50a7445 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/builder/xml/MetricsBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/builder/xml/MetricsBuilder.java
@@ -89,6 +89,9 @@ public class MetricsBuilder {
if (consumerId.equalsIgnoreCase(MetricsConsumer.defaultConsumer.id()))
throw new IllegalArgumentException("'" + MetricsConsumer.defaultConsumer.id() + "' is not allowed as metrics consumer id (case is ignored.)");
+ if (consumerId.equalsIgnoreCase(MetricsConsumer.autoscaling.id()))
+ throw new IllegalArgumentException("'" + MetricsConsumer.autoscaling.id() + " is not allowed as metrics consumer id (case is ignored.)");
+
if (metrics.hasConsumerIgnoreCase(consumerId))
throw new IllegalArgumentException("'" + consumerId + "' is used as id for two metrics consumers (case is ignored.)");
}
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index d9013b32b21..869f671d8ef 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -233,6 +233,7 @@ TOKEN :
| < SUFFIX: "suffix" >
| < CONSTANT: "constant">
| < ONNXMODEL: "onnx-model">
+| < MODEL: "model" >
| < RANKPROFILE: "rank-profile" >
| < RANKDEGRADATIONFREQ: "rank-degradation-frequency" >
| < RANKDEGRADATION: "rank-degradation" >
@@ -1976,7 +1977,7 @@ void rankProfile(Search search) :
RankProfile profile;
}
{
- ( <RANKPROFILE> name = identifierWithDash()
+ ( ( <MODEL> | <RANKPROFILE> ) name = identifierWithDash()
{
if (documentsOnly) {
profile = new DocumentsOnlyRankProfile(name, search, rankProfileRegistry);
@@ -2676,6 +2677,7 @@ String identifier() : { }
| <QUATERNARY>
| <QUERYCOMMAND>
| <RANK>
+ | <MODEL>
| <RANKPROFILE>
| <RANKPROPERTIES>
| <RANKSCOREDROPLIMIT>
diff --git a/config-model/src/test/derived/rankprofiles/rankprofiles.sd b/config-model/src/test/derived/rankprofiles/rankprofiles.sd
index abafee91533..6c3720df589 100644
--- a/config-model/src/test/derived/rankprofiles/rankprofiles.sd
+++ b/config-model/src/test/derived/rankprofiles/rankprofiles.sd
@@ -19,21 +19,21 @@ search rankprofiles {
}
- rank-profile default {
+ model default {
}
- rank-profile other1 inherits default {
+ model other1 inherits default {
rank field1: filter
rank none: filter
}
- rank-profile other2 inherits other1 {
+ model other2 inherits other1 {
}
- rank-profile other3 {
+ model other3 {
}
- rank-profile four {
+ model four {
match-phase {
attribute: field2
order: ascending
@@ -41,7 +41,7 @@ search rankprofiles {
}
}
- rank-profile five {
+ model five {
match-phase {
attribute: field2
order: descending
@@ -49,14 +49,14 @@ search rankprofiles {
}
}
- rank-profile six {
+ model six {
match-phase {
attribute: field3
max-hits: 666
}
}
- rank-profile seven {
+ model seven {
match-phase {
attribute: field3
max-hits:800
@@ -65,7 +65,7 @@ search rankprofiles {
}
}
- rank-profile eight inherits seven {
+ model eight inherits seven {
}
diff --git a/config-model/src/test/examples/desktop.sd b/config-model/src/test/examples/desktop.sd
deleted file mode 100644
index 82741dbe53f..00000000000
--- a/config-model/src/test/examples/desktop.sd
+++ /dev/null
@@ -1,108 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-# A search definition of medium complexity
-search desktop {
-
- # A document with some fields.
- # The fields implicitly defines some indices, summary fields and attributes
- document desktop inherits product {
-
- field title type text {
- mandatory: true
- indexing: summary | attribute | index_text
- # index-to: title, default
-
- rank-weight: 300
- rank-type: identity
- }
-
- field manufacturer type text {
- indexing: summary | attribute | index
- # index-to: manufacturer, default
- alias: producer, brand
-
- rank-type: identity
- rank-weight:200
- }
-
- field description type text {
- indexing: summary | index
-
- rank-type: about
- rank-weight: 100
- result-transform: dynamicteaser
- }
-
- field category type text {
- indexing: index
- # index-to: category, default
- rank-weight: 50
- }
-
- field minprice type int {
- indexing: summary | attribute | index
- index-decimals: 2
-
- rank-type: simple
- weight: 30
- staticrankbits: 16
- }
-
- field someorder type int {
- indexing: attribute someorderranking
- staticrankbits someorderranking: 32
- }
-
- # index_url implicitly defines some fields not contained in the document (contexts)
- # If attributes needs to be set on these, it can be done by explicitly listing
- # the fields outside documents (show).
- # I think we should maybe allow setting such field attributes inside the parent
- # field as well for convenience. Both is shown.
- field url type url {
- # Should index mean index_url for url type fields?
- indexing: summary | index_url
- parse-mode: url # Must be default for url types, but shown here anyway
-
- rank-type: link
- }
-
- }
-
- field category_arr type array<text> {
- indexing: input category | split ";" | attribute category_arr
- }
-
- # Overriding some url field setting from rank-type link
- field url.host {
- weight: 1000
- }
-
- # Setting an attribute on a non-field index
- # This is redunant, as default is default
- index default {
- default: true
- }
-
- # Optionally specify a desire to use a shared dictionary ("catalogs")
- shared-dictionary: normal, title, manufacturer
-
- # Optionally set rank values for all indices
- # Default is the name of the default one
- # Rank settings from individual fields can be selectively overridden
- rankprofile default {
- firstocc-boost text: 200
- }
-
- # Another rank profile
- rankprofile predefinedorder {
- dynamicranking: off
- attribute: someorder
- }
-
- # Some experimental ranking changes
- rankprofile experimental inherits default {
- firstocc-boost text: 300
- }
-
-}
-
-
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsConsumersTest.java b/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsConsumersTest.java
index 36eb30073b3..d185362d362 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsConsumersTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsConsumersTest.java
@@ -46,19 +46,19 @@ public class MetricsConsumersTest {
@Test
public void default_public_consumer_is_set_up_for_self_hosted() {
ConsumersConfig config = consumersConfigFromXml(servicesWithAdminOnly(), self_hosted);
- assertEquals(2, config.consumer().size());
- assertEquals(MetricsConsumer.defaultConsumer.id(), config.consumer(1).name());
-
+ assertEquals(3, config.consumer().size());
+ assertEquals(MetricsConsumer.defaultConsumer.id(), config.consumer(2).name());
int numMetricsForPublicDefaultConsumer = defaultMetricSet.getMetrics().size() + numSystemMetrics;
- assertEquals(numMetricsForPublicDefaultConsumer, config.consumer(1).metric().size());
+ assertEquals(numMetricsForPublicDefaultConsumer, config.consumer(2).metric().size());
}
@Test
- public void vespa_consumer_and_default_public_consumer_is_set_up_for_hosted() {
+ public void consumers_are_set_up_for_hosted() {
ConsumersConfig config = consumersConfigFromXml(servicesWithAdminOnly(), hosted);
- assertEquals(2, config.consumer().size());
+ assertEquals(3, config.consumer().size());
assertEquals(MetricsConsumer.vespa.id(), config.consumer(0).name());
- assertEquals(MetricsConsumer.defaultConsumer.id(), config.consumer(1).name());
+ assertEquals(MetricsConsumer.autoscaling.id(), config.consumer(1).name());
+ assertEquals(MetricsConsumer.defaultConsumer.id(), config.consumer(2).name());
}
@Test
@@ -123,7 +123,7 @@ public class MetricsConsumersTest {
);
VespaModel hostedModel = getModel(services, hosted);
ConsumersConfig config = consumersConfigFromModel(hostedModel);
- assertEquals(2, config.consumer().size());
+ assertEquals(3, config.consumer().size());
// All default metrics are retained
ConsumersConfig.Consumer vespaConsumer = config.consumer(0);
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java
index 10199bfe6b9..3e42cbed9b1 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/QuotaValidatorTest.java
@@ -42,7 +42,8 @@ public class QuotaValidatorTest {
tester.deploy(null, getServices("testCluster", 10), Environment.prod, null);
fail();
} catch (RuntimeException e) {
- assertEquals("Hourly spend for maximum specified resources ($1.60) exceeds budget from quota ($1.00)!", e.getMessage());
+ assertEquals("Hourly spend for maximum specified resources ($-.--) exceeds budget from quota ($-.--)!",
+ ValidationTester.censorNumbers(e.getMessage()));
}
}
@@ -62,4 +63,6 @@ public class QuotaValidatorTest {
" </content>" +
"</services>";
}
+
+
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ValidationTester.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ValidationTester.java
index 6961ffa682b..2b3b1a9fcc7 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ValidationTester.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/ValidationTester.java
@@ -96,6 +96,8 @@ public class ValidationTester {
return new Pair<>(newModel, newModelCreator.configChangeActions);
}
-
+ public static String censorNumbers(String s) {
+ return s.replaceAll("\\d", "-");
+ }
}