Граф коммитов

39 Коммитов

Автор SHA1 Сообщение Дата
Brian Tiger Chow 2c2d834e8e stats: add BeginTime to stats.End (#1907) 2018-03-12 09:16:36 -07:00
dfawley 365770fcbd
streams: Stop cleaning up after orphaned streams (#1854)
This change introduces some behavior changes that should not impact users that
are following the proper stream protocol. Specifically, one of the following
conditions must be satisfied:

1. The user calls Close on the ClientConn.
2. The user cancels the context provided to NewClientStream, or its deadline
    expires. (Note that it if the context is no longer needed before the deadline
    expires, it is still recommended to call cancel to prevent bloat.) It is always
    recommended to cancel contexts when they are no longer needed, and to
    never use the background context directly, so all users should always be
    doing this.
3. The user calls RecvMsg (or Recv in generated code) until a non-nil error is
    returned.
4. The user receives any error from Header or SendMsg (or Send in generated
    code) besides io.EOF.  If none of the above happen, this will leak a goroutine
    and a context, and grpc will not call the optionally-configured stats handler
    with a stats.End message.

Before this change, if a user created a stream and the server ended the stream,
the stats handler would be invoked with a stats.End containing the final status
of the stream. Subsequent calls to RecvMsg would then trigger the stats handler
with InPayloads, which may be unexpected by stats handlers.
2018-02-08 10:51:16 -08:00
dfawley f4b523765c
status: add Code convenience function (#1754) 2017-12-18 15:00:50 -08:00
Daniel Nephin 4e393e0b21 grpc: fix deprecation comments to conform to standard (#1691) 2017-12-18 09:23:42 -08:00
Menghan Li 6ef45d3689
fix stats flaky test (#1740)
1. Call transport Close if newHTTP2Server returns non-nil error.
Handle ConnBegin was called before this error, and handle ConnEnd is not called (because Close() is not called), which caused ConnStats check to fail.

2. Skip stats test in go1.6.
go1.6 doesn't have DialContext (we use Dialer(Cancel: ctx.Done()) instead). When the give context is canceled, this function sometimes returns canceled error, while the server side still gets the conn. This caused the server blocking on reading the preface (which will eventually timeout, but the tests are too short for that), and there will be a missing ConnEnd.
2017-12-15 14:37:20 -08:00
Gyu-Ho Lee 865013bc17 *: replace deprecated grpc.Errorf calls with status.Errorf (#1651) 2017-11-06 10:24:20 -08:00
Menghan Li cf79c84979 fix stats test race (#1560)
* fix stats test race
* and try fix TestMapAddressEnv race
2017-10-04 14:30:12 -07:00
Menghan Li 3bf110cd0c fix TestServerCredsDispatch and stats test race (#1554) 2017-10-03 17:07:39 -07:00
mmukhi 6014154b60 Use the same hpack encoder on a transport and share it between RPCs. (#1536) 2017-09-28 13:37:13 -07:00
dfawley 69abda08b5 stats: add methods to allow setting grpc-trace-bin and grpc-tags-bin headers (#1404)
This is in preparation for preventing any user-supplied metadata starting with "grpc-", which is reserved.

* stats: add methods to allow setting grpc-trace-bin and grpc-tags-bin headers

Pick these up in grpc's transport when sending and fill them when receiving.

* Add tags/trace to metadata and tests for that behavior

This is temporary to maintain compatibility and provide a migration strategy.
2017-08-24 10:00:40 -07:00
dfawley 596a6acc87 metadata: Remove NewContext and FromContext for gRFC L7 (#1392) 2017-08-17 13:10:28 -07:00
Menghan Li 834dbd54e0 replace 127.0.0.1 with localhost for ipv6 only environment (#1306) 2017-06-14 15:03:04 -07:00
Jan Tattermusch ddbf6c46a6 autofix license notice 2017-06-08 14:42:19 +02:00
Charith Ellawala a0c3e72252 Add stats test for client streaming and server streaming RPCs (#1140) 2017-05-11 11:58:13 -07:00
Menghan Li 17760cfd5b Calling handleRPC with context derived from the original (#1227)
* Calling handleRPC with different context derived from the original context
* change comment for tagRPC and stats fields
2017-05-10 17:54:49 -07:00
Menghan Li cd8432ec07 Move handling stats.End to clientStream.finish() (#1182)
* move handling stats.End to clientStream.finish()
* add stats test for streaming RPC not calling last recv()
2017-04-12 11:55:54 -07:00
dfawley 0c1d39df28 Separate incoming and outgoing metadata in context
This will prevent the incoming RPCs' metadata from appearing in outgoing RPCs
unless it is explicitly copied, e.g.:

incomingMD, ok := metadata.FromContext(ctx)
if ok {
  ctx = metadata.NewContext(ctx, incomingMD)
}

Fixes #1148
2017-04-07 11:54:56 -07:00
Menghan Li cb653e4b61 Change stats APIs (#1030)
Change stats API from one static handler to one handler per server or client.
2017-01-09 17:11:32 -08:00
Menghan Li 7484960149 remove stats.Stop() and fix flaky stats test (#1016) 2016-12-07 17:33:01 -08:00
Menghan Li deb01f422a add stats tagger APIs and connection stats. (#992)
* add stats.tagger APIs and connection stats.

* fix comments

use ac.ctx in http2client
change name and comments
small fixes stats_tests

* add a TODO to ConnTagInfo

* rename handle to handleRPC

* modify stats comments
2016-11-30 16:25:46 -08:00
Menghan Li 524f421370 fix flaky stats test and reuse functions in stats test 2016-11-10 17:42:52 -08:00
Menghan Li 88bdb9565f fixes in test 2016-11-09 14:04:51 -08:00
Menghan Li 6445dedfbc fix wrong context when handling stats 2016-11-08 18:17:14 -08:00
Menghan Li 183e5e98ab fix comments in stats testing 2016-11-08 16:48:49 -08:00
Menghan Li 5938492b60 fix comments 2016-11-07 15:16:52 -08:00
Menghan Li 1d2a929ae5 add stats.Begin and stats.End 2016-11-07 15:16:52 -08:00
Menghan Li 8a126b020f change stats comments 2016-11-07 15:16:52 -08:00
Menghan Li c0087b3c91 add failfast option to stats 2016-11-07 15:16:52 -08:00
Menghan Li 0d345b58c0 change package stats comment 2016-11-07 15:16:52 -08:00
Menghan Li be66502802 change behavior of stats register handler and start stop 2016-11-07 15:16:52 -08:00
Menghan Li c698588285 Renaming types and variables 2016-11-07 15:16:52 -08:00
Menghan Li e42a66c81b add client stats 2016-11-07 15:16:52 -08:00
Menghan Li adaae03378 remove initStats, merge into headerStats 2016-11-07 15:16:52 -08:00
Menghan Li aa914665f0 add isclient to errorstats 2016-11-07 15:16:52 -08:00
Menghan Li 1054f1c42b add payload with original type to payload stats 2016-11-07 15:16:52 -08:00
Menghan Li 85c5e0e3b6 add errorStats 2016-11-07 15:16:52 -08:00
Menghan Li 7984a9c679 change CallBack to handler, and move ctx out of Stats. 2016-11-07 15:16:52 -08:00
Menghan Li 46e80bf1f6 fix race in test and add import comments 2016-11-07 15:16:52 -08:00
Menghan Li 17ee5a3637 Add package stats, and export stats on server side. 2016-11-07 15:16:52 -08:00