Azure-Samples / azure-sdk-for-go-samples

Examples of how to utilize Azure services from Go.
MIT License
296 stars 184 forks source link

Add tracing sample #241

Closed vladbarosan closed 5 years ago

vladbarosan commented 5 years ago

Thanks for your contribution! Please let us know what problems this PR addresses or what functionality it adds. Please link to other related issues and PRs to speed up review. Thank you!

vladbarosan commented 5 years ago

@joshgav please review of any changes you prefer ? also I was thinking maybe adding a small readme ?

joshgav commented 5 years ago

Thanks @vladbarosan. Could we also set up the App Insights/OpenCensus proxy in a container on the same machine and include a script to set up the proxy with a fresh App Insights resource and instrumentation key? Our goal is to show how to use AppInsights/OpenCensus in Go apps as well as with the Azure SDK. When complete, users should be able to view output from their app in the portal dashboard.

The following script is how to set up an App Insights instance scriptomatically, see https://github.com/Azure/azure-cli/issues/5543:

group=go-appinsights-group
resource_name=go-appinsights
location=westus2
appId=go-app
az resource create \
    --resource-group $group \
    --resource-type "Microsoft.Insights/components" \
    --name $resource_name \
    --location $locaion \
    --properties '{
            "ApplicationId":"$appId",
            "Application_Type":"other",
            "Flow_Type":"Redfield"
          }'

APPINSIGHTS_INSTRUMENTATIONKEY=$( \
az resource show \
    --resource-group $group --name $resource_name \
    --resource-type "Microsoft.Insights/components" \
    --query properties.InstrumentationKey --output tsv \
)
vladbarosan commented 5 years ago

@joshgav definitely we can create a runable container that runs the app insights agent and with the go App but i wouldn't run the creation of the resource there. we can add a separate quick start script to create the app insights resource