-
Notifications
You must be signed in to change notification settings - Fork 367
Closed
Description
Expected behavior
Broker will return producer/consumer status with client version when call stats command, same as in 3.x version broker:
/data/service/pulsar/apache-pulsar-3.0.4 # curl http://localhost:8080/admin/v2/persistent/public/default/test1/stats
{
"msgRateIn": 1.0002999738406537,
"msgThroughputIn": 57.01709850891726,
"msgRateOut": 0,
"msgThroughputOut": 0,
"bytesInCounter": 7374,
"msgInCounter": 129,
"bytesOutCounter": 0,
"msgOutCounter": 0,
"averageMsgSize": 56.99999999999999,
"msgChunkPublished": false,
"storageSize": 7374,
"backlogSize": 0,
"publishRateLimitedTimes": 0,
"earliestMsgPublishTimeInBacklogs": 0,
"offloadedStorageSize": 0,
"lastOffloadLedgerId": 0,
"lastOffloadSuccessTimeStamp": 0,
"lastOffloadFailureTimeStamp": 0,
"ongoingTxnCount": 0,
"abortedTxnCount": 0,
"committedTxnCount": 0,
"publishers": [
{
"accessMode": "Shared",
"msgRateIn": 1.0002999738406537,
"msgThroughputIn": 57.01709850891726,
"averageMsgSize": 57,
"chunkedMessageRate": 0,
"producerId": 1,
"supportsPartialProducer": false,
"metadata": {},
"address": "/9.x.x.x:58644",
"producerName": "standalone-946-0",
"connectedSince": "2025-06-05T16:02:33.768362397+08:00",
"clientVersion": "Pulsar Go v0.15.1" # <------- print client version
}
],
"waitingPublishers": 0,
"subscriptions": {},
"replication": {},
"deduplicationStatus": "Disabled",
"nonContiguousDeletedMessagesRanges": 0,
"nonContiguousDeletedMessagesRangesSerializedSize": 0,
"delayedMessageIndexSizeInBytes": 0,
"compaction": {
"lastCompactionRemovedEventCount": 0,
"lastCompactionSucceedTimestamp": 0,
"lastCompactionFailedTimestamp": 0,
"lastCompactionDurationTimeInMills": 0
},
"ownerBroker": "9.x.x.x:8080"
}
Actual behavior
Broker will return a blank clientVersion:
"clientVersion":""
Steps to reproduce
- Deploy a
apache-pulsar-2.11.4pulsar cluster in standalone mode./bin/pulsar standalone --config ./conf/standalone.conf -nss -nfwwith default configuration - Create a pulsar producer with 0.15.1 version, code below:
func main() {
client, err := pulsar.NewClient(pulsar.ClientOptions{
URL: "http://localhost:8080",
})
if err != nil {
log.Fatal(err)
}
defer client.Close()
producer, err := client.CreateProducer(pulsar.ProducerOptions{
Topic: "public/default/test1",
})
if err != nil {
log.Fatal(err)
}
defer producer.Close()
ctx := context.Background()
for i := 0; i < 10000; i++ {
if msgId, err := producer.Send(ctx, &pulsar.ProducerMessage{
Payload: []byte(fmt.Sprintf("hello-%d", i)),
}); err != nil {
log.Fatal(err)
} else {
log.Println("Published message: ", msgId)
}
time.Sleep(1000*time.Millisecond)
}
}
- When producer running, execute command
curl http://localhost:8080/admin/v2/persistent/public/default/test1/stats
Additinal info
Go sdk create clientVersion in the format of Pulsar Go <version> #856. But Pulsar broker 2.x does not allow clientVersions with spaces, which has been fixed since pulsar 3.x apache/pulsar#19616.
To make consistent with 2.x pulsar broker, maybe we need to change Go clientVersion format to Pulsar-Go-<version> like Java and C++ sdk. However, this could be a little break change but I think it's just fine.
| ClientVersionString = "Pulsar Go " + Version |
if buildInfo, ok := debug.ReadBuildInfo(); ok {
for _, dep := range buildInfo.Deps {
if dep.Path == pulsarClientGoModulePath {
Version = semver.Canonical(dep.Version)
ClientVersionString = "Pulsar Go " + Version # <----- change to "Pulsar-Go-"
return
}
}
}
Metadata
Metadata
Assignees
Labels
No labels