Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from azrod/devel
Browse files Browse the repository at this point in the history
Metrics
  • Loading branch information
azrod authored Jan 3, 2022
2 parents 96b2efe + b0c1c2d commit b9eaa79
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
64 changes: 64 additions & 0 deletions docs/advanced/metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Metrics

Different metrics are available. Metrics are organized into different categories.

Categories :

* Global
* Per-Providers

## How to enable and configure metrics server

You have some options to enable metrics server.

### Config File

| Options | Default | Required | Actions |
| -------------- | -------- | ------------------------ | --------------------------------------- |
| metrics.enable | false | :heavy_multiplication_x: | Define if start metrics web server |
| metrics.host | 0.0.0.0 | :heavy_multiplication_x: | Set IP address for metrics web server |
| metrics.port | 8080 | :heavy_multiplication_x: | Set port for metrics web server |
| metrics.path | /metrics | :heavy_multiplication_x: | Path for acceding to metrics web server |
| | | | |

```yaml title=config.yaml"
metrics:
enable: true # Default: false
port: 8080 # Default : 8080
host: 0.0.0.0 # Default: 0.0.0.0
path: /metrics # Default: /metrics

```

## Env Variables


| Options | Actions |
| -------------- | --------------------------------------- |
| | |
| METRICS_ENABLE | Define if start metrics web server |
| METRICS_HOST | Set IP address for metrics web server |
| METRICS_PORT | Set port for metrics web server |
| METRICS_PATH | Path for acceding to metrics web server |

```bash title="exemple"
METRICS_ENABLE=true ./updateip
```

## Metrics details

### Global

| Metrics Name | Description |
| ---------------------------- | -------------------- |
| | |
| updateip_count_event_receive | Total event received |

### AWS Provider

| Metrics Name | Description |
| ---------------------- | ------------------------------------ |
| | |
| updateip_aws_func_time | Execution time of each function |
| updateip_aws_status | Return Status of AWS Provider |
| updateip_aws_update | Number of DNS record validity checks |
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ LOOP:
for {
select {
case sig := <-sigs:
if c.Metrics.Enable {
(*m.Counters)["eventReceive"].Inc()
}
log.Info().Msg(sig.String())
break LOOP
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (d *Paws) NewClient() error {
}

d.Events = make(chan string, 100)
d.Loop = *time.NewTicker(5 * time.Second)
d.Loop = *time.NewTicker(60 * time.Second)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/ovh/ovh.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (d *Povh) NewClient() (err error) {
d.Record.Name = u.Subdomain

d.Events = make(chan string, 100)
d.Loop = *time.NewTicker(5 * time.Second)
d.Loop = *time.NewTicker(60 * time.Second)

return
}
Expand Down

0 comments on commit b9eaa79

Please sign in to comment.