Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Add Blob AzureWebApp provider #477

Merged
merged 3 commits into from
Aug 30, 2016
Merged

Add Blob AzureWebApp provider #477

merged 3 commits into from
Aug 30, 2016

Conversation

pakrym
Copy link
Contributor

@pakrym pakrym commented Aug 16, 2016

No description provided.

@pakrym
Copy link
Contributor Author

pakrym commented Aug 17, 2016

/cc @victorhurdugaci

CloudBlobStream stream;
try
{
stream = await blob.OpenWriteAsync(false);
Copy link
Member

Choose a reason for hiding this comment

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

false? What's the argument name

}

/// <inheritdoc />
public void Dispose()
{
_innerLoggerProvider.Dispose();
_loggerFactory.Dispose();

Choose a reason for hiding this comment

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

I think this can also be null.

@victorhurdugaci
Copy link
Contributor

You didn't compile locally after your last changes, didn't you? 😏 (travis/appveyor)

@pakrym
Copy link
Contributor Author

pakrym commented Aug 19, 2016

Don't tell anybody :) Also thank you for reviewing while on vacation.

var fileName = _instanceId + "-" + _fileName;
var azureBlobSink = new AzureBlobSink(container, _appName, fileName, messageFormatter, _batchSize, _period);
var backgroundSink = new BackgroundSink(azureBlobSink, BackgroundSink.DefaultLogMessagesQueueSize);
LoggerConfiguration loggerConfiguration = new LoggerConfiguration();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: var

}
if (period <= TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException(nameof(period), $"{nameof(period)} should be longer then zero.");
Copy link
Contributor

Choose a reason for hiding this comment

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

thAn

@victorhurdugaci
Copy link
Contributor

The code looks okay but it would be nice to have some tests that actually check the azure sdk part

@pakrym pakrym force-pushed the pakrym/blob branch 3 times, most recently from 6dfa193 to dad79f0 Compare August 25, 2016 21:43
@pakrym
Copy link
Contributor Author

pakrym commented Aug 25, 2016

I tries to write tests but it's nearly impossible to mock out azure blob types.

@victorhurdugaci
Copy link
Contributor

You could try to use the emulator for tests or you might want to take a look at WebJobs. I remember there was some storage mocking there. If you get any code from there, make sure you sync with Eilon first - he was the manager for that project.

@pakrym
Copy link
Contributor Author

pakrym commented Aug 29, 2016

@victorhurdugaci added tests.

{
logger.Information("Text " + i);
}
await Task.Delay(TimeSpan.FromSeconds(1));
Copy link
Contributor

Choose a reason for hiding this comment

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

no, no... use some sort of polling. Hardcoded wait times are evil

Copy link
Contributor

Choose a reason for hiding this comment

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

You can probably poll the buffer until you get the expected number of messages. (with a timeout, of course)

@pakrym pakrym force-pushed the pakrym/blob branch 2 times, most recently from 75f3da0 to 223cae6 Compare August 29, 2016 19:12
@pakrym
Copy link
Contributor Author

pakrym commented Aug 29, 2016

@victorhurdugaci switched to CountdownEvent

logger.Information("Text " + i);
}

Assert.True(sink.CountdownEvent.Wait(TimeSpan.FromSeconds(1)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Be more reasonable. Give it 10 seconds

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@victorhurdugaci
Copy link
Contributor

:shipit: once Travis and AppVeyor pass

@pakrym
Copy link
Contributor Author

pakrym commented Aug 30, 2016

@victorhurdugaci appveyor/pr fails with

Microsoft.Extensions.Logging.AzureWebAppDiagnostics.Test.LogConfigurationReaderTests.ConfigurationChange [FAIL]
      System.TimeoutException : Maximum number of retries reached.
      Stack Trace:
        C:\projects\logging\test\Microsoft.Extensions.Logging.AzureWebAppDiagnostics.Test\RetryHelper.cs(25,0): at Microsoft.Extensions.Logging.RetryHelper.Retry(Func`1 action, Int32 retries)
        C:\projects\logging\test\Microsoft.Extensions.Logging.AzureWebAppDiagnostics.Test\LogConfigurationReaderTests.cs(179,0): at Microsoft.Extensions.Logging.AzureWebAppDiagnostics.Test.LogConfigurationReaderTests.ConfigurationChange()
  Finished:    Microsoft.Extensions.Logging.AzureWebAppDiagnostics.Test

Which is unrelated to this PR. Merging.

@pakrym pakrym merged commit 88ee78a into dev Aug 30, 2016
@pakrym pakrym deleted the pakrym/blob branch October 4, 2016 16:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants