Commit Graph

146 Commits

Author SHA1 Message Date
Derek Collison
30e31d5cd2 Test dynamic buffers, track short reads/writes
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-04 17:45:05 -07:00
Derek Collison
766ef3b0b1 Add max_pending and write_deadline to varz
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-04 17:45:05 -07:00
Derek Collison
481697ef67 New outbound data architecture
Signed-off-by: Derek Collison <derek@nats.io>
2018-06-04 17:45:05 -07:00
Derek Collison
b2a9ed97d6 Merge pull request #650 from nats-io/cncf
Move to CNCF and Apache 2 License
2018-03-16 16:23:10 -07:00
Ivan Kozlovic
4e9d785423 Capture possible error in Atoi conversion of url params 2018-03-16 10:42:52 -06:00
Derek Collison
00901acc78 Update license to Apache 2 2018-03-15 22:31:07 -07:00
Ivan Kozlovic
a3e8fba6b3 Add options for each monitoring endpoint and added Connz
Even for endpoints that currently do not need options (such as
Subsz and Varz), I added some options and a return of error so that
we don't break the API if we ever need to add options for those.
2018-03-13 10:30:46 -06:00
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
Tyler Treat
dd3ad77ea8 Replace reloaded varz field with config_load_time 2017-06-27 14:33:06 -05:00
Tyler Treat
9adfae11a2 Add reload count to server for monitoring 2017-06-23 10:03:01 -05:00
Tyler Treat
cc30af8ede Address code review feedback 2017-06-05 17:43:42 -05:00
Tyler Treat
c468abd15f Merge branch 'master' of github.com:nats-io/gnatsd into config_reload 2017-06-05 13:41:04 -05:00
Tyler Treat
28160f1de2 Remove global logger
gnatsd currently uses a global logger. This can cause some problems
(especially around the config-reload work), but global variables are
also just an anti-pattern in general. The current behavior is
particularly surprising because the global logger is configured through
calls to the Server.

This addresses issue #500 by removing the global logger and making it a
field on Server.
2017-05-31 16:06:31 -05:00
Tyler Treat
9902c3da84 First pass at implementing config reload 2017-05-30 16:18:36 -05: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
Derek Collison
f7ba3d175e Correct invocation of misspell with fixes 2017-04-21 09:21:33 -07:00
Derek Collison
b11ba5b118 Merge pull request #456 from wallyqs/gometalinter-checks
Fixes to a couple of `gometalinter` checks
2017-03-24 09:35:09 -07:00
Waldemar Quevedo
ed05c357fc Remove unused type 2017-03-23 20:41:47 -07:00
Colin Sullivan
3f8a0d8b4a Use atomic.Load to access fields used in /varz and /subsz requests.
* Includes a unit test that checks all endpoints for data races.
2017-03-01 16:13:20 -07: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
3492d25e69 Use initial buffer on stack 2016-05-23 22:41:40 -06:00
Ivan Kozlovic
2068cc7b36 Minor updates based on comments 2016-05-23 22:32:31 -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
df02549dc2 Report total subscriptions under /varz 2016-05-16 12:46:30 -07:00
Derek Collison
82f04baa12 Allow optional reporting of authorized user under connz 2016-05-15 10:07:37 -07:00
Colin Sullivan
8a07a02a97 Rename the field to 'total'. 2016-04-26 17:49:09 -06:00
Colin Sullivan
19d4848008 Access server clients within lock. 2016-04-26 17:34:03 -06:00
Colin Sullivan
a6dfe88746 Add a live connection count to /connz monitoring. 2016-04-26 17:24:01 -06:00
Derek Collison
5bea74c2ed Rename and move some things around 2016-04-21 09:33:26 -07:00
Derek Collison
6ce89066fb race fix 2016-04-03 14:40:45 -07:00
Derek Collison
df02bc0bcf Removed sublist, hash and hashmap, no longer needed. 2016-04-02 12:52:48 -07:00
Derek Collison
3dd490a449 Go Report Card fixes 2016-03-20 16:06:28 -10: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
Waldemar Quevedo
7ac3eae82e Set IP and Port for connections using TLS in /connz 2016-02-15 17:40:13 -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
e5f0dabe08 Reduce memory allocations + fix c.NumConns that may have been wrong.
c.NumConns was set early to len(s.clients). However, after the sort, it was possible that the actual Conns[] array be much smaller due to minoff/maxoff.
So c.NumConns is now updated only after applying the offsets.
In order to pre-allocate the Conns buffer, I no longer skip a client if tlsRequired is true and connection is gone. I will simply not update the TLSVersion and TLSCipher.
2016-02-08 20:46:22 -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
Derek Collison
d7c8e6bca8 Fix races in monitoring
- Possible race/invalid value in LastActivity
- Routez
- Believe fixes #189
2016-02-06 07:09:13 -08: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
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
Ivan Kozlovic
e893d873be Forgot to use atomic for inMsgs and inBytes in one place. 2016-02-03 21:36:07 -07:00