Skip to content

Extension method invocations are not simplified #1026

@voroninp

Description

@voroninp

This code

Dim tracingBuilder as TracerProviderBuilder = Sdk.CreateTracerProviderBuilder() _
    .ConfigureResource(
        Sub(c)
            c.AddService("MediaViewServer") _
             .AddAttributes(New Dictionary(Of String, Object) _
                            From {{"License", gLicenceDC.GetInstance().LicenseCode}})
        End Sub) _
    .SetErrorStatusOnException() _
    .AddWcfInstrumentation() _
    .AddGrpcCoreInstrumentation() _
    .AddOtlpExporter(
        Sub(c)
            c.ExportProcessorType = ExportProcessorType.Batch
            c.BatchExportProcessorOptions = New BatchExportProcessorOptions(Of Activity) _
                        With {.ExporterTimeoutMilliseconds = 5000}
            c.Endpoint = New Uri(tracingUrl)
            c.Protocol = otlpExportProtocol
        End Sub) _
    .AddSource(GetType(EnumerableAsLz4EncodedStream(Of ClassificationsChunk)).FullName) _
    .AddSource(GetType(EnumerableAsLz4EncodedStream(Of RmaDataChunk)).FullName) _
    .AddSource(GetType(NloRadioMarketAnalysisStreamingServiceCore).FullName)

turns into:

var tracingBuilder = 
    OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddGrpcCoreInstrumentation(
        OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddWcfInstrumentation(
            OpenTelemetry.Trace.TracerProviderBuilderExtensions.SetErrorStatusOnException(
                OpenTelemetry.Trace.TracerProviderBuilderExtensions.ConfigureResource(
                    Sdk.CreateTracerProviderBuilder(), 
                    c => ResourceBuilderExtensions.AddService(c, "MediaViewServer")
                        .AddAttributes((IEnumerable<KeyValuePair<string, object>>)new Dictionary<string, object>() { { "License", gLicenceDC.GetInstance().LicenseCode } })))))
    .AddOtlpExporter(c =>
                    {
    c.ExportProcessorType = ExportProcessorType.Batch;
    c.BatchExportProcessorOptions = new BatchExportProcessorOptions<Activity>() { ExporterTimeoutMilliseconds = 5000 };
    c.Endpoint = new Uri(tracingUrl);
    c.Protocol = otlpExportProtocol;
    })
    .AddSource(typeof(EnumerableAsLz4EncodedStream<ClassificationsChunk>).FullName)
    .AddSource(typeof(EnumerableAsLz4EncodedStream<RmaDataChunk>).FullName).AddSource(typeof(NloRadioMarketAnalysisStreamingServiceCore).FullName);

However, nested methods are extension methods.
Installed extension: 9.2.3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions