Skip to content

Initial multi channel trace file format specification #841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

pmai
Copy link
Contributor

@pmai pmai commented Nov 24, 2024

Based on the initial specification work in #833 with refactoring for better integration into OSI and with clearer separation of concerns.

@pmai pmai self-assigned this Nov 24, 2024
@pmai
Copy link
Contributor Author

pmai commented Nov 24, 2024

Note that this leaves out for now specifics of how to structure additional non-OSI meta-data, which should likely be handled in layered specifications based on the rdns prefixes, and any larger changes to the naming convention. The later is only a recommendation in any case, and if further changes are wanted they should apply to the whole convention and be handled in a separate PR (e.g. one could think about making the timestamp optional, or dropping the protobuf version, but that would make sense - or not - for all formats and hence is not related to the multi trace file format).

Copy link
Contributor Author

@pmai pmai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review comments from discussion with @jdsika and @thomassedlmayer

@ClemensLinnhoff
Copy link
Contributor

I don't think any further review from @TimmRuppert or me is necessary here. Feel free to merge your solution whenever you are ready.

@jdsika
Copy link
Contributor

jdsika commented Nov 26, 2024

@pmai is it possible to commit the discussed changes until 1pm and I have a final review and put the PR into ready state with the tag "readyForCCB"?

@pmai pmai marked this pull request as ready for review November 26, 2024 11:28
@jdsika jdsika added this to the V3.7.1 milestone Nov 26, 2024
The following rules apply to OSI multi channel trace files:

- The file extension to be used is `.mcap`.
- The file must be a valid MCAP file according to the https://mcap.dev/spec[MCAP format specification] version `0x30`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TimmRuppert I actually cannot find a version number for the MCAP specification but only different ones for the associated libraries and CLI which is then different for Python, C++, etc .... I am a bit confused. Is this the specification version 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec goes about it in a very round-about way:

Magic
An MCAP file must begin and end with the following magic bytes:

0x89, M, C, A, P, 0x30, \r, \n

The byte following "MCAP" is the major version byte. 0x30 is the ASCII character 0. Any changes to this specification document (i.e. adding fields to records, introducing new records) will be binary backward-compatible within the major version.

(Emphasis by me)

So it is stated quite unclearly, but I would treat this as the major version of the specification, given the statements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what confuse me. "include the major version like this" but not "this spec IS major version 0" ...

@jdsika jdsika added FeatureRequest Proposals which enhance the interface or add additional features. Documentation Everything which impacts the quality of the documentation and guidelines. labels Nov 27, 2024
@asadekasam asadekasam requested a review from ijelec May 20, 2025 10:58
@asadekasam asadekasam added the ReadyForCCBReview Indicates that this MR is ready for a final review and merge by the CCB. label May 21, 2025
Copy link

@ijelec ijelec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are just two points on naming convention and time definitions that were discussed during our meeting. No other objections to merging.

@jdsika
Copy link
Contributor

jdsika commented May 28, 2025

from internal:

I have some questions about the PR:

  1. The OSI multi channel trace file format is a binary file format that allows for storing multiple serialized OSI message streams of the same or different types in one trace file, along with additional meta-data, and other related data streams. - what is "other related data streams" how do we know whether it is related or not.
  2. For each OSI top-level message type that is used in one or more OSI channels, the OSI multi channel trace file must contain a corresponding schema record in the summary section. - What happens to non-top-level message type?
  3. An OSI channel is a data stream within the OSI multi channel trace file that contains serialized OSI top-level messages of the same type. Note that non-top-level messages must not be stored directly in OSI channels. - How are non top level messages stored?

@TimmRuppert
Copy link

  1. The OSI multi channel trace file format is a binary file format that allows for storing multiple serialized OSI message streams of the same or different types in one trace file, along with additional meta-data, and other related data streams. - what is "other related data streams" how do we know whether it is related or not.

Ultimately, I think it's up to the user to decide. For example, a sensor model that also outputs some non-OSI debug data could still be considered a related data stream. On the other hand, a list of my latest cookie recipes probably wouldn't be ;)

  1. For each OSI top-level message type that is used in one or more OSI channels, the OSI multi channel trace file must contain a corresponding schema record in the summary section. - What happens to non-top-level message type?

The answer is basically question 3.

  1. An OSI channel is a data stream within the OSI multi channel trace file that contains serialized OSI top-level messages of the same type. Note that non-top-level messages must not be stored directly in OSI channels. - How are non top level messages stored?

Well, you don’t. It seems the documentation might leave room for misinterpretation. Perhaps it should be made more explicit - for example, by stating clearly at the beginning of the section 'The following rules apply to OSI multi-channel trace files' that non-top-level messages may only be stored as sub-elements within the channel of a top-level message.

@thomassedlmayer
Copy link
Contributor

thomassedlmayer commented Jun 3, 2025

The OSI multi channel trace file format is a binary file format that allows for storing multiple serialized OSI message streams of the same or different types in one trace file, along with additional meta-data, and other related data streams. - what is "other related data streams" how do we know whether it is related or not.

I think it is the responsibility of the creator of a file to ensure that related data streams are written/described in a way so that a reader of the file knows that it is indeed related and also how it is related. For the top-level OSI messages we thought about that and therefore defined rules for timestamps etc. But for data streams/channels that are not specified in this PR this is not the responsibility of the OSI specification to define. What is the goal of putting unrelated data in there?

An OSI channel is a data stream within the OSI multi channel trace file that contains serialized OSI top-level messages of the same type. Note that non-top-level messages must not be stored directly in OSI channels. - How are non top level messages stored?

You can still put non-top-level messages as "non-official top-level messages" into an mcap container if you desire to do so. This does not meet the OSI-mcap specification in the sense that there is a high probability that standard-conform tools are able to work with it. Though, the specification does not keep you from putting arbitrary data into your mcap containers. That's why it specifically allows to have "other related data streams" in the same mcap container. And in my opinion, if it is technically possible to pack non-top-level OSI protobuf-encoded messages into a separate mcap channel, you're free to do so, even if the relation to the rest of the OSI data might not be clear anymore (because of missing timestamp etc.).

pmai and others added 9 commits June 10, 2025 13:27
Based on the initial specification work with refactoring for better
integration into OSI and with clearer separation of concerns.

Signed-off-by: Pierre R. Mai <[email protected]>
Co-authored-by: Clemens Linnhoff <[email protected]>
Signed-off-by: Pierre R. Mai <[email protected]>
Co-authored-by: Thomas Sedlmayer <[email protected]>
Signed-off-by: Pierre R. Mai <[email protected]>
* Make zero_time and creation_time recommended

Signed-off-by: Carlo van Driesten <[email protected]>
Based on review feedback

Signed-off-by: Pierre R. Mai <[email protected]>
@pmai pmai force-pushed the feature/multi-trace-file-format branch from 1bc0627 to 1d96e47 Compare June 10, 2025 11:27
@pmai pmai dismissed ClemensLinnhoff’s stale review June 10, 2025 11:29

As discussed with @TimmRuppert all issues have been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Everything which impacts the quality of the documentation and guidelines. FeatureRequest Proposals which enhance the interface or add additional features. ReadyForCCBReview Indicates that this MR is ready for a final review and merge by the CCB.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants