Skip to content
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

reporter: do not add empty attributes #233

Merged
merged 4 commits into from
Nov 18, 2024
Merged

Conversation

florianl
Copy link
Contributor

@florianl florianl commented Nov 8, 2024

PR #212 changed the behaviour of addProfileAttributes(). Before adding an attribute the length of the string was checked - see

if attr.value == "" {
return
}

This returns to the original behaivour, where string attributes with no values are not added.

PR #212 changed the behaviour of addProfileAttributes(). Before adding an attribute the length of the string
was checked - see https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/0c58efd41280bce80cca9804896c76874d383b35/reporter/otlp_reporter.go#L747-L749

This returns to the original behaivour, where string attributes with no
values are not added.

Signed-off-by: Florian Lehner <[email protected]>
@florianl florianl requested review from a team as code owners November 8, 2024 16:38
Copy link
Member

@athre0z athre0z left a comment

Choose a reason for hiding this comment

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

LGTM!

Edit: ah, "empty" variant of TestGetSampleAttributes test needs fix-up.

Signed-off-by: Florian Lehner <[email protected]>
@rockdaboot
Copy link
Contributor

PR #212 changed the behaviour of addProfileAttributes(). Before adding an attribute the length of the string was checked.

This has been changed on purpose because how else are we going to differentiate in the backend
a) key exists with empty value
b) key does not exist
?

If the backend doesn't want to store empty values, these should be filtered out in the backend.
Other backends may want to store empty and NULL values.

Signed-off-by: Florian Lehner <[email protected]>
@florianl
Copy link
Contributor Author

To meet OTel SemConv requirements, a field was added to attrKeyValue indicating Required attributes, so that they are sent also with empty values. I have checked the OTel SemConv attributes we are sending out atm and non of them is marked as a Required attribute so far.

@rockdaboot
Copy link
Contributor

To meet OTel SemConv requirements, a field was added to attrKeyValue indicating Required attributes, so that they are sent also with empty values. I have checked the OTel SemConv attributes we are sending out atm and non of them is marked as a Required attribute so far.

IMO these are two different pairs of shoes.
To my understanding, a "semconv required" field is required because otherwise parts or all of the data doesn't make much sense to the backend/receiver.
And in this PR it is about allowing the backend/receiver to differentiate between "information not available" and "information available: empty string" or not. We should allow the backend/receiver to distinguish these cases and act accordingly. In other words, the client makes this decision without knowing anything about the backend, which is plain wrong in my eyes.

@florianl
Copy link
Contributor Author

IMO these are two different pairs of shoes.
To my understanding, a "semconv required" field is required because otherwise parts or all of the data doesn't make much sense to the backend/receiver.

Please provide a list of attributes that should be always sent, also with empty values. What qualifies an attribute to be required to be sent always, also without value, if the OTel SemConv does not set the requirement level Required for this attribute?

@rockdaboot
Copy link
Contributor

IMO these are two different pairs of shoes.
To my understanding, a "semconv required" field is required because otherwise parts or all of the data doesn't make much sense to the backend/receiver.

Please provide a list of attributes that should be always sent, also with empty values. What qualifies an attribute to be required to be sent always, also without value, if the OTel SemConv does not set the requirement level Required for this attribute?

It's two different things. I am seeking for clarification for how to transport the information "no value" and "empty value" to the server, no matter if the attribute is required or not.

This PR skips sending an attribute in both cases, so the server side can simply not say if that is due to a missing value or due to an explicit empty string.

At least the Elastic backend currently doesn't distinguish between those two cases for the existing attributes, so I am fine with this PR. And the cases where it matters are mostly theoretical and can be worked around in other ways.

@florianl
Copy link
Contributor Author

I am seeking for clarification for how to transport the information "no value" and "empty value" to the server, no matter if the attribute is required or not.

If there is an essential attribute that should be sent always, please name it. Then the required field in attrKeyValue can be set for it and it will be send always - even with empty values.

@rockdaboot
Copy link
Contributor

I am seeking for clarification for how to transport the information "no value" and "empty value" to the server, no matter if the attribute is required or not.

If there is an essential attribute that should be sent always, please name it. Then the required field in attrKeyValue can be set for it and it will be send always - even with empty values.

I originally thought about the COMM value (thread name), which can be set to an arbitrary value by the application, even to an empty string. But currently it won't matter to our backend if it is empty or not available.

Another thought: should we also skip sending integer attributes if the value is 0?

@rockdaboot
Copy link
Contributor

Is there any blocker or can this be merged?

@florianl florianl merged commit e40ccae into main Nov 18, 2024
23 checks passed
@florianl florianl deleted the flo-addProfileAttributes branch November 18, 2024 13:13
@florianl
Copy link
Contributor Author

sorry - I did forget about this one. too many tasks on the radar.

ltrk2 added a commit to instana/opentelemetry-ebpf-profiler that referenced this pull request Dec 4, 2024
* Fix unwinding at syscall on aarch64 (open-telemetry#218)

* Add PID as an attribute in each sample (open-telemetry#212)

* ebpf: increase number of stack delta buckets (open-telemetry#231)

Signed-off-by: Florian Lehner <[email protected]>

* reporter: use htlhash attribute for profiling specific hash (open-telemetry#236)

Signed-off-by: Florian Lehner <[email protected]>

* reporter: drop fifo (open-telemetry#239)

Signed-off-by: Florian Lehner <[email protected]>

* Drop more unused code (open-telemetry#240)

* reporter: do not add empty attributes (open-telemetry#233)

Signed-off-by: Florian Lehner <[email protected]>

* controller: fix reporter interval mix up with monitor interval (open-telemetry#242)

* Extract reporter runloop (open-telemetry#228)

Co-authored-by: Christos Kalkanis <[email protected]>

* Extract lookupcgroupv2 out of the otlp reporter (open-telemetry#227)

* Add CPU id to trace and trace metadata (open-telemetry#249)

* reporter: don't expire actively used executables (open-telemetry#247)

* Remove legacy code from libpf.UnixTime64 (open-telemetry#252)

* Turn kernel module file parsing errors into warnings (open-telemetry#255)

Co-authored-by: Florian Lehner <[email protected]>

* readatbuf: add missing check when reading from tail chunk (open-telemetry#259)

* metrics: Don't send counters with 0 values (open-telemetry#246)

---------

Signed-off-by: Florian Lehner <[email protected]>
Co-authored-by: umanwizard <[email protected]>
Co-authored-by: Bhavna Jindal <[email protected]>
Co-authored-by: Florian Lehner <[email protected]>
Co-authored-by: Tim Rühsen <[email protected]>
Co-authored-by: Nayef Ghattas <[email protected]>
Co-authored-by: Damien Mathieu <[email protected]>
Co-authored-by: Christos Kalkanis <[email protected]>
Co-authored-by: Tommy Reilly <[email protected]>
Co-authored-by: Joel Höner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants