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

[redisstorageextension] allow redis key prefix to be specified in config #37677

Merged
merged 6 commits into from
Mar 5, 2025

Conversation

HubertFraczek
Copy link
Contributor

Description

The purpose of this PR is to allow the user to specify the redis key prefix. The lack of this feature has become problematic when using multiple replicas in a kubernetes cluster - until now, the key prefix has been based on the storage extension and receiver names, which are the same for each replica because they share the same configuration and therefore overwrite the same key in redis. With the changes in this PR, the user can specify the prefix as an environmental variable (which can have different value for each replica), for example.

Testing

opentelemetry-collector-contrib (0.118.0) was built with this change and tested on a kubernetes cluster

Config used for testing:

redis_storage:
  endpoint: redis.monitoring.svc.cluster.local:6379
  prefix: ${K8S_NODE_NAME}

Documentation

Updated README.md to add new config parameter.

@HubertFraczek HubertFraczek requested review from atoulme and a team as code owners February 4, 2025 14:55
Copy link

linux-foundation-easycla bot commented Feb 4, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@origama
Copy link

origama commented Feb 10, 2025

Hey guys, is there any process to follow to get the PR reviewed? Or is it just a matter of time?

- `db` (optional): Database to be selected after connecting to the server. Default: 0
- `expiration` (optional): TTL for all storage entries. Default TTL means the key has no expiration time. Default: 0
- `prefix` (optional): Prefix to be used for a redis key. Default:`<component_kind>_<component_type>_<component_name>_<storage_extension_name>` - e.g. `receiver_filelog_` if filelog receiver & redisstorage extension have no names
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you update the documentation with the new semantics as well?

@swiatekm
Copy link
Contributor

@HubertFraczek you're going to need to add a changelog entry as well. Try running make chlog-new in the project root and fill in the template it creates for you.

Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the contribution!

@github-actions github-actions bot requested a review from atoulme February 12, 2025 00:50
@atoulme atoulme added ready to merge Code review completed; ready to merge by maintainers and removed ready to merge Code review completed; ready to merge by maintainers labels Feb 12, 2025
@atoulme
Copy link
Contributor

atoulme commented Feb 12, 2025

build fails with

Error: redisstorageextension/extension_test.go:248:4: expected-actual: need to reverse actual and expected values (testifylint)
			require.Equal(t, got, tt.expected)
			^

Please address and we will get this in.

@HubertFraczek
Copy link
Contributor Author

Is there anything left for me to do? I also wanted to ask if these changes will appear in the next release

@swiatekm
Copy link
Contributor

Is there anything left for me to do? I also wanted to ask if these changes will appear in the next release

You just need to address review comments as they come, and after there's sufficient approvals, your PR will be merged. The change will appear in whichever release happens afterwards. Releases happen every 2 weeks, so you typically don't need to wait for long.

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 28, 2025
@HubertFraczek
Copy link
Contributor Author

HubertFraczek commented Feb 28, 2025

Hi, what is the progress with this PR? Is the fix for that failing unit test from that other extension merged to main? Can we re-run pipelines and merge this PR in?

@github-actions github-actions bot removed the Stale label Mar 1, 2025
@github-actions github-actions bot requested a review from atoulme March 5, 2025 22:45
@atoulme atoulme merged commit af380c9 into open-telemetry:main Mar 5, 2025
156 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants