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

Application Insights Continuous Export: How to get Export ID on create? #4745

Closed
kmoe opened this issue May 3, 2019 · 2 comments

Comments

@kmoe
Copy link

commented May 3, 2019

Environment

Import path: .../services/appinsights/mgmt/2015-05-01/insights
SDK version: 75f8b5f
Go version: go version go1.12.4 linux/amd64

What I am trying to do

I want to use the Azure Go SDK to create a Continuous Export configuration for an existing Application Insights component. I need to save the Export ID on creation so I can use it later.

What I expect

When I call Create from exportconfigurations.go, I expect to receive a response containing details of the export configuration I just created, including the Export ID.

What happens

When I call Create, I get a response containing all export configurations (as if I had called List), not just the one I just created.

See the signature of the Create function:

func (client ExportConfigurationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, exportProperties ApplicationInsightsComponentExportRequest) (result ListApplicationInsightsComponentExportConfiguration, err error) {

It returns ListApplicationInsightsComponentExportConfiguration:
https://github.com/Azure/azure-sdk-for-go/blob/75f8b5f681677ab9f5d8c27c25b7169d46a37e7e/services/appinsights/mgmt/2015-05-01/insights/models.go#L1035,L1039

Since I do not know which member of the returned list is the export configuration I just created, I am unable to save the Export ID.

Further details

Experimenting using the Azure Portal shows the REST API used in that webapp behaves in a similar way.

When I create an export configuration (and one already exists), the request payload for the API request is:

{"requests":[{"httpMethod":"GET","requestHeaderDetails":{"commandName":"AppInsightsExtension."},"url":"https://management.azure.com/subscriptions/.../resourcegroups/kmoe_test_rg/providers/microsoft.insights/components/kmoe_test_ai/ExportConfiguration?api-version=2015-05-01"}]}

and the response is:

{"responses":[{"httpStatusCode":200,"headers":{...},"content":[{"ExportId":"...",...},{"ExportId":"...",...}]}

The response contains both export configurations, not just the one I just created.

Why I think this is a bug

It may be possible to guess which of the returned array of export configurations is the one I just created, based on the order of the array, or the LastUserUpdate field in the ApplicationInsightsComponentExportConfiguration (

LastUserUpdate *string `json:"LastUserUpdate,omitempty"`
).

However, this is not robust, as it is possible that another Create request was made at roughly the same time as mine, so the export configuration whose ID I want is not the latest one in the returned list.

@jhendrixMSFT

This comment has been minimized.

Copy link
Member

commented May 7, 2019

Hello! I spoke with the service team about this, unfortunately there is no support for this right now and no real workaround :(. Their suggestion is to open an issue on https://feedback.azure.com/forums/357324-application-insights to track this. Please let me know if you have further questions.

@kmoe

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.