Skip to content

Commit

Permalink
[repo] Replace some fields with auto properties (#6104)
Browse files Browse the repository at this point in the history
Co-authored-by: Mikel Blanchard <[email protected]>
  • Loading branch information
SimonCropp and CodeBlanch authored Jan 27, 2025
1 parent c44984e commit 89ea5c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ namespace OpenTelemetry.Exporter.Prometheus;
[ExportModes(ExportModes.Pull)]
internal sealed class PrometheusExporter : BaseExporter<Metric>, IPullMetricExporter
{
private Func<int, bool>? funcCollect;
private ExportFunc? funcExport;
private Resource? resource;
private bool disposed;

Expand All @@ -38,17 +36,9 @@ public PrometheusExporter(PrometheusExporterOptions options)
/// <summary>
/// Gets or sets the Collect delegate.
/// </summary>
public Func<int, bool>? Collect
{
get => this.funcCollect;
set => this.funcCollect = value;
}
public Func<int, bool>? Collect { get; set; }

internal ExportFunc? OnExport
{
get => this.funcExport;
set => this.funcExport = value;
}
internal ExportFunc? OnExport { get; set; }

internal Action? OnDispose { get; set; }

Expand Down
6 changes: 2 additions & 4 deletions src/OpenTelemetry/Metrics/ExportModesAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ namespace OpenTelemetry.Metrics;
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public sealed class ExportModesAttribute : Attribute
{
private readonly ExportModes supportedExportModes;

/// <summary>
/// Initializes a new instance of the <see cref="ExportModesAttribute"/> class.
/// </summary>
/// <param name="supported"><see cref="ExportModes"/>.</param>
public ExportModesAttribute(ExportModes supported)
{
this.supportedExportModes = supported;
this.Supported = supported;
}

/// <summary>
/// Gets the supported <see cref="ExportModes"/>.
/// </summary>
public ExportModes Supported => this.supportedExportModes;
public ExportModes Supported { get; }
}
5 changes: 2 additions & 3 deletions src/OpenTelemetry/ReadOnlyFilteredTagCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public readonly struct ReadOnlyFilteredTagCollection
private readonly HashSet<string>? excludedKeys;
#endif
private readonly KeyValuePair<string, object?>[] tags;
private readonly int count;

internal ReadOnlyFilteredTagCollection(
#if NET
Expand All @@ -38,7 +37,7 @@ internal ReadOnlyFilteredTagCollection(

this.excludedKeys = excludedKeys;
this.tags = tags;
this.count = count;
this.MaximumCount = count;
}

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

/// <summary>
/// Returns an enumerator that iterates through the tags.
Expand Down

0 comments on commit 89ea5c6

Please sign in to comment.