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

Support bundle upload #3356

Merged
merged 48 commits into from
Aug 6, 2020
Merged

Conversation

lfitchett
Copy link
Contributor

@lfitchett lfitchett commented Aug 4, 2020

This allows the support bundle to be uploaded in a similar matter to the built in logs upload. Currently the support bundle is held in memory while it is streamed to the cloud, but is architectured such that it can be stored and streamed from a file on disk in the future.

C# Changes

  • Added Support Bundle Direct Method
  • Renamed LogsUploader to RequestUploader

Rust Changes

  • Split Support Bundle and Logs Collection to new library that is shared by iotedge tool and the management endpoint.
  • Refactored Support Bundle to use generic Read instead of File
  • added endpoint to get support bundle

Note: The 2020-07-07 mgmt api version is brand new, and these additions are planned.

@lfitchett lfitchett requested a review from arsing August 5, 2020 17:37
arsing
arsing previously approved these changes Aug 5, 2020
public Option<string> Since { get; }

[JsonProperty("iothubHostname")]
public Option<string> IothubHostname { get; }
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

iotedge check has it as an option, so the support bundle does too

Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if a user specifies a different IoTHub?
I think this parameter definitely seems odd - I would say remove it and use the IOTHub that EdgeAgent is using.
@veyalla ?

Copy link
Contributor

@veyalla veyalla Aug 5, 2020

Choose a reason for hiding this comment

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

Using IoT Hub that edge agent is using would actually be an improvement over running support-bundle locally because currently we cannot run any connectivity tests when using DPS because we can't get the iot hub name from config yaml. The recommendation for DPS-provisioned devices is to use the command line parameter to explicitly specify iot hub name which is behavior the direct method is implementing.

However, it would cause inconsistent behavior for the same command when run locally vs remotely which is weird. There was some thoughts from @arsing around getting the iot hub name from a cached provisioning result when run locally on a DPS provisioned device. If that can be implemented we could have a consistent experience.

Copy link
Member

Choose a reason for hiding this comment

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

provisioning_backup.json has the hub name, so iotedge check / support-bundle could read it from there.

Copy link
Member

Choose a reason for hiding this comment

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

(If you do make that change, you'll probably want to keep the --iothub-hostname parameter to check / support-bundle so that passing it is not an error, such as when running old EA with new host package.)

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, we should make the change Arnav is suggesting, it will improve troubleshooting experience for customers running check / support-bundle locally and also provide consistency when running it locally or remotely. Thoughts @CindyXing ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, wherever we can infer the IoThub, we should I can't think of a scenario where support bundle or iotedge check would need to talk to a different IoTHub.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So for this pr, I'll remove the iothubHostname param, and just fill it in from ea's known hostname


public class SupportBundleRequestHandler : RequestHandlerBase<SupportBundleRequest, TaskStatusResponse>
{
public delegate Task<Stream> GetSupportBundle(Option<string> since, Option<string> iothubHostname, Option<bool> edgeRuntimeOnly, CancellationToken token);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of a delegate seems like an Interface might be cleaner?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure which interface I would use, but a delegate seemed like an clean way to pass a single function in. I've used this pattern before in the code base.

Copy link
Member

@damonbarry damonbarry left a comment

Choose a reason for hiding this comment

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

One question, otherwise the .NET code LGTM

{
this.Enabled = enabled;
this.DisableCloudSubscriptions = disableCloudSubscriptions;
this.EnableUploadLogs = enableUploadLogs;
this.EnableGetLogs = enableGetLogs;
this.EnableUploadSupportBundle = enableUploadSupportBundle;
Copy link
Contributor

Choose a reason for hiding this comment

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

So, in 1.0.10, we'll keep this and uploadlogs, getlogs as experimental features?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the plan is to move at least get and upload logs out of experimental for 1.10, this will probably stay in experimental

@lfitchett lfitchett merged commit a8b20ea into Azure:master Aug 6, 2020
lfitchett added a commit to lfitchett/iotedge that referenced this pull request Aug 7, 2020
* Rename logs => module logs

* make handler classes

* include new dm

* chkpnt

* start able to write to in memory

* fix types

* output to console

* fix flags

* start able to write to in memory

* fix types

* output to console

* fix flags

* re-enable tests

* import zip module and use display

* use --output - for stdout

* call support bundle

* parse params

* add new api version

* reuse http client

* flesh out request

* make logs uploader more generic

* fix merge issue

* bring in api changes

* fix version

* add get_result

* move support bundle logic to own file

* remove s

* collect bundle

* wrap read in body

* return support bundle size

* send full sb

* fix fileResponse

* read params

* parse_since

* pass hostname

* clippy

* re-enable first test

* add logs test back

* rename ILogsUPloader file to IRequestsUploader

* remove unused IDisposable

* get iothub hostname from edgeAgent

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
ggjjj pushed a commit to ggjjj/iotedge that referenced this pull request Aug 20, 2020
* Rename logs => module logs

* make handler classes

* include new dm

* chkpnt

* start able to write to in memory

* fix types

* output to console

* fix flags

* start able to write to in memory

* fix types

* output to console

* fix flags

* re-enable tests

* import zip module and use display

* use --output - for stdout

* call support bundle

* parse params

* add new api version

* reuse http client

* flesh out request

* make logs uploader more generic

* fix merge issue

* bring in api changes

* fix version

* add get_result

* move support bundle logic to own file

* remove s

* collect bundle

* wrap read in body

* return support bundle size

* send full sb

* fix fileResponse

* read params

* parse_since

* pass hostname

* clippy

* re-enable first test

* add logs test back

* rename ILogsUPloader file to IRequestsUploader

* remove unused IDisposable

* get iothub hostname from edgeAgent

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants