-
Notifications
You must be signed in to change notification settings - Fork 544
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
Allow environment variables for Azure storage credentials #1147
Conversation
47e5185
to
c4ed256
Compare
modules/storage/config.go
Outdated
@@ -47,8 +48,8 @@ func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet) | |||
cfg.Trace.Block.SearchPageSizeBytes = 1024 * 1024 // 1 MB | |||
|
|||
cfg.Trace.Azure = &azure.Config{} | |||
f.StringVar(&cfg.Trace.Azure.StorageAccountName.Value, util.PrefixConfig(prefix, "trace.azure.storage-account-name"), "", "Azure storage account name.") | |||
f.StringVar(&cfg.Trace.Azure.StorageAccountKey.Value, util.PrefixConfig(prefix, "trace.azure.storage-account-key"), "", "Azure storage access key.") | |||
f.StringVar(&cfg.Trace.Azure.StorageAccountName.Value, util.PrefixConfig(prefix, "trace.azure.storage-account-name"), os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), "Azure storage account name.") |
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.
Does the Azure client not pick these up automatically? The AWS client will check all the standard methods of providing auth including env vars if they are not explicitly provided.
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 look again because that would be my preference also. Doing it here means that the current client implementation can remain the same.
https://github.com/grafana/tempo/blob/main/tempodb/backend/azure/azure_helpers.go#L23
I also looked briefly at updating the client, since the one we are using seems to be deprecated, or at least they are encouraging users to migrate. But I didn't have the context on all the changes in that update since I'm new to Azure and learning.
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.
If they are loading environment variables in the client, I don't see where. And they don't make it easy to find if they support some. I think the updated client might though.
Instead of setting the defaults I would prefer checking for values during the creation of the backend. If these two config fields are not set at that time then checking the env vars. Also, any idea what the standards are here? It seems like the cli uses different env vars: Also note that this can already be done b/c Tempo can interpolate env vars into the config if you set the |
51e253d
to
3b80004
Compare
Good call on checking the CLI, we can use that our standard. I saw the |
Oh to your other point about relocating the loading, I'll follow up on that too. I noticed that if those values aren't set, we could improve the error. |
320c08b
to
e1ef0ea
Compare
I've moved the environment loading where we make use of the variables. If we'd prefer to move that to the |
9b1ee77
to
9df416f
Compare
This is looking really good. I have one more ask and then we'll merge. Can you please add azure docs similar to our S3/GCS docs. You don't need to include all the permissions if you don't know them right now (but I'd ask that you come back and add them in the future): Link to them here: tempo/docs/tempo/website/configuration/_index.md Lines 288 to 290 in 35574f7
and then add a doc similar to this: |
c04a6dc
to
9770c55
Compare
I've included some initial docs for what we have currently. I'll also keep them updated as I find new information, but I think that should get us going. |
What this PR does:
Allow default values for Azure storage to be pulled from the environment.
Update examples and operations to use the newer backend-agnostic metric name.
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]