Skip to content

Commit 7401fde

Browse files
committed
Add usage notes for ExternalCounter [skip ci]
1 parent c0ede02 commit 7401fde

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs/MetricTypes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,17 @@ Remember, __these are for LOW VOLUME__ events. If you expect more than one event
5555
5656
You can enable/disable sending external counter increments using `BosunOptions.EnableExternalCounters` during initialization, or by changing `MetricsCollector.EnableExternalCounters` at runtime.
5757
58+
#### Usage
59+
5860
The usage of `ExternalCounter` is exactly the same as `Counter` except that you can only increment by 1.
5961
62+
```csharp
63+
var counter = collector.CreateMetric<ExternalCounter>("ext_counter", "units", "description");
64+
counter.Increment();
65+
```
66+
67+
You can also inherit from `ExternalCounter` in order to add tags (like any other metric type).
68+
6069
> tsdbrelay will automatically add the "host" tag. This means that metrics which inherit from ExternalCounter are not required to have any tags. ExternalCounter excludes the "host" tag by default for the same reason.
6170
6271
## Gauges

docs/ReleaseNotes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,17 @@ Remember, __these are for LOW VOLUME__ events. If you expect more than one event
7171
7272
You can enable/disable sending external counter increments using `BosunOptions.EnableExternalCounters` during initialization, or by changing `MetricsCollector.EnableExternalCounters` at runtime.
7373
74+
#### Usage
75+
7476
The usage of `ExternalCounter` is exactly the same as `Counter` except that you can only increment by 1.
7577
78+
```csharp
79+
var counter = collector.CreateMetric<ExternalCounter>("ext_counter", "units", "description");
80+
counter.Increment();
81+
```
82+
83+
You can also inherit from `ExternalCounter` in order to add tags (like any other metric type).
84+
7685
> tsdbrelay will automatically add the "host" tag. This means that metrics which inherit from ExternalCounter are not required to have any tags. ExternalCounter excludes the "host" tag by default for the same reason.
7786
7887
#### Custom Metrics

0 commit comments

Comments
 (0)