Go/sarama: consumer group ID is recorded as a Kafka topic (false ASYNC_CALLS), and real topics from ProducerMessage{Topic} / ConsumerGroup.Consume are not extracted
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend-api-design, data-engineering
Direzione di ricerca
Start with internal/cbm/extract_calls.c, especially is_queue_topic_field() and extract_composite_queue_field(), then trace how calls are classified when the callee cannot be resolved. Reproduce with the attached repro.sh.txt, section "Issue 3". Done means the producer and consumer each emit ASYNC_CALLS for payments.charged, the group ID emits no edge, and cross_async_calls is 1.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version
Version: 0.11.0 (release). Also reproduced on main @ 96c3f41c built from source.
Platform
Linux (x64)
Install channel
GitHub release archive / install.sh / install.ps1
Binary variant
standard
What happened, and what did you expect?
For an idiomatic sarama producer and consumer of the same topic, in two repositories:
- False edge. In the consumer,
sarama.NewConsumerGroup(brokers, "ledger-group", cfg)
producesASYNC_CALLS main -> ledger-groupwith
{"callee":"sarama.NewConsumerGroup","url_path":"ledger-group","broker":"kafka"}.
"ledger-group"is the consumer group ID, not a topic. - Missed consumer topic.
g.Consume(ctx, []string{"payments.charged"}, h)produces no
ASYNC_CALLS edge forpayments.charged. - Missed producer topic.
p.SendMessage(&sarama.ProducerMessage{Topic: "payments.charged", ...})
produces no ASYNC_CALLS edge.
Result: cross_async_calls: 0 between producer and consumer. Before investigating, we
had read edge 1 as "consumer detected", which is how the false edge can mislead users.
Expected: producer ASYNC_CALLS to topic payments.charged, consumer ASYNC_CALLS to topic
payments.charged, no edge for the group ID, and one CROSS_ASYNC_CALLS between the
repos.
Reproduction
- Code:
// producer/main.go (go.mod requires github.com/IBM/sarama)
package main
import "github.com/IBM/sarama"
func publishCharged(p sarama.SyncProducer) error {
_, _, err := p.SendMessage(&sarama.ProducerMessage{Topic: "payments.charged", Value: sarama.StringEncoder("{}")})
return err
}
func main() {
p, _ := sarama.NewSyncProducer([]string{"kafka:9092"}, nil)
_ = publishCharged(p)
}
// consumer/main.go
package main
import (
"context"
"github.com/IBM/sarama"
)
type handler struct{}
func (handler) Setup(sarama.ConsumerGroupSession) error { return nil }
func (handler) Cleanup(sarama.ConsumerGroupSession) error { return nil }
func (handler) ConsumeClaim(s sarama.ConsumerGroupSession, c sarama.ConsumerGroupClaim) error {
for range c.Messages() {
}
return nil
}
func consumeCharged(g sarama.ConsumerGroup) error {
return g.Consume(context.Background(), []string{"payments.charged"}, handler{})
}
func main() {
g, _ := sarama.NewConsumerGroup([]string{"kafka:9092"}, "ledger-group", nil)
_ = consumeCharged(g)
}
- Commands:
codebase-memory-mcp cli query_graph '{"project":"<consumer>","query":"MATCH (a)-[r:ASYNC_CALLS]->(b) RETURN a.name, b.name, r"}'
codebase-memory-mcp cli get_graph_schema '{"project":"<producer>"}'
codebase-memory-mcp cli index_repository '{"repo_path":"/path/to/producer","name":"<producer>","mode":"cross-repo-intelligence","target_projects":["<consumer>"]}'
- Output: the consumer has one row,
main ledger-group {"callee":"sarama.NewConsumerGroup","url_path":"ledger-group",...};
the producer has no ASYNC_CALLS; andcross_async_calls: 0.
Attached repro.sh, section "Issue 3".
What we observed while debugging (instrumented build of 96c3f41c)
- The extracted
first_string_argvalues were:sarama.NewConsumerGroup->"ledger-group", the first string literal among the
arguments, which is the group ID;g.Consume-> none (the topic is inside a[]string{...}literal);p.SendMessage-> none (the topic is a struct field).
extract_composite_queue_field()already recovers topics from composite literals, but
is_queue_topic_field()(internal/cbm/extract_calls.c:2244) only accepts
QueueUrl/QueueURL/TopicArn/TopicARN/QueueName/TopicName/QueueArn/QueueARN/Destination.
It does not acceptTopic, which is the field used by saramaProducerMessage, kafka-go
Message/Writer/ReaderConfig, franz-gokgo.Recordand confluentTopicPartition.
AddingTopicalone madefirst_string_argbecomepayments.charged. The edge was
still not emitted, becausep.SendMessage(a method on a sarama-typed variable)
resolves to nothing and its callee text does not contain a service-pattern keyword.
This looks like the same external-package classification limit as the separate
net/httpreport.sarama.NewConsumerGroup/NewConsumerGroupFromClienttake a group ID, not a topic.
Excluding them, or reading topics fromConsume's[]stringargument instead, would
remove the false edge.
Full self-contained script (creates throwaway repos in a temp dir, isolated cache): see attached repro.sh.txt, section "Issue N". Run with bash repro.sh.txt
Logs
"== Issue 3: Go sarama topics not extracted; consumer group ID recorded as a topic"
repo i3-producer go.mod <<<'module example.com/producer
go 1.22
require github.com/IBM/sarama v1.45.0'
repo i3-producer main.go <<'GO'
package main
import "github.com/IBM/sarama"
func publishCharged(p sarama.SyncProducer) error {
_, _, err := p.SendMessage(&sarama.ProducerMessage{Topic: "payments.charged", Value: sarama.StringEncoder("{}")})
return err
}
func main() {
p, _ := sarama.NewSyncProducer([]string{"kafka:9092"}, nil)
_ = publishCharged(p)
}
GO
repo i3-consumer go.mod <<<'module example.com/consumer
go 1.22
require github.com/IBM/sarama v1.45.0'
repo i3-consumer main.go <<'GO'
package main
import (
"context"
"github.com/IBM/sarama"
)
type handler struct{}
func (handler) Setup(sarama.ConsumerGroupSession) error { return nil }
func (handler) Cleanup(sarama.ConsumerGroupSession) error { return nil }
func (handler) ConsumeClaim(s sarama.ConsumerGroupSession, c sarama.ConsumerGroupClaim) error {
for range c.Messages() {
}
return nil
}
func consumeCharged(g sarama.ConsumerGroup) error {
return g.Consume(context.Background(), []string{"payments.charged"}, handler{})
}
func main() {
g, _ := sarama.NewConsumerGroup([]string{"kafka:9092"}, "ledger-group", nil)
_ = consumeCharged(g)
}
GO
commit i3-producer; commit i3-consumer; index i3-producer; index i3-consumer
check "ASYNC_CALLS in producer (topic payments.charged)" "$(count i3-producer ASYNC_CALLS)" 1
echo " consumer ASYNC_CALLS edges (expected: one to topic payments.charged, none to the group ID):"
rows i3-consumer 'MATCH (a)-[r:ASYNC_CALLS]->(b) RETURN a.name, b.name, r' | sed 's/^/ /'
check "CROSS_ASYNC_CALLS producer -> consumer" "$(cross i3-producer i3-consumer cross_async_calls)" 1
Diagnostics trajectory (memory / performance / leak issues)
Project scale (if relevant)
No response
Confirmations
- I searched existing issues and this is not a duplicate.
- My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.
- Lingua principale
- C
- Stelle
- 45.8k
- Fork
- 3.8k
- Merge medio
- 3g 16h
- PR unite (30g)
- 203
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DeusData/codebase-memory-mcp
-
Index worker segfaults on PlantUML edge messages: dg_puml_operand leaves *id uninitializedForse già presa @nefayran l’ha presa oggi. Apertabug editor/integration stability/performance
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
DeusData/codebase-memory-mcp#2818 ·
I maintainer di solito rispondono entro 2 giorni
-
editor/integration parsing/quality
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DeusData/codebase-memory-mcp#2286 ·
I maintainer di solito rispondono entro 2 giorni
-
install writes an unsupported `args` key into the Claude Code SubagentStart hook, so it never runsApertabug editor/integration priority/high stability/performance ux/behavior
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
DeusData/codebase-memory-mcp#2239 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
bug priority/high ux/behavior
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
DeusData/codebase-memory-mcp#2232 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
documentation editor/integration parsing/quality priority/normal
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
DeusData/codebase-memory-mcp#2169 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di DeusData/codebase-memory-mcp
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
InukaAsith/TwinDesk#84 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
CanadaHonk/porffor#426 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
FujiNetWIFI/fujinet-firmware#2221 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 77/100
raysan5/raylib.com#132 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100