Skip to content

Persist instrumentation key on disk#1953

Merged
heyams merged 23 commits into
mainfrom
heya/write-instrumentation-key-to-disk
Nov 10, 2021
Merged

Persist instrumentation key on disk#1953
heyams merged 23 commits into
mainfrom
heya/write-instrumentation-key-to-disk

Conversation

@heyams

@heyams heyams commented Nov 4, 2021

Copy link
Copy Markdown
Contributor

Fix #1948

@lgtm-com

lgtm-com Bot commented Nov 4, 2021

Copy link
Copy Markdown

This pull request introduces 1 alert when merging 9c91ea2 into 46e60d5 - view on LGTM.com

new alerts:

  • 1 for Potential input resource leak

@heyams heyams marked this pull request as ready for review November 9, 2021 05:37

@trask trask left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen if user upgrades and they still have prior .trn files without the ikey in them?

@heyams

heyams commented Nov 9, 2021

Copy link
Copy Markdown
Contributor Author

what will happen if user upgrades and they still have prior .trn files without the ikey in them?

if they have .trn that is not older than 48 hours.. it will get sent to App Insights backend. for anything that is older than 48 hours, purger would take care of it.

@trask

trask commented Nov 9, 2021

Copy link
Copy Markdown
Member

if they have .trn that is not older than 48 hours.. it will get sent to App Insights backend. for anything that is older than 48 hours, purger would take care of it.

did I miss the code that is handling reading in the old file format with no ikey embedded?

@heyams

heyams commented Nov 9, 2021

Copy link
Copy Markdown
Contributor Author

if they have .trn that is not older than 48 hours.. it will get sent to App Insights backend. for anything that is older than 48 hours, purger would take care of it.

did I miss the code that is handling reading in the old file format with no ikey embedded?

if old trn that doesn't have instrumentation key, it will not get sent. in that case it will get purged out after 48 hours. should i add the purge to include files that are missing instrumentation key?

@trask

trask commented Nov 9, 2021

Copy link
Copy Markdown
Member

if old trn that doesn't have instrumentation key, it will not get sent. in that case it will get purged out after 48 hours. should i add the purge to include files that are missing instrumentation key?

have you tested this? my guess from the code is that it will cause errors because we will parse the first 36 bytes into an ikey, and then the rest of the json message will be corrupted

@trask trask left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good. one last question, which test would have caught this issue?

@heyams

heyams commented Nov 10, 2021

Copy link
Copy Markdown
Contributor Author

looking good. one last question, which test would have caught this issue?

how to mock a readonly system? we might need to add a smoke test for readonly?

@trask

trask commented Nov 10, 2021

Copy link
Copy Markdown
Member

looking good. one last question, which test would have caught this issue?

how to mock a readonly system? we might need to add a smoke test for readonly?

sorry, by "this issue" I mean the one that this PR addresses

@heyams heyams merged commit a8dcc73 into main Nov 10, 2021
@heyams heyams deleted the heya/write-instrumentation-key-to-disk branch November 10, 2021 02:15
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

Successfully merging this pull request may close these issues.

Error sending telemetry items: instrumentationKey must be non-null

2 participants