microsoft / microsoft/tracelogging
Feat: Add support for setting struct field size in tracelogging_dynamic for Rust
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 57
- Forks
- 27
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 1
Description
Description
When working with ETW events, I noticed we are missing the functionality to create a struct, and then populate it, and lastly, set it struct size. This workflow is typical in tracelogging_dynamic scenarios, where not all the data for the struct is known ahead of time. This facilitates a lot of workflows and code structure.
Example:
use tracelogging_dynamic as tld;
let mut field_count = 2;
let event = tld::EventBuilder::new();
// Create struct
event.add_struct("Struct", field_count, 0);
event.add_str8("string1", "value", tld::OutType::Default, 0);
event.add_str8("string2", "value", tld::OutType::Default, 0);
if let Some(value) = Some("hello, world".to_string()) {
event.add_str8("greeting",value, tld::OutType::Default, 0);
field_count = field_count + 1;
}
event.set_struct_field_count("Struct", field_count); // <-- Missing method
}
Other implementations
Other tracelogging implementation have this method:
https://github.com/open-telemetry/opentelemetry-dotnet-contrib/blob/3698be915322216aa126a67f19100b1cd93bb6c9/src/OpenTelemetry.Exporter.Geneva/External/TraceLoggingDynamic.cs#L1746
Feature Request:
Implement set_struct_field_count in EventBuilder struct for Rust in tracelogging_dynamic crate.
Contributor 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.
Research direction
Start by locating the EventBuilder implementation in the tracelogging_dynamic crate and review add_struct alongside the linked TraceLoggingDynamic.cs implementation. Implement and validate set_struct_field_count so the example's optional-field workflow can update the struct count after fields are added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- observability, operating-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100