Skip to content

Commit

Permalink
#59 improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenRover committed Jan 6, 2024
1 parent f4aabbd commit ab5145d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ Get the metrics `solace_queue_msg_shutdown_discarded` and `solace_queue_msg_max_
| TopicEndpointDetails | yes | yes | no | may harm broker if many topic-endpoints | show topic-endpoint itemFilter message-vpn vpnFilter detail count 100 (paged) | software, appliance |
| ClusterLinks | yes | yes | no | dont harm broker | show the state of the cluster links. Filters are for clusterName and linkName | software, appliance |


##### V2 endpoints

Those are semp V2 endpoints. Please avoid those.
These are still experimental caused by the terrible performance of semp V2.
For example, getting queue stats with a filter that match 4500 out of 10`000 queues.
Using a 10.5.1 software broker.
- With SempV1, it took 37.1 sec to fetch all pages/results.
- With SempV2, it took 136.2 sec to fetch all pages/results.

#### Broker Connectivity Metric

No matter which combination of targets and filters you're using, there is always one metric available that will show the success (or failure) when trying to connect to the Solace broker.
Expand Down Expand Up @@ -256,6 +266,14 @@ sslVerify=false
# Flag that enables Usage of the operating system proxy configuration.
# false=No proxy will be used at all.
useSystemProxy=false

# 0s means disabled. When set an interval, all well configured endpoints will fetched async.
# This may help you to deal with slower broker or extreme amount of results.
prefetchInterval=30s

# Maximum connections to the configured broker. Keep in mind solace advices us to use max 10 semp connects per seconds.
# Dont increase this value if your broker may have more thant 100 clients, queues, ...
parallelSempConnections=1
```

### Environment Variables
Expand Down
12 changes: 11 additions & 1 deletion exporter/asyncFetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ func NewAsyncFetcher(urlPath string, dataSource []DataSource, conf Config, logge

_ = level.Debug(logger).Log("msg", "Fetching for handler", "handler", "/"+urlPath)

var startTime = time.Now()
readMetrics(fetcher)

connections.Release(1)

// _ = level.Debug(logger).Log("msg", "Finished fetching for handler", "handler", "/"+urlPath)
// Be nice to the broker and wait between scrapes and let other threads fetch data.
time.Sleep(conf.PrefetchInterval)
sleepUntilNextIteration(startTime, conf.PrefetchInterval)
}
}

Expand All @@ -50,6 +51,15 @@ func NewAsyncFetcher(urlPath string, dataSource []DataSource, conf Config, logge
return fetcher
}

func sleepUntilNextIteration(startTime time.Time, interval time.Duration) {
now := time.Now()
nextInterval := startTime.Add(interval)
if nextInterval.After(now) {
timeToSleep := nextInterval.Sub(now)
time.Sleep(timeToSleep)
}
}

type AsyncFetcher struct {
mutex sync.Mutex
dataSource []DataSource
Expand Down
2 changes: 2 additions & 0 deletions solace_prometheus_exporter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ sslVerify=false
# This may help you to deal with slower broker or extreme amount of results.
prefetchInterval=30s

# Maximum connections to the configured broker. Keep in mind solace advices us to use max 10 semp connects per seconds.
# Dont increase this value if your broker may have more thant 100 clients, queues, ...
parallelSempConnections=1

[endpoint.solace-v1-test]
Expand Down

0 comments on commit ab5145d

Please sign in to comment.