diff --git a/src/OpenTelemetry/CHANGELOG.md b/src/OpenTelemetry/CHANGELOG.md
index 99271b782cd..3970850f7e0 100644
--- a/src/OpenTelemetry/CHANGELOG.md
+++ b/src/OpenTelemetry/CHANGELOG.md
@@ -20,6 +20,10 @@
to `-1`.
([#3038](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3038))
+* Marked members of the `MetricPoint` `struct` which do not mutate state as
+ `readonly`
+ ([#3065](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3065))
+
## 1.2.0-rc3
Released 2022-Mar-04
diff --git a/src/OpenTelemetry/Metrics/MetricPoint.cs b/src/OpenTelemetry/Metrics/MetricPoint.cs
index 557f162cb88..e1e2fb8e180 100644
--- a/src/OpenTelemetry/Metrics/MetricPoint.cs
+++ b/src/OpenTelemetry/Metrics/MetricPoint.cs
@@ -74,7 +74,7 @@ internal MetricPoint(
///
/// Gets the tags associated with the metric point.
///
- public ReadOnlyTagCollection Tags
+ public readonly ReadOnlyTagCollection Tags
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
@@ -86,7 +86,7 @@ public ReadOnlyTagCollection Tags
public DateTimeOffset StartTime
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get;
+ readonly get;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal set;
@@ -98,7 +98,7 @@ public DateTimeOffset StartTime
public DateTimeOffset EndTime
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get;
+ readonly get;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal set;
@@ -107,7 +107,7 @@ public DateTimeOffset EndTime
internal MetricPointStatus MetricPointStatus
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- get;
+ readonly get;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private set;
@@ -121,7 +121,7 @@ internal MetricPointStatus MetricPointStatus
///
/// Long sum value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public long GetSumLong()
+ public readonly long GetSumLong()
{
if (this.aggType != AggregationType.LongSumIncomingDelta && this.aggType != AggregationType.LongSumIncomingCumulative)
{
@@ -139,7 +139,7 @@ public long GetSumLong()
///
/// Double sum value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public double GetSumDouble()
+ public readonly double GetSumDouble()
{
if (this.aggType != AggregationType.DoubleSumIncomingDelta && this.aggType != AggregationType.DoubleSumIncomingCumulative)
{
@@ -157,7 +157,7 @@ public double GetSumDouble()
///
/// Long gauge value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public long GetGaugeLastValueLong()
+ public readonly long GetGaugeLastValueLong()
{
if (this.aggType != AggregationType.LongGauge)
{
@@ -175,7 +175,7 @@ public long GetGaugeLastValueLong()
///
/// Double gauge value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public double GetGaugeLastValueDouble()
+ public readonly double GetGaugeLastValueDouble()
{
if (this.aggType != AggregationType.DoubleGauge)
{
@@ -193,7 +193,7 @@ public double GetGaugeLastValueDouble()
///
/// Count value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public long GetHistogramCount()
+ public readonly long GetHistogramCount()
{
if (this.aggType != AggregationType.Histogram && this.aggType != AggregationType.HistogramSumCount)
{
@@ -211,7 +211,7 @@ public long GetHistogramCount()
///
/// Sum value.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public double GetHistogramSum()
+ public readonly double GetHistogramSum()
{
if (this.aggType != AggregationType.Histogram && this.aggType != AggregationType.HistogramSumCount)
{
@@ -229,7 +229,7 @@ public double GetHistogramSum()
///
/// .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public HistogramBuckets GetHistogramBuckets()
+ public readonly HistogramBuckets GetHistogramBuckets()
{
if (this.aggType != AggregationType.Histogram && this.aggType != AggregationType.HistogramSumCount)
{
@@ -542,7 +542,7 @@ internal void TakeSnapshot(bool outputDelta)
}
[MethodImpl(MethodImplOptions.NoInlining)]
- private void ThrowNotSupportedMetricTypeException(string methodName)
+ private readonly void ThrowNotSupportedMetricTypeException(string methodName)
{
throw new NotSupportedException($"{methodName} is not supported for this metric type.");
}