-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[extension/opamp] Make reported service.instance.id always match Collector resource attributes #46495
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
jade-guiton-dd
wants to merge
11
commits into
open-telemetry:main
Choose a base branch
from
jade-guiton-dd:opamp-matching-service-instance-id
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[extension/opamp] Make reported service.instance.id always match Collector resource attributes #46495
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
729fef4
Make reported service.instance.id always match Collector resource att…
jade-guiton-dd e42a245
Fix error when `service.instance.id` isn't set (usually tests)
jade-guiton-dd 184d973
Add PR number to changelog
jade-guiton-dd 6e8a8d1
Update supervisor to check instance UID instead of service.instance.id
jade-guiton-dd dcdef68
instance_uid is no longer taken from service.instance.id
jade-guiton-dd 23d4123
Fix TestNewOpampAgentAttributes
jade-guiton-dd 3800815
Fix TestSupervisorAgentDescriptionConfigApplies
jade-guiton-dd 2ab8dff
Try explicitly setting service.instance.id in Supervisor
jade-guiton-dd 3d79558
Set service.instance.id in opampextension.yaml instead so it's presen…
jade-guiton-dd cbc4513
Adjust tests that don't expect the service.instance.id resource attri…
jade-guiton-dd de9055a
Rename opampAgent fields for clarity
jade-guiton-dd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Use this changelog template to create an entry for release notes. | ||
|
|
||
| # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
| change_type: 'bug_fix' | ||
|
|
||
| # The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog) | ||
| component: extension/opamp | ||
|
|
||
| # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
| note: Decorrelate `service.instance.id` and OpAMP `instance_uid` | ||
|
|
||
| # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
| issues: [46495] | ||
|
|
||
| # (Optional) One or more lines of additional information to render under the primary note. | ||
| # These lines will be padded with 2 spaces and then inserted directly into the document. | ||
| # Use pipe (|) for multiline entries. | ||
| subtext: | | ||
| Previously: | ||
| - the `service.instance.id` reported in the AgentDescription was based on the OpAMP instance UID | ||
| - the instance UID was typically set based on the `service.instance.id` from the Collector resource attributes | ||
| - it could be overriden using the `instance_uid` configuration of the OpAMP extension | ||
|
|
||
| This meant that the reported `service.instance.id` did not always match the Collector resource attributes, | ||
| which is a problem for correlation, and that server implementations got used to the typical case of | ||
| `service.instance.id` and `instance_uid` matching, despite there being no guarantee of this. | ||
|
|
||
| Now: | ||
| - the reported value of `service.instance.id` always matches the Collector resource attributes | ||
| - the instance UID is either taken from the `instance_uid` configuration or generated randomly. | ||
|
|
||
| This means that the two values can never be expected to match, unless both configurations are explicitly set to the same value. | ||
| That is what the OpAMP supervisor does, which means its behavior is unaffected. | ||
|
|
||
|
|
||
| # If your change doesn't affect end users or the exported elements of any package, | ||
| # you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
| # Optional: The change log or logs in which this entry should be included. | ||
| # e.g. '[user]' or '[user, api]' | ||
| # Include 'user' if the change is relevant to end users. | ||
| # Include 'api' if there is a change to a library API. | ||
| # Default: '[user]' | ||
| change_logs: [user] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,3 +13,6 @@ extensions: | |
|
|
||
| service: | ||
| extensions: [opamp] | ||
| telemetry: | ||
| resource: | ||
| "service.instance.id": "{{.InstanceUid}}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed? Looks weird. I think we should assert on some expected service instance ID here, no?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, you're right. I removed it because the test was failing and I thought it was testing the extension (in which case we expect the instance ID to be random), but since this seems to be for the supervisor I would expect it to match the instance UID...
The usual error seems to be "could not get bootstrap info from the Collector: collector's OpAMP client never connected to the Supervisor", which I can't easily relate to any of my changes. I've been trying to debug these tests for a while but I'm honestly somewhat at a loss, mostly because all the useful logic happens in a different process, so the debugger never gets attached. Do you have advice on where the discrepancy could come from?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried some stuff locally and I hit a similar problem to you, @jade-guiton-dd. I could run only this specific test with
go test -tags=e2e -run 'TestSupervisorAgentDescriptionConfigApplies' -count=1 -v .(in thecmd/opampsupervisorfolder) though.It seems like
require.Subsetends up comparing values withreflect.DeepEqual(see https://github.com/stretchr/testify/blob/v1.11.1/assert/assertions.go#L71) and I think the protobuf types might somehow be interfering with the comparison now, but I don't understand why.I did some local changes to convert
[]*protobufs.Keyvalueto amap[string]stringand I got a proper test failure due to mismatch in expected values:When I run the test above with the assertion that this PR removed on the
service.instance.idplus this patch applied I get this:Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so that confirms that the supervisor is not properly setting
service.instance.idat the Collector level.I originally assumed it did because of this template, but after looking deeper into it, I'm not actually sure how
ResourceAttributesis filled. It definitely contains the explicitly-specified values fromagent.description.identifying_attributes, but I'm not sure ifservice.instance.idis ever added in there.So I guess there are two options:
service.instance.idis always set to the OpAMP instance UID, which would require modifying the code to make sure the resource attribute is always overwrittenUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since for some reason the test is still failing for me locally, I tried pushing a new version with a modified
composeExtraTelemetryConfigthat adds the test line back in and always setsservice.instance.idto the instance UID (unless explicitly set ins.agentDescription)Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I figured it out.
service.instance.idis becausecomposeExtraTelemetryConfigis not called when composing the configuration for the bootstrap Collector. So I instead decided to set the attribute directly insidetemplates/opampextension.yaml. This seems to fix the test, which is also simplified a bit from the patch you suggested above. I am assuming this will compose gracefully with the "extra telemetry" configuration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. I'm happy that this is fixed and that you could use a simpler patch 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do a full review pass in a bit. Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@douglascamata did you find the time to review this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll find some time to check it out later today or tomorrow. 👍