[Azure.Monitor] Add sovereign support for Query and Ingestion#37819
[Azure.Monitor] Add sovereign support for Query and Ingestion#37819nisha-bhatia wants to merge 8 commits intoAzure:mainfrom
Conversation
|
Ingestion is still a wip, will be added later |
|
API change check API changes are not detected in this pull request. |
|
|
||
| private Dictionary<string, string> regions = new Dictionary<string, string>() | ||
| { | ||
| { "AzureCloud", "https://api.loganalytics.io/v1" }, |
There was a problem hiding this comment.
Is it not possible to pull this down via the bicep file?
There was a problem hiding this comment.
No I don't believe so. Other languages are pulling from the test environment as well
There was a problem hiding this comment.
So the service doesn't expose these endpoints programmatically? Users have to look at docs?
There was a problem hiding this comment.
Not sure about monitor in particular but a lot of services have this hard coded and expect people to discover this through documentation.
There was a problem hiding this comment.
I am curious about v1 in the end - Does the service have v2 endpoints too? Is this their versioning scheme?
There was a problem hiding this comment.
Yes the service is in v1 right now and v2 I'm assuming will come out in the future.
| private string GetEndpoint() | ||
| { | ||
| string endpoint = ""; | ||
| if (regions.TryGetValue(Environment.GetEnvironmentVariable(ENV_MONITOR_ENVIRONMENT), out string region)) |
There was a problem hiding this comment.
How does this environment variable get set?
There was a problem hiding this comment.
| public string ResourceId => GetRecordedVariable("RESOURCE_ID"); | ||
| public string WorkspacePrimaryResourceId => GetRecordedVariable("WORKSPACE_PRIMARY_RESOURCE_ID"); | ||
| public string WorkspaceSecondaryResourceId => GetRecordedVariable("WORKSPACE_SECONDARY_RESOURCE_ID"); | ||
| public Uri LogsEndpoint => new(GetEndpoint()); |
There was a problem hiding this comment.
This will fail during playback as we are no longer looking up the recorded variable.
There was a problem hiding this comment.
I can check if the mode is playback and set it to the default?
There was a problem hiding this comment.
No, if it is playback it would need to check the recorded value in the session record, which is what GetRecordedVariable does.
It would probably be cleaner if we could move the GetEndpoint logic directly into the bicep file so that we are setting the LOGS_ENDPOINT env var based on the Azure Environment.
There was a problem hiding this comment.
If we don't want to go that route, then we would at least need to condition on whether we are in PlayBack mode and if so, call GetRecordedVariable rather than GetEndpoint.
|
/azp run net - Azure.Monitor.Query - tests-weekly |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@nisha-bhatia Reminder to also update the READMEs in this PR |
|
/azp run net - Azure.Monitor.Query - tests-weekly |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - Azure.Monitor.Query - tests-weekly |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - Azure.Monitor.Query - tests-weekly |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run net - Azure.Monitor.Query - tests-weekly |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Closing this PR: sovereign support will be addressed after metricsBatch #38640 |
Fixes #32169