Skip to content

Commit 8631656

Browse files
authored
add protected constructors for metric instrumentation in Temporalio.Common namespace (#431)
1 parent 7829fd3 commit 8631656

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ activity context:
11151115
* `Heartbeater` - Callback invoked each heartbeat.
11161116
* `WorkerShutdownTokenSource` - Token source for issuing worker shutdown.
11171117
* `PayloadConverter` - Defaulted to default payload converter.
1118+
* `MetricMeter` - Defaulted to noop meter.
11181119

11191120
### OpenTelemetry Tracing Support
11201121

src/Temporalio/Common/MetricCounter.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ internal MetricCounter(MetricDetails details)
1818
{
1919
}
2020

21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="MetricCounter{T}" /> class.
23+
/// </summary>
24+
/// <param name="name">The name of the counter.</param>
25+
/// <param name="unit">The optional unit of measurement for the values recorded by the counter.</param>
26+
/// <param name="description">The optional description of the counter.</param>
27+
protected MetricCounter(string name, string? unit = null, string? description = null)
28+
: this(new(name, unit, description))
29+
{
30+
}
31+
2132
/// <summary>
2233
/// Add the given value to the counter.
2334
/// </summary>

src/Temporalio/Common/MetricGauge.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ internal MetricGauge(MetricDetails details)
1818
{
1919
}
2020

21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="MetricGauge{T}" /> class.
23+
/// </summary>
24+
/// <param name="name">The name of the gauge.</param>
25+
/// <param name="unit">The optional unit of measurement for the values recorded by the gauge.</param>
26+
/// <param name="description">The optional description of the gauge.</param>
27+
protected MetricGauge(string name, string? unit = null, string? description = null)
28+
: this(new(name, unit, description))
29+
{
30+
}
31+
2132
/// <summary>
2233
/// Set the given value on the gauge.
2334
/// </summary>

src/Temporalio/Common/MetricHistogram.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ internal MetricHistogram(MetricDetails details)
1818
{
1919
}
2020

21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="MetricHistogram{T}" /> class.
23+
/// </summary>
24+
/// <param name="name">The name of the histogram.</param>
25+
/// <param name="unit">The optional unit of measurement for the values recorded by the histogram.</param>
26+
/// <param name="description">The optional description of the histogram.</param>
27+
protected MetricHistogram(string name, string? unit = null, string? description = null)
28+
: this(new(name, unit, description))
29+
{
30+
}
31+
2132
/// <summary>
2233
/// Record the given value on the histogram.
2334
/// </summary>

0 commit comments

Comments
 (0)