Skip to content

Commit 89ea5c6

Browse files
[repo] Replace some fields with auto properties (open-telemetry#6104)
Co-authored-by: Mikel Blanchard <[email protected]>
1 parent c44984e commit 89ea5c6

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

src/OpenTelemetry.Exporter.Prometheus.HttpListener/Internal/PrometheusExporter.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ namespace OpenTelemetry.Exporter.Prometheus;
1414
[ExportModes(ExportModes.Pull)]
1515
internal sealed class PrometheusExporter : BaseExporter<Metric>, IPullMetricExporter
1616
{
17-
private Func<int, bool>? funcCollect;
18-
private ExportFunc? funcExport;
1917
private Resource? resource;
2018
private bool disposed;
2119

@@ -38,17 +36,9 @@ public PrometheusExporter(PrometheusExporterOptions options)
3836
/// <summary>
3937
/// Gets or sets the Collect delegate.
4038
/// </summary>
41-
public Func<int, bool>? Collect
42-
{
43-
get => this.funcCollect;
44-
set => this.funcCollect = value;
45-
}
39+
public Func<int, bool>? Collect { get; set; }
4640

47-
internal ExportFunc? OnExport
48-
{
49-
get => this.funcExport;
50-
set => this.funcExport = value;
51-
}
41+
internal ExportFunc? OnExport { get; set; }
5242

5343
internal Action? OnDispose { get; set; }
5444

src/OpenTelemetry/Metrics/ExportModesAttribute.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@ namespace OpenTelemetry.Metrics;
99
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
1010
public sealed class ExportModesAttribute : Attribute
1111
{
12-
private readonly ExportModes supportedExportModes;
13-
1412
/// <summary>
1513
/// Initializes a new instance of the <see cref="ExportModesAttribute"/> class.
1614
/// </summary>
1715
/// <param name="supported"><see cref="ExportModes"/>.</param>
1816
public ExportModesAttribute(ExportModes supported)
1917
{
20-
this.supportedExportModes = supported;
18+
this.Supported = supported;
2119
}
2220

2321
/// <summary>
2422
/// Gets the supported <see cref="ExportModes"/>.
2523
/// </summary>
26-
public ExportModes Supported => this.supportedExportModes;
24+
public ExportModes Supported { get; }
2725
}

src/OpenTelemetry/ReadOnlyFilteredTagCollection.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public readonly struct ReadOnlyFilteredTagCollection
2222
private readonly HashSet<string>? excludedKeys;
2323
#endif
2424
private readonly KeyValuePair<string, object?>[] tags;
25-
private readonly int count;
2625

2726
internal ReadOnlyFilteredTagCollection(
2827
#if NET
@@ -38,7 +37,7 @@ internal ReadOnlyFilteredTagCollection(
3837

3938
this.excludedKeys = excludedKeys;
4039
this.tags = tags;
41-
this.count = count;
40+
this.MaximumCount = count;
4241
}
4342

4443
/// <summary>
@@ -48,7 +47,7 @@ internal ReadOnlyFilteredTagCollection(
4847
/// Note: Enumerating the collection may return fewer results depending on
4948
/// the filter.
5049
/// </remarks>
51-
internal int MaximumCount => this.count;
50+
internal int MaximumCount { get; }
5251

5352
/// <summary>
5453
/// Returns an enumerator that iterates through the tags.

0 commit comments

Comments
 (0)