Copilot commented on code in PR #4062: URL: https://github.com/apache/hertzbeat/pull/4062#discussion_r2910269184
########## hertzbeat-startup/src/main/resources/application-test.yml: ########## @@ -190,3 +190,34 @@ grafana: expose-url: http://127.0.0.1:3000 username: admin password: admin + +hertzbeat: + vthreads: + enabled: true + common: + mode: UNBOUNDED_VT + collector: + mode: LIMIT_AND_REJECT + manager: Review Comment: Same as `application.yml`: `collector.mode: LIMIT_AND_REJECT` is set without `collector.max-concurrent-jobs`. If this binds to `0`, limited-mode executor construction will fail at startup. Add `max-concurrent-jobs` (per documented default) or ensure `VirtualThreadProperties` normalizes missing values. ########## hertzbeat-common-spring/src/main/java/org/apache/hertzbeat/common/config/VirtualThreadProperties.java: ########## @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hertzbeat.common.config; + +import org.apache.hertzbeat.common.concurrent.AdmissionMode; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.bind.DefaultValue; +import org.springframework.boot.context.properties.bind.Name; + +/** + * Virtual-thread related configuration. + */ +@ConfigurationProperties(prefix = "hertzbeat.vthreads") +public record VirtualThreadProperties( + @DefaultValue("true") boolean enabled, + @DefaultValue PoolProperties collector, + @DefaultValue PoolProperties common, + @DefaultValue PoolProperties manager, + @DefaultValue AlerterProperties alerter, + @DefaultValue PoolProperties warehouse, + @DefaultValue AsyncProperties async) { + + private static final int DEFAULT_COLLECTOR_MAX_CONCURRENT_JOBS = 512; + + public VirtualThreadProperties { + collector = collector == null ? PoolProperties.collectorDefaults() : collector; + common = common == null ? PoolProperties.commonDefaults() : common; + manager = manager == null ? PoolProperties.managerDefaults() : manager; + alerter = alerter == null ? AlerterProperties.defaults() : alerter; Review Comment: `VirtualThreadProperties` only falls back to `*Defaults()` when nested records are `null`. When users (or the newly added sample YAML blocks) set only `collector.mode: LIMIT_AND_REJECT` and omit `collector.max-concurrent-jobs`, the binder will leave `maxConcurrentJobs` at `0`, and later executor creation will throw `IllegalArgumentException` for limited admission modes. Consider normalizing here as well (e.g., if `mode != UNBOUNDED_VT && maxConcurrentJobs <= 0`, replace with pool-specific defaults for collector/manager/notify, and likewise ensure alerter `QueueProperties.maxConcurrentJobs` never remains `0` when used with queued executors). ########## script/docker-compose/hertzbeat-postgresql-greptimedb/conf/application.yml: ########## @@ -231,3 +231,35 @@ grafana: url: http://127.0.0.1:3000 username: admin password: admin + +hertzbeat: + # Optional virtual-thread overrides. Remove this whole block to use built-in defaults. + vthreads: + enabled: true + common: + mode: UNBOUNDED_VT + collector: + mode: LIMIT_AND_REJECT + manager: + mode: LIMIT_AND_REJECT Review Comment: This docker-compose sample enables `collector.mode: LIMIT_AND_REJECT` but omits `collector.max-concurrent-jobs`. If it binds to `0`, limited-mode executor initialization will fail. Add `max-concurrent-jobs` (e.g., 512) or ensure `VirtualThreadProperties` normalizes missing values. ########## script/docker-compose/hertzbeat-mysql-iotdb/conf/application.yml: ########## @@ -234,3 +234,35 @@ grafana: url: http://127.0.0.1:3000 username: admin password: admin + +hertzbeat: + # Optional virtual-thread overrides. Remove this whole block to use built-in defaults. + vthreads: + enabled: true + common: + mode: UNBOUNDED_VT + collector: + mode: LIMIT_AND_REJECT + manager: + mode: LIMIT_AND_REJECT Review Comment: This docker-compose sample enables `collector.mode: LIMIT_AND_REJECT` but omits `collector.max-concurrent-jobs`. If it binds to `0`, limited-mode executor initialization will fail. Add `max-concurrent-jobs` (e.g., 512) or ensure `VirtualThreadProperties` normalizes missing values. ########## script/application.yml: ########## @@ -334,3 +334,35 @@ grafana: expose-url: http://127.0.0.1:3000 username: admin password: admin + +hertzbeat: + # Optional virtual-thread overrides. Remove this whole block to use built-in defaults. + vthreads: + enabled: true + common: + mode: UNBOUNDED_VT + collector: + mode: LIMIT_AND_REJECT + manager: Review Comment: This sample config sets `collector.mode: LIMIT_AND_REJECT` but omits `collector.max-concurrent-jobs`. If it binds to `0`, limited admission executors will fail to initialize. Add `max-concurrent-jobs` (per default 512) or ensure `VirtualThreadProperties` normalizes missing values. ########## script/docker-compose/hertzbeat-mysql-victoria-metrics/conf/application.yml: ########## @@ -234,3 +234,35 @@ grafana: url: http://127.0.0.1:3000 username: admin password: admin + +hertzbeat: + # Optional virtual-thread overrides. Remove this whole block to use built-in defaults. + vthreads: + enabled: true + common: + mode: UNBOUNDED_VT + collector: + mode: LIMIT_AND_REJECT + manager: + mode: LIMIT_AND_REJECT Review Comment: This docker-compose sample enables `collector.mode: LIMIT_AND_REJECT` but omits `collector.max-concurrent-jobs`. If it binds to `0`, limited-mode executor initialization will fail. Add `max-concurrent-jobs` (e.g., 512) or ensure `VirtualThreadProperties` normalizes missing values. ########## hertzbeat-collector/hertzbeat-collector-collector/src/main/resources/application.yml: ########## @@ -75,3 +75,12 @@ push: common: queue: type: netty + +hertzbeat: + # Optional virtual-thread overrides. Remove this whole block to use built-in defaults. + vthreads: + enabled: true + common: + mode: UNBOUNDED_VT + collector: + mode: LIMIT_AND_REJECT Review Comment: This collector config enables `collector.mode: LIMIT_AND_REJECT` without setting `collector.max-concurrent-jobs`. If `maxConcurrentJobs` defaults to `0`, the collector worker pool will fail to build the limited executor. Add `max-concurrent-jobs` here or make `VirtualThreadProperties` treat missing/zero as the pool default. ########## script/docker-compose/hertzbeat-mysql-tdengine/conf/application.yml: ########## @@ -232,3 +232,34 @@ grafana: username: admin password: admin +hertzbeat: + # Optional virtual-thread overrides. Remove this whole block to use built-in defaults. + vthreads: + enabled: true + common: + mode: UNBOUNDED_VT + collector: + mode: LIMIT_AND_REJECT + manager: + mode: LIMIT_AND_REJECT Review Comment: This docker-compose sample enables `collector.mode: LIMIT_AND_REJECT` but omits `collector.max-concurrent-jobs`. If it binds to `0`, limited-mode executor initialization will fail. Add `max-concurrent-jobs` (e.g., 512) or ensure `VirtualThreadProperties` normalizes missing values. ########## hertzbeat-startup/src/main/resources/application.yml: ########## @@ -334,3 +334,35 @@ grafana: expose-url: http://127.0.0.1:3000 username: admin password: admin + +hertzbeat: + # Optional virtual-thread overrides. Remove this whole block to use built-in defaults. + vthreads: + enabled: true + common: + mode: UNBOUNDED_VT + collector: + mode: LIMIT_AND_REJECT + manager: Review Comment: This sample config enables `collector.mode: LIMIT_AND_REJECT` but does not set `collector.max-concurrent-jobs`. With the current `VirtualThreadProperties` model, this typically binds `maxConcurrentJobs` to `0`, which will cause executor creation to fail for limited admission modes. Either add an explicit `max-concurrent-jobs` here (e.g., 512 per the docs) or adjust `VirtualThreadProperties` to treat a missing/zero value as the pool default. ########## script/docker-compose/hertzbeat-postgresql-victoria-metrics/conf/application.yml: ########## @@ -233,3 +233,35 @@ grafana: url: http://127.0.0.1:3000 username: admin password: admin + +hertzbeat: + # Optional virtual-thread overrides. Remove this whole block to use built-in defaults. + vthreads: + enabled: true + common: + mode: UNBOUNDED_VT + collector: + mode: LIMIT_AND_REJECT + manager: Review Comment: This docker-compose sample enables `collector.mode: LIMIT_AND_REJECT` but omits `collector.max-concurrent-jobs`. If it binds to `0`, limited-mode executor initialization will fail. Add `max-concurrent-jobs` (e.g., 512) or ensure `VirtualThreadProperties` normalizes missing values. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
