Skip to content

Conversation

@pankaj101A
Copy link
Contributor

@pankaj101A pankaj101A commented Sep 3, 2025

Description

This pr removes the collector name from the local credentials path that extension uses for authentication. This allows changing the name of the collector without registration. See #42511

Changes

  1. Credential key (hashKeyV2) now derives only from InstallationToken and APIBaseURL.
  2. collectorName no longer affects credential storage.
  3. Added backward compatibility: falls back to old key (v1) if v2 not found.
  4. On shutdown, v1 credentials are migrated to v2.
  5. Updated tests to cover v1 → v2 migration and ensure correct credential usage.

Link to tracking issue

Resolves #42511

Testing

Testing on local are performed link

Documentation

@pankaj101A pankaj101A requested a review from a team as a code owner September 3, 2025 06:02
@pankaj101A pankaj101A requested a review from dashpole September 3, 2025 06:02
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 3, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@github-actions github-actions bot added the first-time contributor PRs made by new contributors label Sep 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2025

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!

Copy link
Contributor

@echlebek echlebek left a comment

Choose a reason for hiding this comment

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

This PR needs to more carefully describe what the change is, and its impacts. Please post the design document in the PR description and include the background motivation for this change.

@echlebek
Copy link
Contributor

echlebek commented Sep 3, 2025

Please file an issue that this PR can resolve. Please include a changelog entry.

@pankaj101A pankaj101A requested a review from echlebek September 5, 2025 08:25
@pankaj101A pankaj101A changed the title chore:removing collector name from credential path for sumologic [extension/sumologicextension] removing collector name from credential path for sumologic Sep 16, 2025
Copy link
Contributor

@echlebek echlebek left a comment

Choose a reason for hiding this comment

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

Things are looking generally good to me code-wise. However I am not sure about logging the hash key. I think it would be better to avoid doing that.

@rnishtala-sumo
Copy link
Contributor

rnishtala-sumo commented Sep 19, 2025

@pankaj101A I think we're missing a few scenarios here. The collector name is currently tied to the registration process (probably should have been a UID instead). Changing the collector name without re-registering it may cause some of the metadata like _sourceHost and _sourceCategory to be inconsistent with the collector name which may not be desirable to the customer.

Also, The collector name can currently be set in the sumo extension and is current part of the registration request payload. What happens in a re-registration cycle if we allowed a user to change the collector name outside registration? Would it override the manual change?

Here's the registration payload, which sets collector fields and the timezone along with the collector name:

https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/extension/sumologicextension/extension.go#L433

I don't think we should allow a customer to change the collector name without re-registration, unless we understand the full implications of doing so or decouple the collector name from registration. Other custom collector fields are also currently tied to registration.

cc: @echlebek

Copy link
Contributor

@rnishtala-sumo rnishtala-sumo left a comment

Choose a reason for hiding this comment

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

Recommend that we re-evaluate this change based on this comment.

Copy link
Contributor

@fguimond fguimond left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@rnishtala-sumo rnishtala-sumo left a comment

Choose a reason for hiding this comment

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

LGTM, lets ensure that the tests pass and that the E2E tests test the upgrade scenario to ensure that collectors do not re-register on upgrade.

@echlebek
Copy link
Contributor

@crobert-1 would you be able to approve the pending workflows to run? Thank you!

@crobert-1
Copy link
Member

Scoped tests are failing, it appears to be related to this PR. Please fix the failing tests and I'll be able to review from there 👍


_, err = credentialsStore.Get(hashKeyV2)
if err != nil {
logger.Info("credentials not found, trying legacy credentials", zap.Error(err))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
logger.Info("credentials not found, trying legacy credentials", zap.Error(err))
logger.Info("credentials not found, using legacy credentials", zap.Error(err))

Nit: When I see the word trying I assume some other work will happen, but that's not the case. I think this wording may be more clear. Feel free to drop.

@crobert-1 crobert-1 added the ready to merge Code review completed; ready to merge by maintainers label Sep 24, 2025
@github-actions
Copy link
Contributor

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!

@songy23 songy23 merged commit 47921b8 into open-telemetry:main Sep 25, 2025
203 checks passed
@github-actions github-actions bot added this to the next release milestone Sep 25, 2025
@otelbot
Copy link
Contributor

otelbot bot commented Sep 25, 2025

Thank you for your contribution @pankaj101A! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension/sumologic first-time contributor PRs made by new contributors ready to merge Code review completed; ready to merge by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing collector name creates duplicate credentials in sumologicextension

6 participants