How can a Format get access to custom fields in a ProtoProducerMessage?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 24/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go
- Domain
- backend-api-design
Research direction
Start by reading the custom Format interface and ProtoProducerMessage implementation, especially the unexported mapUnknown method mentioned in the issue. Check how the built-in JSON and Text formatters expose custom fields and how YAML maps the NFv9 fields to protobuf fields 901–904. Done means a custom Format can access the needed IN_BYTES and IN_PACKETS values while using the existing NFv9 producer.
Written by the indexing model from the issue text.
Description
Not sure where to ask this, so I filed an issue. Let me know if there is a better channel for questions.
I am trying to migrate netflow2ng to goflow2.
In order to do this, I am using goflow2 to as a library, and I wrote and registered a couple of new Formats (there's a custom JSON format and a another custom binary format), and then a ZMQ Transport. I have the basics of this working.
As part of doing this, I ran into Issue #186, where goflow2 will prefer OUT_BYTES/OUT_PACKETS for the values for the FlowMessage.Bytes/Packets Protobuf. To get around this, I followed the advice in that thread and used a Yaml config to map all four IN/OUT NFv9 fields to custom proto fields (901, 902, 903, 904).
My problem is that from inside my new Formats Format() function, I am passed an interface which is really a ProtoProducerMessage, which is a wrapper around a FlowMessage. I cannot figure out a way to access the custom proto fields (901, 902, 903, 904) in ProtoProducerMessage. I have verified they are there. If I use the built in Json or Text formatters, these fields are there. But looking at the goflow2 code, it tools like doing that relies on ProtoProducerMessage.mapUnknown(), which is not exported.
What's the right way to do this?
TL;DR: I want to write my own Formats that has access to both IN_BYTES and OUT_BYTES from NFv9. I don't think I want my own Producer, I'm happy with all the work the current NFv9 sampling producer is doing, I just need to keep IN_BYTES and OUT_BYTES. Actually I really only need to keep IN_BYTES, IN_PACKETS.
- Dominant language
- Go
- Stars
- 817
- Forks
- 182
- Avg merge
- 4h 18m
- Merged PRs (30d)
- 6
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from netsampler/goflow2
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
netsampler/goflow2#601 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
netsampler/goflow2#539 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 20/100
netsampler/goflow2#528 ·
Maintainers usually reply within 1 day
-
NetFlow v9: zero OUT_BYTES/OUT_PKTS (FreeBSD ng_netflow/OPNsense) overwrite real IN_BYTES/IN_PKTS — bytes always 0Possibly taken @devMaxMcCann claimed this 8 days ago. Open
Difficulty 3/5 Half a day Newbie friendliness 52/100
netsampler/goflow2#524 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
netsampler/goflow2#523 · 2 comments ·
Maintainers usually reply within 1 day
All issues in netsampler/goflow2
Similar issues
-
enhancement exporter/awskinesis needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
open-telemetry/opentelemetry-collector-contrib#53334 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
erigontech/erigon#26523 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
SocialGouv/iterion#3376 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
seaweedfs/seaweedfs#12740 · 2 comments ·
Maintainers usually reply within 1 day
-
area:indexer bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
seanb4t/codegraph-go#385 ·
Maintainers usually reply within 1 day