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

Add support for streaming logs for multiple modules at the same time #1033

Merged
merged 18 commits into from
Apr 19, 2019

Conversation

varunpuranik
Copy link
Contributor

The EdgeAgent support log streams with the following schema -
{
"schemaVersion": "1.0",
"items": {
[
{
"id": "edge",
"filter": ""
},
{
"id": "temp",
"filter": ""
}
],
"encoding": "gzip",
"contentType": "text"
}
}

The id is a regex. So "edge" would match both edgeHub and edgeAgent.
Logs from all the modules are streamed over the requesting stream.

@myagley
Copy link
Contributor

myagley commented Apr 1, 2019

Is it possible to get all of the API changes together in one place so that they can be reviewed?

@myagley
Copy link
Contributor

myagley commented Apr 15, 2019

If the id field is a regex, should we call it something like pattern instead of id?

@varunpuranik
Copy link
Contributor Author

Yes, we can call it pattern. Should we call it the same in the json as well? I was wondering if that might cause more confusion.. A "pattern" like "edgeAgent" or "edgeHub" works. So in the simplest case, users can simply use the module Id (which is why I called it Id). For advanced users, the id can act as a pattern as well.
But I am open to changing it to "pattern" since that is technically more accurate.

=> this.clientWebSocket.CloseAsync(closeStatus, statusDescription, cancellationToken);
public async Task CloseAsync(WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
{
using (await this.clientWebSocketLock.LockAsync(cancellationToken))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this cancellation token always set to something non-none?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - for the streaming case, we have a real cancellation token, which is cancelled if the client closes, etc.

@@ -60,7 +64,8 @@ Task ProcessLogsFrame(ArraySegment<byte> bytes)

async Task<LogsStreamRequest> ReadLogsStreamingRequest(IClientWebSocket clientWebSocket, CancellationToken cancellationToken)
{
var buf = new byte[1024];
// Max size of the request can be 8k
var buf = new byte[MaxLogRequestSizeBytes];
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this truncate if longer than the max?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we only read up to this size. Ideally should never exceed the max size - the requests currently are < 1k, so 8k seemed enough. If we feel, I can increase to 16k?

@varunpuranik varunpuranik merged commit 5ce1903 into Azure:master Apr 19, 2019
@varunpuranik varunpuranik deleted the StreamAll2 branch April 19, 2019 23:17
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.

2 participants