Commit Graph

117 Commits

Author SHA1 Message Date
Ivan Kozlovic
c4470d4e68 Added Subsz and Routez and updated tests
In tests, replaced all code doing http.Get, etc.. with a readBody
helper function.
Combine server functions and monitor handler tests in one test
with a for loop to try both modes on a given test.

Still need to add Connz.
2018-03-09 20:48:43 -07:00
Tyler Treat
6c7d1dc847 Add Varz server method
Fixes #612 by adding a new Varz method to the Server. This can be used
by processes embedding gnatsd to access the Varz struct without relying
on the HTTP API. This starts with just Varz but the same pattern could
be expanded to other monitoring APIs in the future.
2018-03-09 19:37:56 -07:00
Ivan Kozlovic
5a351c56ce Merge branch 'master' into add-server-id-to-routez-connz 2018-01-30 14:59:26 -07:00
Ivan Kozlovic
6fad293a21 [FIXED] Connz would "block" for TLS clients still in TLS handshake
If server requires TLS and clients are connecting, and a Connz
request is made while clients are still in TLS Handshake, the
call to tls.Conn.ConnectionState() would block for the duration
of the handshake. This would cause the overall http request to
take too long.
We will now not try to gather TLSVersion and TLSCipher from a
client that is still in TLS handshake.

Resolves #600
2017-11-09 09:47:05 -07:00
Alberto Ricart
e0fe1247dd [FIX] #490 - Added server id to connz and routez 2017-10-24 19:36:10 -05:00
Ivan Kozlovic
56649b3273 [FIXED] Possible data race in routez when route disconnects (#540)
* [FIXED] Possible data race in routez when route disconnects

Resolves #539
2017-07-11 16:11:22 -06:00
Ivan Kozlovic
70b3b18535 Fix some tests
Fixing various tests that were failing locally when running in
parallel mode (without -p=1).
In reload_test.go, lots of nats.Conn.Close() were missing which
would require too much memory when running with `-race` mode.
2017-07-05 18:57:15 -06:00
Peter Miron
00744ff426 converted MonitorAddr and ClusterAddr to *net.TCPAddr 2017-06-12 17:40:36 -04:00
Peter Miron
5e640f099d clean up of log files. removed FatalError function to make sure I'm minimizing changes to actual server. 2017-06-11 16:20:04 -04:00
Peter Miron
da1cb9abb2 missed go fmt'ing. 2017-06-10 10:39:09 -04:00
Peter Miron
d1f38f38a2 changes to support random ports for clusters and profiler. 2017-06-10 10:35:01 -04:00
Ivan Kozlovic
a87050c546 [FIXED] Check for negative Offset and/or Limit when processing Connz
Ensure that if the offset is negative, it is set to 0. If the limit
is negative, it is set to the default value.

Resolves #491
2017-05-17 12:05:54 -06:00
Ivan Kozlovic
09f4b85a66 [ADDED] Ability to get the server's HTTP Handler
This will allow applications (for instance NATS Streaming Server)
to add new endpoints to the NATS http server.

Resolves #480
2017-04-27 16:37:01 -06:00
Derek Collison
ddd1b472e2 Removed need for ignore check on staticcheck, added misspell check 2017-04-21 09:11:28 -07:00
Colin Sullivan
6e9e491c79 Updates for running in a windows container environment.
* Fixes unit tests running in windows containers with the default configuration.
2017-01-09 10:07:24 -07:00
Derek Collison
8fbacaaea1 Cleanup for cluster opts 2016-12-02 14:29:22 -08:00
Derek Collison
61e0b758d7 Updates for Go client rename, update vendor dependencies 2016-11-20 13:15:37 -08:00
Ben Tranter
ad6206078f Fix non-ASCII quotes in HTML
Fixes #304

Changes the non-ASCII curly quotes in the HTML to use the regular ASCII double quotes. Also adds a test to check for the existence of non-ASCII characters in that same HTML.
2016-09-12 11:03:19 -04:00
Ivan Kozlovic
e6039e0a8b [FIXED] Server panic when poll for Varz and others concurrently
Resolves #327
2016-08-16 10:50:49 -06:00
Colin Sullivan
80a504303e Add uptime sort option for connz. 2016-05-24 19:32:06 -06:00
Ivan Kozlovic
7bcb699903 Add /stacksz to monitoring
Allows to get the server's stacks from the monitoring interface.
2016-05-23 14:59:09 -06:00
Derek Collison
a2d03fbf5a flush immediately on creation 2016-05-22 15:04:47 -07:00
Derek Collison
67479ea4cd remove runtime import 2016-05-22 13:50:02 -07:00
Derek Collison
d4d2f5ae5c Fix flapper test 2016-05-22 13:40:50 -07:00
Derek Collison
df02549dc2 Report total subscriptions under /varz 2016-05-16 12:46:30 -07:00
Derek Collison
9e73c1db76 Enable listen address parsing for client, cluster and http, enforce http hosts as separate 2016-05-12 16:47:01 -07:00
Derek Collison
fd27025aa3 Ignore client pings for last connection activity 2016-05-09 09:56:38 -07:00
Ivan Kozlovic
bb81a37cdc Fix flapping test
Introduce sleep when checking activity updates. I had fixed it
originally for Windows and then made it for all platform recently
but only for the publish case. I missed the subscribe test.
2016-04-26 18:14:01 -06:00
Ivan Kozlovic
19ea9c5a60 Add test for Connz Total connections 2016-04-26 18:00:58 -06:00
Colin Sullivan
8a07a02a97 Rename the field to 'total'. 2016-04-26 17:49:09 -06:00
Colin Sullivan
a6dfe88746 Add a live connection count to /connz monitoring. 2016-04-26 17:24:01 -06:00
Ivan Kozlovic
acddee9c4a Fix flapping test 2016-04-22 17:10:33 -06:00
Derek Collison
f23f55518c gosimple fixes 2016-03-31 07:28:40 -07:00
Colin Sullivan
2baac47820 Address issues found by golint.
* No functional changes
* Did not address the ALL_CAPS issues
* Did not modify public APIs and field names.
2016-03-15 15:21:13 -06:00
Ivan Kozlovic
6263c66a40 Fixed code and tests to run on Windows
Mainly tests, but also a fix in route.go to reject a route when the
server is being shutdown.
2016-03-07 18:47:20 -07:00
Derek Collison
49a7f2295a gofmt -s fixes 2016-02-29 22:08:49 -08:00
Ivan Kozlovic
193597dbab Update test that would catch incorrect NumConns
- Updating TestConnzWithOffsetAndLimit() to test for c.NumConns.
This would have caught the issue that was fixed in my previous change.

- Use of variable sortValue set to pair.Val to help readability. No functional change.
2016-02-09 12:40:20 -07:00
Ivan Kozlovic
08b8dd796a Fix test to check Idle instead of relying on client id.
Since client connections are handled in go routines, we don't have a guarantee that the second client's id will be > than the first.
2016-02-08 15:51:41 -07:00
Ivan Kozlovic
ecec51a771 Reduce number of objects require to sort connection in HandleConnz
- Use 'Pair' again, but this time, the key is an int64 that the selected sort field will be casted to.
We therefore have now only one type of sort.
- Check validity of sort string early on.
- Ensure that the ConnInfo's field used by the sort is not the value from 'client', but really the one
that was used for the sort.
- Added a test for sort by Idle time.
2016-02-08 15:40:42 -07:00
Ivan Kozlovic
b6292d6d6d Fix monitor port usage for parallel tests.
Use a different MONITOR_PORT for different test packages.
2016-02-08 09:33:39 -07:00
Derek Collison
c0ba6c291f Default sort by cid for connz 2016-02-05 06:07:44 -08:00
Derek Collison
9702156d72 Connection sort updates
- fix bug that did not update last activity on message delivery
- added sort capabilities for last activity
- avoid extra Reverse by simply changing Less func
2016-02-05 05:49:53 -08:00
Derek Collison
b4a6547a18 report len(ci.subs) 2016-02-04 18:05:50 -08:00
Derek Collison
26185a9722 Support for connection last activity tracking 2016-02-04 17:33:40 -08:00
Ivan Kozlovic
0540df470c Use values from ClientInfo instead of client when returning ConnInfo.
When we are returning ConnInfo, if we use the client's current value, they may be off compared to the values used for the sort.
2016-02-03 22:03:38 -07:00
Derek Collison
6433e55314 bad test conditional 2016-01-09 10:09:05 -08:00
Derek Collison
3af90e454f Track total connections, http request stats 2016-01-09 09:57:04 -08:00
Derek Collison
b0c22e9dfd Track start and uptime per connection 2016-01-09 08:20:24 -08:00
Derek Collison
8393c3c994 Basic INFO for cluster auto-discovery, Addresses #126 2015-12-16 12:36:24 -08:00
Waldemar Quevedo
a1a5a3cf9c Expose name label from client in monitoring endpoint 2015-11-01 17:50:10 -08:00