Skip to content

Commit

Permalink
[AzureMonitor] remove features before stable release (#44479)
Browse files Browse the repository at this point in the history
* remove features before stable release

* disable test

* update public api

* update changelog

* fix

* changelog
  • Loading branch information
TimothyMothra authored Jun 10, 2024
1 parent ff26125 commit 3d4982c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ public static OpenTelemetryBuilder UseAzureMonitor(this OpenTelemetryBuilder bui
.Configure<IOptionsMonitor<AzureMonitorOptions>>((loggingOptions, azureOptions) =>
{
var azureMonitorOptions = azureOptions.Get(Options.DefaultName);
loggingOptions.AddAzureMonitorLogExporter(o => azureMonitorOptions.SetValueToExporterOptions(o));
// TODO:WILL RE-ENABLE IN NEXT BETA
/*
bool enableLogSampling = false;
try
{
Expand All @@ -179,6 +182,7 @@ public static OpenTelemetryBuilder UseAzureMonitor(this OpenTelemetryBuilder bui
{
loggingOptions.AddAzureMonitorLogExporter(o => azureMonitorOptions.SetValueToExporterOptions(o));
}
*/
if (azureMonitorOptions.EnableLiveMetrics)
{
Expand All @@ -200,20 +204,21 @@ public static OpenTelemetryBuilder UseAzureMonitor(this OpenTelemetryBuilder bui
azureMonitorOptions.Get(Options.DefaultName).SetValueToExporterOptions(exporterOptions);
});

// TODO: WILL RE-ENABLE IN NEXT BETA
// Register Azure SDK log forwarder in the case it was not registered by the user application.
builder.Services.AddHostedService(sp =>
{
var logForwarderType = Type.GetType("Microsoft.Extensions.Azure.AzureEventSourceLogForwarder, Microsoft.Extensions.Azure", false);
//builder.Services.AddHostedService(sp =>
//{
// var logForwarderType = Type.GetType("Microsoft.Extensions.Azure.AzureEventSourceLogForwarder, Microsoft.Extensions.Azure", false);

if (logForwarderType != null && sp.GetService(logForwarderType) != null)
{
AzureMonitorAspNetCoreEventSource.Log.LogForwarderIsAlreadyRegistered();
return AzureEventSourceLogForwarder.Noop;
}
// if (logForwarderType != null && sp.GetService(logForwarderType) != null)
// {
// AzureMonitorAspNetCoreEventSource.Log.LogForwarderIsAlreadyRegistered();
// return AzureEventSourceLogForwarder.Noop;
// }

var loggerFactory = sp.GetRequiredService<ILoggerFactory>();
return new AzureEventSourceLogForwarder(loggerFactory);
});
// var loggerFactory = sp.GetRequiredService<ILoggerFactory>();
// return new AzureEventSourceLogForwarder(loggerFactory);
//});

// Register Manager as a singleton
builder.Services.AddSingleton<Manager>(sp =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ namespace Azure.Monitor.OpenTelemetry.AspNetCore.Tests
{
public class AzureSdkLoggingTests
{
#if NET6_0
[ConditionallySkipOSTheory(platformToSkip: "macos", reason: "This test consistently exceeds 1 hour runtime limit when running on MacOS & Net60")]
#else
[Theory]
#endif
[Theory(Skip = "Temporary skip for stable release")]
//#if NET6_0
// [ConditionallySkipOSTheory(platformToSkip: "macos", reason: "This test consistently exceeds 1 hour runtime limit when running on MacOS & Net60")]
//#else
// [Theory]
//#endif
[InlineData(LogLevel.Information, "TestInfoEvent: hello")]
[InlineData(LogLevel.Warning, "TestWarningEvent: hello")]
[InlineData(LogLevel.Debug, null)]
Expand Down Expand Up @@ -54,11 +55,12 @@ public async Task DistroLogForwarderIsAdded(LogLevel eventLevel, string expected
}
}

#if NET6_0
[ConditionallySkipOSTheory(platformToSkip: "macos", reason: "This test consistently exceeds 1 hour runtime limit when running on MacOS & Net60")]
#else
[Theory]
#endif
[Theory(Skip = "Temporary skip for stable release")]
//#if NET6_0
// [ConditionallySkipOSTheory(platformToSkip: "macos", reason: "This test consistently exceeds 1 hour runtime limit when running on MacOS & Net60")]
//#else
// [Theory]
//#endif
[InlineData(LogLevel.Information, "TestInfoEvent: hello")]
[InlineData(LogLevel.Warning, "TestWarningEvent: hello")]
[InlineData(LogLevel.Debug, null)]
Expand Down Expand Up @@ -95,11 +97,12 @@ public async Task PublicLogForwarderIsAdded(LogLevel eventLevel, string expected
}
}

#if NET6_0
[ConditionallySkipOSFact(platformToSkip: "macos", reason: "This test consistently exceeds 1 hour runtime limit when running on MacOS & Net60")]
#else
[Fact]
#endif
[Fact(Skip = "Temporary skip for stable release")]
//#if NET6_0
// [ConditionallySkipOSFact(platformToSkip: "macos", reason: "This test consistently exceeds 1 hour runtime limit when running on MacOS & Net60")]
//#else
// [Fact]
//#endif
public async Task SelfDiagnosticsIsDisabled()
{
var enableLevel = LogLevel.Debug;
Expand Down
7 changes: 5 additions & 2 deletions sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Other Changes

* Includes all changes from 1.3.0-beta.1 and 1.3.0-beta.2
* Changed `AzureMonitorLogExporter` to be internal.
This will be changed back to public in our next Beta while we experiment with options to enable log filtering.
([#44479](https:/Azure/azure-sdk-for-net/pull/44479))

## 1.3.0-beta.2 (2024-05-08)

Expand All @@ -23,8 +26,8 @@
### Other Changes

* Update OpenTelemetry dependencies
([#43197](https:/Azure/azure-sdk-for-net/pull/43197))
- OpenTelemetry 1.8.0
([#43688](https:/Azure/azure-sdk-for-net/pull/43688))
- OpenTelemetry 1.8.1

## 1.3.0-beta.1 (2024-02-08)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,4 @@ public enum ServiceVersion
v2_1 = 1,
}
}
public sealed partial class AzureMonitorLogExporter : OpenTelemetry.BaseExporter<OpenTelemetry.Logs.LogRecord>
{
public AzureMonitorLogExporter(Azure.Monitor.OpenTelemetry.Exporter.AzureMonitorExporterOptions options) { }
protected override void Dispose(bool disposing) { }
public override OpenTelemetry.ExportResult Export(in OpenTelemetry.Batch<OpenTelemetry.Logs.LogRecord> batch) { throw null; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,4 @@ public enum ServiceVersion
v2_1 = 1,
}
}
public sealed partial class AzureMonitorLogExporter : OpenTelemetry.BaseExporter<OpenTelemetry.Logs.LogRecord>
{
public AzureMonitorLogExporter(Azure.Monitor.OpenTelemetry.Exporter.AzureMonitorExporterOptions options) { }
protected override void Dispose(bool disposing) { }
public override OpenTelemetry.ExportResult Export(in OpenTelemetry.Batch<OpenTelemetry.Logs.LogRecord> batch) { throw null; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Azure.Monitor.OpenTelemetry.Exporter
/// <summary>
/// Azure Monitor Log Exporter.
/// </summary>
public sealed class AzureMonitorLogExporter : BaseExporter<LogRecord>
internal sealed class AzureMonitorLogExporter : BaseExporter<LogRecord>
{
private readonly ITransmitter _transmitter;
private readonly string _instrumentationKey;
Expand Down

0 comments on commit 3d4982c

Please sign in to comment.