You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "ranxuxin001 (via GitHub)" <gi...@apache.org> on 2026/04/21 03:28:29 UTC
[I] [Bug] sampling rate of dynamic configuration using DCS does not work [skywalking]
ranxuxin001 opened a new issue, #13836:
URL: https://github.com/apache/skywalking/issues/13836
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues.
### Apache SkyWalking Component
OAP server (apache/skywalking)
### What happened
Hello,
I've written the call() function of my grpc server to configure sampling rate. Oap log shows it calls call() function and parse the sampling rate correctly. But skywalking ui shows the same trace frequecy.
### What you expected to happen
the sampling rate dynamic configuration works via grpc.
### How to reproduce
My yaml configuration shows below:
```
const agentConfigurationYAML = `default:
rate: 10000
duration: -1
services:
- name: qewqw-test::myapmmysqlservice
rate: 100
duration: -1`
func GetFromMysql() string {
//query mysql to get configuration.
return agentConfigurationYAML
}
func (s *configServer) Call(ctx context.Context, req *pb.ConfigurationRequest) (*pb.ConfigurationResponse, error) {
configValue := GetFromMysql()
log.Println("config value: ", configValue)
//configValue = "default:\n rate: 10000\n duration: -1\nservices:\n - name: qewqw-test::myapmmysqlservice\n rate: 1001\n duration: -1"
cfgTb := []*pb.Config{
{
Name: "agent-analyzer.default.traceSamplingPolicy",
//Value: configValue,
Value: configValue,
},
.....
response := &pb.ConfigurationResponse{
ConfigTable: cfgTb,
Uuid: s.currentUUID,
}
fmt.Printf("single. will send response to oap. %v", response.ConfigTable)
return response, nil
}
```
### Anything else
_No response_
### Are you willing to submit a pull request to fix on your own?
- [x] Yes I am willing to submit a pull request on my own!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
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: notifications-unsubscribe@skywalking.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] sampling rate of dynamic configuration using DCS does not work [skywalking]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng closed issue #13836: [Bug] sampling rate of dynamic configuration using DCS does not work
URL: https://github.com/apache/skywalking/issues/13836
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] sampling rate of dynamic configuration using DCS does not work [skywalking]
Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng commented on issue #13836:
URL: https://github.com/apache/skywalking/issues/13836#issuecomment-4290111700
Hi @ranxuxin001, before we dig into this as a bug, two questions — either one can fully explain what you're seeing:
**1. Does `s.currentUUID` change every time the underlying MySQL config changes?**
The DCS gRPC protocol is version-based, not push-based. See [`GRPCConfigWatcherRegister#readConfig`](https://github.com/apache/skywalking/blob/master/oap-server/server-configuration/grpc-configuration-sync/src/main/java/org/apache/skywalking/oap/server/configuration/grpc/GRPCConfigWatcherRegister.java#L57-L72):
```java
if (Objects.equals(uuid, responseUuid)) {
// If UUID matched, the config table is expected as empty.
return Optional.empty();
}
```
The OAP sends the last UUID it saw; if your server returns the same UUID, the OAP treats the poll as "no change" and never re-notifies the watcher — even if `ConfigTable` carries a new value. Your log showing `call()` being hit and the value being parsed is consistent with the **first** poll succeeding and every subsequent poll being ignored. Your server must bump the UUID (or hash the payload, or use the row's `updated_at`) whenever the value bytes change.
**2. Is `qewqw-test::myapmmysqlservice` actually an agent-reported service name, or is it a virtual database node in the topology?**
[`TraceSegmentSampler#shouldSample`](https://github.com/apache/skywalking/blob/master/oap-server/analyzer/agent-analyzer/src/main/java/org/apache/skywalking/oap/server/analyzer/provider/trace/parser/listener/TraceSegmentSampler.java#L33-L36) matches on `segmentObject.getService()` — the name the agent sets for itself, not any synthesized entity. The `::` pattern usually shows up on conjured nodes like virtual databases / MQ / caches that SkyWalking derives from span relations; those are never carried as a segment's `service` field, so a `services[].name` rule targeting them will never match. If that's the case here, your `rate: 100` override is silently ignored and only `default.rate: 10000` (= 100%) applies — which is exactly "UI shows the same trace frequency."
Could you confirm both? If (1) is the cause, the fix is on your gRPC server side. If (2) is the cause, you'll want to put the agent's own service name in `services[].name` instead.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org