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

Register service provider for insights before get insights client #4710

Merged
merged 3 commits into from
Nov 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public abstract class AzureManagerBase implements AzureManager {
private static final String GLOBAL_SCM_SUFFIX = ".scm.azurewebsites.net";

private static final Logger LOGGER = Logger.getLogger(AzureManagerBase.class.getName());
private static final String MICROSOFT_INSIGHTS_NAMESPACE = "microsoft.insights";

protected Map<String, Azure> sidToAzureMap = new ConcurrentHashMap<>();
protected Map<String, AppPlatformManager> sidToAzureSpringCloudManagerMap = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -171,6 +172,13 @@ public InsightsManager getInsightsManager(String sid) throws IOException {
return null;
}
return sidToInsightsManagerMap.computeIfAbsent(sid, s -> {
try {
// Register insights namespace first
final Azure azure = getAzure(sid);
azure.providers().register(MICROSOFT_INSIGHTS_NAMESPACE);
} catch (IOException e) {
// swallow exception while get azure client
}
String tid = this.subscriptionManager.getSubscriptionTenant(sid);
return authApplicationInsights(sid, tid);
});
Expand Down