Skip to content

Commit 38ecc18

Browse files
authored
Merge pull request #150 from prom-client-net/improve-xml-doc-summaries
improve xml documentation
2 parents 23efd0e + 52d8cae commit 38ecc18

9 files changed

+60
-11
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
[![codecov](https://img.shields.io/codecov/c/github/prom-client-net/prom-client-metricpusher?logo=codecov&style=flat-square)](https://app.codecov.io/gh/prom-client-net/prom-client-metricpusher)
77
[![license](https://img.shields.io/github/license/prom-client-net/prom-client-metricpusher?style=flat-square)](https://github.com/prom-client-net/prom-client-metricpusher/blob/main/LICENSE)
88

9-
## PushGateway
9+
## Pushgateway
1010

11-
Sometimes when it is not possible to pull e.g. - nodes behind LB or there is a worker like daemon or windows service that does not have HTTP endpoint still there is way to push your metrics to PushGateaway server that you can install from [here](https://github.com/prometheus/pushgateway/releases).
11+
Sometimes when it is not possible to pull e.g. - nodes behind LB or there is a worker like daemon or windows service that does not have HTTP endpoint still there is way to push your metrics to Pushgateway server that you can install from [here](https://github.com/prometheus/pushgateway/releases).
1212

1313
## Install
1414

@@ -20,7 +20,7 @@ dotnet add package Prometheus.Client.MetricPusher
2020

2121
[Examples](https://github.com/prom-client-net/prom-examples)
2222

23-
One push. You can use Timer for regularly push to PushGateway:
23+
One push. You can use Timer for regularly push to Pushgateway:
2424

2525
```c#
2626
var pusher = new MetricPusher(new MetricPusherOptions

src/IMetricPushServer.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
namespace Prometheus.Client.MetricPusher;
22

3+
/// <summary>
4+
/// Interface for metric push server that periodically pushes metrics.
5+
/// </summary>
36
public interface IMetricPushServer
47
{
58
/// <summary>
6-
/// Server is Running?
9+
/// Get a value indicating whether the server is currently running.
710
/// </summary>
811
bool IsRunning { get; }
912

1013
/// <summary>
11-
/// Start Metric Push Server
14+
/// Start the metric push server.
1215
/// </summary>
1316
void Start();
1417

1518
/// <summary>
16-
/// Stop Metric Push Server
19+
/// Stop the metric push server.
1720
/// </summary>
1821
void Stop();
1922
}

src/IMetricPusher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
namespace Prometheus.Client.MetricPusher;
44

55
/// <summary>
6-
/// Service for Push Gateway
6+
/// Interface for pushing metrics to Prometheus Pushgateway.
77
/// </summary>
88
public interface IMetricPusher
99
{
1010
/// <summary>
11-
/// Push metrics to single pushgateway endpoint
11+
/// Push metrics to the configured Pushgateway endpoint.
1212
/// </summary>
1313
Task PushAsync();
1414
}

src/MetricPushServer.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,37 @@
55

66
namespace Prometheus.Client.MetricPusher;
77

8+
/// <summary>
9+
/// Server that periodically pushes metrics using configured pushers.
10+
/// </summary>
811
public class MetricPushServer(IMetricPusher[] metricPushers, TimeSpan pushInterval) : IMetricPushServer
912
{
1013
private CancellationTokenSource _cts;
1114
private Task _task;
1215

16+
/// <summary>
17+
/// Initialize a new instance of the <see cref="MetricPushServer"/> class with a single pusher.
18+
/// </summary>
19+
/// <param name="metricPusher">The <see cref="IMetricPusher"/> instance.</param>
1320
public MetricPushServer(IMetricPusher metricPusher)
1421
: this([metricPusher])
1522
{
1623
}
1724

25+
/// <summary>
26+
/// Initialize a new instance of the <see cref="MetricPushServer"/> class with a single pusher and interval.
27+
/// </summary>
28+
/// <param name="metricPusher">The <see cref="IMetricPusher"/> instance.</param>
29+
/// <param name="pushInterval">The interval between pushes.</param>
1830
public MetricPushServer(IMetricPusher metricPusher, TimeSpan pushInterval)
1931
: this([metricPusher], pushInterval)
2032
{
2133
}
2234

35+
/// <summary>
36+
/// Initialize a new instance of the <see cref="MetricPushServer"/> class with multiple pushers.
37+
/// </summary>
38+
/// <param name="metricPushers">The array of <see cref="IMetricPusher"/> instances.</param>
2339
public MetricPushServer(IMetricPusher[] metricPushers)
2440
: this(metricPushers, TimeSpan.FromMilliseconds(1000))
2541
{

src/MetricPusher.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77

88
namespace Prometheus.Client.MetricPusher;
99

10+
/// <summary>
11+
/// Implementation of metric pusher for Prometheus Pushgateway.
12+
/// </summary>
1013
public class MetricPusher : IMetricPusher, IDisposable
1114
{
1215
private readonly HttpClient _httpClient;
1316
private readonly bool _isOwnHttpClient;
1417
private readonly ICollectorRegistry _collectorRegistry;
1518
private readonly Uri _targetUri;
1619

20+
/// <summary>
21+
/// Get the target URI for Pushgateway endpoint.
22+
/// </summary>
1723
public Uri TargetUri => _targetUri;
1824

1925
public MetricPusher(MetricPusherOptions options)

src/MetricPusherOptions.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,43 @@
44

55
namespace Prometheus.Client.MetricPusher;
66

7+
/// <summary>
8+
/// Configuration options for the metric pusher.
9+
/// </summary>
710
public class MetricPusherOptions
811
{
12+
/// <summary>
13+
/// The <see cref="ICollectorRegistry"/> instance to use for metric collection.
14+
/// </summary>
915
public ICollectorRegistry CollectorRegistry { get; set; }
1016

17+
/// <summary>
18+
/// The Pushgateway endpoint URL.
19+
/// </summary>
1120
public string Endpoint { get; set; }
1221

22+
/// <summary>
23+
/// The job name for metrics.
24+
/// </summary>
1325
public string Job { get; set; }
1426

27+
/// <summary>
28+
/// The instance name for metrics.
29+
/// </summary>
1530
public string Instance { get; set; }
1631

32+
/// <summary>
33+
/// Additional labels to include with metrics.
34+
/// </summary>
1735
public IEnumerable<KeyValuePair<string, string>> AdditionalLabels { get; set; }
1836

37+
/// <summary>
38+
/// Additional HTTP headers to include in requests.
39+
/// </summary>
1940
public IEnumerable<KeyValuePair<string, string>> AdditionalHeaders { get; set; }
2041

42+
/// <summary>
43+
/// The HTTP client to use for requests.
44+
/// </summary>
2145
public HttpClient HttpClient { get; set; }
2246
}

src/Prometheus.Client.MetricPusher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<Description>Push metrics to PushGateaway for Prometheus.Client</Description>
3+
<Description>Push metrics to Pushgateaway for Prometheus.Client</Description>
44
<TargetFrameworks>net462;netstandard2.0;net8.0</TargetFrameworks>
55
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
66
<RepositoryUrl>https://github.com/prom-client-net/prom-client-metricpusher</RepositoryUrl>

tests/MetricPusherIntegrationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Prometheus.Client.MetricPusher.Tests;
1010

11-
public class MetricPusherIntegrationTests(PushGatewayFixture fixture, ITestOutputHelper output) : IClassFixture<PushGatewayFixture>
11+
public class MetricPusherIntegrationTests(PushgatewayFixture fixture, ITestOutputHelper output) : IClassFixture<PushgatewayFixture>
1212
{
1313
private readonly string _endpoint = fixture.GetEndpoint();
1414
private readonly IMetricFactory _metricFactory = new MetricFactory(new CollectorRegistry());

tests/PushGatewayFixture.cs renamed to tests/PushgatewayFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Prometheus.Client.MetricPusher.Tests;
88

9-
public class PushGatewayFixture : IAsyncLifetime
9+
public class PushgatewayFixture : IAsyncLifetime
1010
{
1111
private readonly IContainer _container = new ContainerBuilder()
1212
.WithImage("prom/pushgateway")

0 commit comments

Comments
 (0)