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

handle "Invalid instrumentation key" errors #221

Open
bmc-msft opened this issue Oct 1, 2021 · 2 comments
Open

handle "Invalid instrumentation key" errors #221

bmc-msft opened this issue Oct 1, 2021 · 2 comments

Comments

@bmc-msft
Copy link
Contributor

bmc-msft commented Oct 1, 2021

When an invalid instrumentation key is provided, appinsights-rs will happily continue to send records even though they should all be rejected.

This behavior can be seen using an invalid instrumentation key using the example clients:

[2021-10-01T15:23:40Z DEBUG reqwest::connect] starting new connection: https://dc.services.visualstudio.com/
[2021-10-01T15:23:40Z DEBUG reqwest::async_impl::client] response '400 Bad Request' for https://dc.services.visualstudio.com/v2/track
[2021-10-01T15:23:40Z DEBUG appinsights::transmitter] Unknown status: 400 Bad Request. {"itemsReceived":3,"itemsAccepted":0,"errors":[{"index":0,"statusCode":400,"message":"Invalid instrumentation key"},{"index":1,"statusCode":400,"message":"Invalid instrumentation key"},{"index":2,"statusCode":400,"message":"Invalid instrumentation key"}]}. Nothing to re-send
@dmolokanov
Copy link
Owner

Hi @bmc-msft ! Thanks for reporting the issue! While it is a little annoying it is made by design. Since telemetry logs collected and sent in the background it cannot return an error during initialization process. Moreover someone can rotate key from appinsights while client is running, so the initialization is also not the place to handle this type of errors?

Is there a neat pattern to handle this type of errors we can leverage? I'm open to any suggestions.

@bmc-msft
Copy link
Contributor Author

bmc-msft commented Nov 3, 2021

I'm not sure of the right path, but it's more troublesome when an instrumentation key is never valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants