ApplicationInsights-Go icon indicating copy to clipboard operation
ApplicationInsights-Go copied to clipboard

Connection strings support

Open kpvenugo opened this issue 5 years ago • 1 comments

https://docs.microsoft.com/en-us/azure/azure-monitor/app/sdk-connection-string?tabs=net#overview https://docs.microsoft.com/en-us/azure/azure-monitor/app/custom-endpoints?tabs=net#regions-that-require-endpoint-modification

Connection strings are the new preferred method of setting custom endpoints within Application Insights. Request to share info on if this is supported already. If not could we raise a request for the same?

kpvenugo avatar Oct 06 '20 04:10 kpvenugo

It might be possible to accept either an Ikey or a connection string in both NewTelemetryClient and NewTelemetryConfiguration. If you need to use a custom endpoint, then do this as a workaround:

cfg := appinsights.NewTelemetryConfiguration(ikey)
cfg.EndpointUrl = "https://dc.applicationinsights.azure.cn/v2/track" // Data collector endpoint URL
client := appinsights.NewTelemetryClientFromConfig(cfg)

jjjordanmsft avatar Oct 09 '20 21:10 jjjordanmsft