[GitHub] [servicecomb-service-center] tianxiaoliang merged pull request #625: [SCB-1729] recover logs also output to stderr
tianxiaoliang merged pull request #625: [SCB-1729] recover logs also output to stderr URL: https://github.com/apache/servicecomb-service-center/pull/625 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[servicecomb-service-center] branch master updated: [SCB-1729] recover logs also output to stderr (#625)
This is an automated email from the ASF dual-hosted git repository. tianxiaoliang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-service-center.git The following commit(s) were added to refs/heads/master by this push: new c1b43ad [SCB-1729] recover logs also output to stderr (#625) c1b43ad is described below commit c1b43ad0514ac4bdbbe08461ded62caf2a7aeee5 Author: humingcheng AuthorDate: Fri Jan 17 14:46:23 2020 +0800 [SCB-1729] recover logs also output to stderr (#625) --- pkg/log/zap.go | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkg/log/zap.go b/pkg/log/zap.go index e5e9fc1..3040c6e 100644 --- a/pkg/log/zap.go +++ b/pkg/log/zap.go @@ -19,15 +19,17 @@ package log import ( "fmt" - "github.com/apache/servicecomb-service-center/pkg/util" - "github.com/natefinch/lumberjack" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" "os" "runtime" "runtime/debug" "strings" "time" + + "github.com/apache/servicecomb-service-center/pkg/util" + + "github.com/natefinch/lumberjack" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" ) const ( @@ -201,6 +203,12 @@ func (l *Logger) Recover(r interface{}, callerSkip int) { Caller: zapcore.NewEntryCaller(runtime.Caller(callerSkip + 1)), Stack: zap.Stack("stack").String, } + // recover logs also output to stderr + fmt.Fprintf(StderrSyncer, "%s\tPANIC\t%s\t%s\n%v\n", + e.Time.Format("2006-01-02T15:04:05.000Z0700"), + e.Caller.TrimmedPath(), + r, + e.Stack) if err := l.zapLogger.Core().With([]zap.Field{zap.Reflect("recover", r)}).Write(e, nil); err != nil { fmt.Fprintf(StderrSyncer, "%s\tERROR\t%v\n", time.Now().Format("2006-01-02T15:04:05.000Z0700"), err) fmt.Fprintln(StderrSyncer, util.BytesToStringWithNoCopy(debug.Stack()))
[GitHub] [servicecomb-java-chassis] coveralls commented on issue #1544: [SCB-1730]highway support primitive default values and convert char/byte/short
coveralls commented on issue #1544: [SCB-1730]highway support primitive default values and convert char/byte/short URL: https://github.com/apache/servicecomb-java-chassis/pull/1544#issuecomment-575459518 [![Coverage Status](https://coveralls.io/builds/28166270/badge)](https://coveralls.io/builds/28166270) Coverage decreased (-0.04%) to 84.273% when pulling **a9aff26a3d0784794cf02a60adde6f217f4fa8a3 on liubao68:highway** into **e3d0be4a1d1d69b797aad0480376346e07792ff8 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-service-center] coveralls commented on issue #625: [SCB-1729] recover logs also output to stderr
coveralls commented on issue #625: [SCB-1729] recover logs also output to stderr URL: https://github.com/apache/servicecomb-service-center/pull/625#issuecomment-575458031 [![Coverage Status](https://coveralls.io/builds/28166187/badge)](https://coveralls.io/builds/28166187) Coverage decreased (-0.2%) to 59.651% when pulling **3159550a1a76a9206d0f1d1b4656b16399852840 on humingcheng:errLog2** into **214b429503ec8927d84285be411c4811daecdbed on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-java-chassis] yhs0092 commented on issue #1543: 开启Https双向认证后如何对接nginx
yhs0092 commented on issue #1543: 开启Https双向认证后如何对接nginx URL: https://github.com/apache/servicecomb-java-chassis/issues/1543#issuecomment-575453176 如果你的NGINX是做反向代理的,Java-Chassis这边的微服务开启了双向认证的话,就需要NGINX配置客户端证书,证书能被Java-Chassis微服务信任。 可以在Java微服务启动命令里加上`-Djavax.net.debug=ssl`看看SSL握手具体在哪一步报错。 Nginx证书的配置方式需要查阅Nginx的资料才行。 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-pack] pengyu0929 commented on issue #633: omega不能正常重连alpha
pengyu0929 commented on issue #633: omega不能正常重连alpha URL: https://github.com/apache/servicecomb-pack/issues/633#issuecomment-575450542 使用的0.4.0版本; 这个不是数据连接的问题,是因为你们并没有兼容ORACLE数据库,ORACLE数据库是不支持存储空字符串的,而`SagaStartedEvent`的构造函数中`compensationMethod`属性使用`空字符串`初始化,并且该字段在`txevent`表中是`非null`的,所以报了数据插入异常,`SagaEndedEvent`也有同样的问题; ```java public class SagaStartedEvent extends TxEvent { public SagaStartedEvent(String globalTxId, String localTxId, int timeout) { // use "" instead of null as compensationMethod requires not null in sql super(EventType.SagaStartedEvent, globalTxId, localTxId, null, "", timeout, "", 0); } } ``` ```java public class SagaEndedEvent extends TxEvent { SagaEndedEvent(String globalTxId, String localTxId) { super(EventType.SagaEndedEvent, globalTxId, localTxId, null, "", 0, "", 0); } } ``` 我提个建议,你们是否需要重构下alpha端的sql,继而兼容多种数据库呢? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-java-chassis] liubao68 opened a new pull request #1544: [SCB-1730]highway support primitive default values and convert char/byte/short
liubao68 opened a new pull request #1544: [SCB-1730]highway support primitive default values and convert char/byte/short URL: https://github.com/apache/servicecomb-java-chassis/pull/1544 Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [ ] Each commit in the pull request should have a meaningful subject line and body. - [ ] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [ ] Run `mvn clean install -Pit` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-service-center] humingcheng opened a new pull request #625: [SCB-1729] recover logs also output to stderr
humingcheng opened a new pull request #625: [SCB-1729] recover logs also output to stderr URL: https://github.com/apache/servicecomb-service-center/pull/625 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [x] Each commit in the pull request should have a meaningful subject line and body. - [x] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Run `go build` `go test` `go fmt` `go vet` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [x] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-java-chassis] edsuperyang opened a new issue #1543: 开启Https双向认证后如何对接nginx
edsuperyang opened a new issue #1543: 开启Https双向认证后如何对接nginx URL: https://github.com/apache/servicecomb-java-chassis/issues/1543 开启https双向认证 ![image](https://user-images.githubusercontent.com/12776176/72579596-88794700-3914-11ea-9f24-4b81adadae34.png) 此时nginx接入的请求报错 2020/01/17 09:35:50 [error] 14558#0: *5546524 SSL_do_handshake() failed (SSL: error:14094412:SSL routines:ssl3_read_bytes:sslv3 alert bad certificate:SSL alert number 42) while SSL handshaking to upstream, client: 58.240.77.242, server: lfsmurfsecuritytest.hwcloudtest.cn, request: "POST /smurf/v1/device/user/its/schedule HTTP/1.1", upstream: "https://10.31.53.67:18080/smurf/v1/device/user/its/schedule;, host: "lfsmurfsecuritytest.hwcloudtest.cn:21443" 请问开启https后 ,nginx如何配置对应的证书?没找到相关资料 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1522: 接口返回值定义的是ResponseEntity,为什么返回值的Body为空?
liubao68 commented on issue #1522: 接口返回值定义的是ResponseEntity,为什么返回值的Body为空? URL: https://github.com/apache/servicecomb-java-chassis/issues/1522#issuecomment-575428095 下面有个例子可以参考下: ``` @ResponseHeaders({@ResponseHeader(name = "h1", response = String.class), @ResponseHeader(name = "h2", response = String.class)}) @RequestMapping(path = "/responseEntity", method = RequestMethod.POST) public ResponseEntity responseEntity(InvocationContext c1, @RequestAttribute("date") Date date) { HttpHeaders headers = new HttpHeaders(); headers.add("h1", "h1v " + c1.getContext().get(Const.SRC_MICROSERVICE)); InvocationContext c2 = ContextUtils.getInvocationContext(); headers.add("h2", "h2v " + c2.getContext().get(Const.SRC_MICROSERVICE)); return new ResponseEntity<>(date, headers, HttpStatus.ACCEPTED); } ``` 注意: 1. 需要显示声明ResponseEntity的模板类型; 2. 如果还需要返回额外的headers,需要通过ResponseHeaders显示的声明返回的header。 这个是java-chassis和Spring MVC不同的地方, 接口定义需要是明确的,能够通过契约描述出来实际的类型和header。 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1542: 为什么服务端读出的cookie会丢失内容?
liubao68 commented on issue #1542: 为什么服务端读出的cookie会丢失内容? URL: https://github.com/apache/servicecomb-java-chassis/issues/1542#issuecomment-575426995 看你的描述没太理解里面的过程。 Nginx -> 服务端; 工具 -> 服务端 这两个过程看起来场景是一样的,不应该存在不一样的情况。 不过使用java-chassis需要有个主意的地方,如果经过多跳到达服务端:比如 Nginx -> Edge service -> 微服务, 或者Nginx -> 微服务A -> 微服务B, 那么后面的微服务可能是获取不到在“契约”以外的数据的,包括你说的cookie。 因为java-chassis设计的时候, 没有完全假设底层运行的是HTTP协议,而是任何可能的协议。所以关注的数据是“契约”描述的数据。 早起的一些应用场景,比如通过cookie, HTTP Header等认证的情况, 可以尝试配套 HttpServerFilter和InvocationContext来实现。 首先自定义HttpServerFilter,将需要获取的数据设置到InvocationContext里面, 业务代码需要使用的地方,通过InvocationContext获取。 这个流程你可以通过[servicecomb-fence](https://github.com/apache/servicecomb-fence)看到一些代码示例 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-pack] WillemJiang commented on issue #633: omega不能正常重连alpha
WillemJiang commented on issue #633: omega不能正常重连alpha URL: https://github.com/apache/servicecomb-pack/issues/633#issuecomment-575393205 你使用的是什么版本? 数据库连接失败应该是可以单独处理,让Omega报Alpha数据库连接的错。 还有可否建一个issue 把支持ORACLESQL以PR的方式提上来? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-kie] GuoYL123 opened a new pull request #72: add interface to add alias
GuoYL123 opened a new pull request #72: add interface to add alias URL: https://github.com/apache/servicecomb-kie/pull/72 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-service-center] humingcheng commented on a change in pull request #622: [SCB-1719] Support access log
humingcheng commented on a change in pull request #622: [SCB-1719] Support access log URL: https://github.com/apache/servicecomb-service-center/pull/622#discussion_r367399880 ## File path: pkg/log/zap.go ## @@ -59,6 +59,9 @@ type Config struct { // days LogBackupAge int CallerSkip int + EnableTime bool // whether to record time + EnableLevel bool // whether to record level + EnableCaller bool // whether to record caller Review comment: 已修改 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-service-center] humingcheng commented on a change in pull request #622: [SCB-1719] Support access log
humingcheng commented on a change in pull request #622: [SCB-1719] Support access log URL: https://github.com/apache/servicecomb-service-center/pull/622#discussion_r367399807 ## File path: server/handler/accesslog/handler.go ## @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build go1.9 + +package accesslog + +import ( + "fmt" + "net/http" + "os" + "time" + + "github.com/apache/servicecomb-service-center/pkg/chain" + "github.com/apache/servicecomb-service-center/pkg/log" + "github.com/apache/servicecomb-service-center/pkg/rest" + "github.com/apache/servicecomb-service-center/pkg/util" + "github.com/apache/servicecomb-service-center/server/core" + svr "github.com/apache/servicecomb-service-center/server/rest" +) + +// Handler implements chain.Handler +// Handler records access log +type Handler struct { + logger*log.Logger + whiteListAPIs map[string]struct{} // not record access log +} + +// Handle handles the request +func (l *Handler) Handle(i *chain.Invocation) { + matchPattern := i.Context().Value(rest.CTX_MATCH_PATTERN).(string) + if _, ok := l.whiteListAPIs[matchPattern]; ok { + i.Next() + return + } + startTimeStr := "unknown" Review comment: 按照SC的机制,不ok的话,用当前时间是不准确的,注明unknown反而反应真实情况 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-service-center] humingcheng commented on a change in pull request #622: [SCB-1719] Support access log
humingcheng commented on a change in pull request #622: [SCB-1719] Support access log URL: https://github.com/apache/servicecomb-service-center/pull/622#discussion_r367399975 ## File path: server/handler/accesslog/handler.go ## @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build go1.9 + +package accesslog + +import ( + "fmt" + "net/http" + "os" + "time" + + "github.com/apache/servicecomb-service-center/pkg/chain" + "github.com/apache/servicecomb-service-center/pkg/log" + "github.com/apache/servicecomb-service-center/pkg/rest" + "github.com/apache/servicecomb-service-center/pkg/util" + "github.com/apache/servicecomb-service-center/server/core" + svr "github.com/apache/servicecomb-service-center/server/rest" +) + +// Handler implements chain.Handler +// Handler records access log +type Handler struct { + logger*log.Logger + whiteListAPIs map[string]struct{} // not record access log +} + +// Handle handles the request +func (l *Handler) Handle(i *chain.Invocation) { + matchPattern := i.Context().Value(rest.CTX_MATCH_PATTERN).(string) + if _, ok := l.whiteListAPIs[matchPattern]; ok { + i.Next() + return + } + startTimeStr := "unknown" + start, ok := i.Context().Value(svr.CTX_START_TIMESTAMP).(time.Time) + if ok { + startTimeStr = start.Format("2006-01-02T15:04:05.000Z07:00") + } + r := i.Context().Value(rest.CTX_REQUEST).(*http.Request) + w := i.Context().Value(rest.CTX_RESPONSE).(http.ResponseWriter) + i.Next(chain.WithAsyncFunc(func(_ chain.Result) { + delayByMillisecond := "unknown" + if ok { + delayByMillisecond = fmt.Sprintf("%d", time.Since(start)/time.Millisecond) + } + statusCode := w.Header().Get(rest.HEADER_RESPONSE_STATUS) + // format: remoteIp requestReceiveTime "method requestUri proto" statusCode requestBodySize delay(ms) + // example: 127.0.0.1 2006-01-02T15:04:05.000Z07:00 "GET /v4/default/registry/microservices HTTP/1.1" 200 0 0 + l.logger.Infof("%s %s \"%s %s %s\" %s %d %s", + util.GetIPFromContext(i.Context()), + startTimeStr, + r.Method, + r.RequestURI, + r.Proto, + statusCode, + r.ContentLength, + delayByMillisecond) + })) +} + +// NewAccessLogHandler creates a Handler +func NewAccessLogHandler(l *log.Logger, m map[string]struct{}) *Handler { + return { + logger:l, + whiteListAPIs: m} +} + +// RegisterHandlers registers an access log handler to the handler chain +func RegisterHandlers() { + if !core.ServerInfo.Config.EnableAccessLog { + return + } + logger := log.NewLogger(log.Config{ + LoggerFile: os.ExpandEnv(core.ServerInfo.Config.AccessLogFile), + LogFormatText: true, + LogRotateSize: int(core.ServerInfo.Config.LogRotateSize), + LogBackupCount: int(core.ServerInfo.Config.LogBackupCount), + }) + whiteListAPIs := make(map[string]struct{}, 0) + // no access log for heartbeat + whiteListAPIs["/v4/:project/registry/microservices/:serviceId/instances/:instanceId/heartbeat"] = struct{}{} + h := NewAccessLogHandler(logger, whiteListAPIs) Review comment: 已修改 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-service-center] humingcheng commented on a change in pull request #622: [SCB-1719] Support access log
humingcheng commented on a change in pull request #622: [SCB-1719] Support access log URL: https://github.com/apache/servicecomb-service-center/pull/622#discussion_r367398763 ## File path: server/handler/accesslog/handler.go ## @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build go1.9 + +package accesslog + +import ( + "fmt" + "net/http" + "os" + "time" + + "github.com/apache/servicecomb-service-center/pkg/chain" + "github.com/apache/servicecomb-service-center/pkg/log" + "github.com/apache/servicecomb-service-center/pkg/rest" + "github.com/apache/servicecomb-service-center/pkg/util" + "github.com/apache/servicecomb-service-center/server/core" + svr "github.com/apache/servicecomb-service-center/server/rest" +) + +// Handler implements chain.Handler +// Handler records access log +type Handler struct { + logger*log.Logger + whiteListAPIs map[string]struct{} // not record access log +} + +// Handle handles the request +func (l *Handler) Handle(i *chain.Invocation) { + matchPattern := i.Context().Value(rest.CTX_MATCH_PATTERN).(string) + if _, ok := l.whiteListAPIs[matchPattern]; ok { + i.Next() + return + } + startTimeStr := "unknown" + start, ok := i.Context().Value(svr.CTX_START_TIMESTAMP).(time.Time) + if ok { + startTimeStr = start.Format("2006-01-02T15:04:05.000Z07:00") + } + r := i.Context().Value(rest.CTX_REQUEST).(*http.Request) + w := i.Context().Value(rest.CTX_RESPONSE).(http.ResponseWriter) + i.Next(chain.WithAsyncFunc(func(_ chain.Result) { + delayByMillisecond := "unknown" + if ok { + delayByMillisecond = fmt.Sprintf("%d", time.Since(start)/time.Millisecond) + } + statusCode := w.Header().Get(rest.HEADER_RESPONSE_STATUS) + // format: remoteIp requestReceiveTime "method requestUri proto" statusCode requestBodySize delay(ms) + // example: 127.0.0.1 2006-01-02T15:04:05.000Z07:00 "GET /v4/default/registry/microservices HTTP/1.1" 200 0 0 + l.logger.Infof("%s %s \"%s %s %s\" %s %d %s", + util.GetIPFromContext(i.Context()), + startTimeStr, + r.Method, + r.RequestURI, + r.Proto, + statusCode, + r.ContentLength, + delayByMillisecond) + })) +} + +// NewAccessLogHandler creates a Handler +func NewAccessLogHandler(l *log.Logger, m map[string]struct{}) *Handler { + return { + logger:l, + whiteListAPIs: m} +} + +// RegisterHandlers registers an access log handler to the handler chain +func RegisterHandlers() { + if !core.ServerInfo.Config.EnableAccessLog { + return + } + logger := log.NewLogger(log.Config{ + LoggerFile: os.ExpandEnv(core.ServerInfo.Config.AccessLogFile), + LogFormatText: true, + LogRotateSize: int(core.ServerInfo.Config.LogRotateSize), + LogBackupCount: int(core.ServerInfo.Config.LogBackupCount), + }) + whiteListAPIs := make(map[string]struct{}, 0) + // no access log for heartbeat + whiteListAPIs["/v4/:project/registry/microservices/:serviceId/instances/:instanceId/heartbeat"] = struct{}{} Review comment: v3的heartbeat已经加入;硬编码的地方很多,一次改不完,记个问题,后面一起改掉; This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-service-center] humingcheng commented on a change in pull request #622: [SCB-1719] Support access log
humingcheng commented on a change in pull request #622: [SCB-1719] Support access log URL: https://github.com/apache/servicecomb-service-center/pull/622#discussion_r367395172 ## File path: pkg/log/zap.go ## @@ -214,11 +230,12 @@ func (l *Logger) Sync() { } func NewLogger(cfg Config) *Logger { - l := zap.New(toZapConfig(cfg), - zap.ErrorOutput(StderrSyncer), - zap.AddCaller(), - zap.AddCallerSkip(cfg.CallerSkip), - ) + opts := make([]zap.Option, 0) Review comment: Done. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-service-center] codecov-io edited a comment on issue #622: [SCB-1719] Support access log
codecov-io edited a comment on issue #622: [SCB-1719] Support access log URL: https://github.com/apache/servicecomb-service-center/pull/622#issuecomment-573651885 # [Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/622?src=pr=h1) Report > Merging [#622](https://codecov.io/gh/apache/servicecomb-service-center/pull/622?src=pr=desc) into [master](https://codecov.io/gh/apache/servicecomb-service-center/commit/1192e430dbc2ec0a803e62f9a22e5dc15ed2f897?src=pr=desc) will **decrease** coverage by `0.08%`. > The diff coverage is `24.41%`. [![Impacted file tree graph](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/graphs/tree.svg?width=650=GAaF7zrg8R=150=pr)](https://codecov.io/gh/apache/servicecomb-service-center/pull/622?src=pr=tree) ```diff @@Coverage Diff @@ ## master #622 +/- ## == - Coverage57.3% 57.21% -0.09% == Files 205 206 +1 Lines 1587715975 +98 == + Hits 9098 9140 +42 - Misses 6127 6174 +47 - Partials 652 661 +9 ``` | [Impacted Files](https://codecov.io/gh/apache/servicecomb-service-center/pull/622?src=pr=tree) | Coverage Δ | | |---|---|---| | [server/core/proto/types.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree#diff-c2VydmVyL2NvcmUvcHJvdG8vdHlwZXMuZ28=) | `0% <ø> (ø)` | :arrow_up: | | [server/core/config.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree#diff-c2VydmVyL2NvcmUvY29uZmlnLmdv) | `0% <0%> (ø)` | :arrow_up: | | [pkg/log/zap.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree#diff-cGtnL2xvZy96YXAuZ28=) | `80.83% <23.8%> (-8.59%)` | :arrow_down: | | [server/handler/accesslog/handler.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree#diff-c2VydmVyL2hhbmRsZXIvYWNjZXNzbG9nL2hhbmRsZXIuZ28=) | `29.09% <29.09%> (ø)` | | | [syncer/pkg/utils/addr.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree#diff-c3luY2VyL3BrZy91dGlscy9hZGRyLmdv) | `63.63% <0%> (-9.1%)` | :arrow_down: | | [server/metric/metrics.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree#diff-c2VydmVyL21ldHJpYy9tZXRyaWNzLmdv) | `80.82% <0%> (-3.18%)` | :arrow_down: | | [syncer/servicecenter/sync.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree#diff-c3luY2VyL3NlcnZpY2VjZW50ZXIvc3luYy5nbw==) | `71.42% <0%> (-2.39%)` | :arrow_down: | | [scctl/pkg/plugin/diagnose/compare\_holder.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree#diff-c2NjdGwvcGtnL3BsdWdpbi9kaWFnbm9zZS9jb21wYXJlX2hvbGRlci5nbw==) | `94.87% <0%> (-1.29%)` | :arrow_down: | | [syncer/plugins/servicecenter/transform.go](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree#diff-c3luY2VyL3BsdWdpbnMvc2VydmljZWNlbnRlci90cmFuc2Zvcm0uZ28=) | `53.57% <0%> (-0.72%)` | :arrow_down: | | ... and [4 more](https://codecov.io/gh/apache/servicecomb-service-center/pull/622/diff?src=pr=tree-more) | | -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/622?src=pr=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/servicecomb-service-center/pull/622?src=pr=footer). Last update [1192e43...0c65d42](https://codecov.io/gh/apache/servicecomb-service-center/pull/622?src=pr=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-service-center] coveralls edited a comment on issue #622: [SCB-1719] Support access log
coveralls edited a comment on issue #622: [SCB-1719] Support access log URL: https://github.com/apache/servicecomb-service-center/pull/622#issuecomment-573651788 [![Coverage Status](https://coveralls.io/builds/28150142/badge)](https://coveralls.io/builds/28150142) Coverage decreased (-0.1%) to 59.684% when pulling **0c65d4235e0f4a00df1257f35f5a0b91dfb8f279 on humingcheng:master** into **214b429503ec8927d84285be411c4811daecdbed on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-java-chassis] liubao68 merged pull request #1540: [SCB-1727]support encode/decode Object(Any) types
liubao68 merged pull request #1540: [SCB-1727]support encode/decode Object(Any) types URL: https://github.com/apache/servicecomb-java-chassis/pull/1540 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[servicecomb-java-chassis] 01/02: [SCB-1727]support encode/decode Object(Any) types
This is an automated email from the ASF dual-hosted git repository. liubao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git commit 3dd9fc0115150c39595a4e654fc0d477a080bbae Author: liubao AuthorDate: Thu Jan 16 10:18:09 2020 +0800 [SCB-1727]support encode/decode Object(Any) types --- .../protobuf/definition/OperationProtobuf.java | 10 +-- .../definition/RequestRootDeserializer.java| 7 +- .../definition/ResponseRootDeserializer.java | 24 --- .../internal/converter/TestSchemaMetaCodec.java| 81 -- .../converter/TestSchemaMetaCodecRestTemplate.java | 8 ++- .../servicecomb/demo/pojo/client/TestWeakPojo.java | 36 -- .../servicecomb/demo/pojo/server/WeakPojo.java | 4 ++ .../demo/springmvc/client/TestObject.java | 19 ++--- .../foundation/protobuf/internal/ProtoUtils.java | 4 ++ .../internal/schema/any/AnyEntrySchema.java| 47 +++-- .../protobuf/internal/schema/any/AnySchema.java| 4 +- .../deserializer/DeserializerSchemaManager.java| 7 +- .../repeated/impl/AnyRepeatedReadSchemas.java | 2 +- .../schema/serializer/SerializerSchemaManager.java | 5 ++ .../protobuf/internal/schema/TestAnySchema.java| 3 +- .../foundation/test/scaffolding/model/People.java | 24 ++- .../transport/highway/HighwayCodec.java| 2 +- 17 files changed, 218 insertions(+), 69 deletions(-) diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java index eb6e22c..e475712 100644 --- a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java +++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/OperationProtobuf.java @@ -29,6 +29,8 @@ import org.apache.servicecomb.core.definition.OperationMeta; import org.apache.servicecomb.foundation.protobuf.ProtoMapper; import org.apache.servicecomb.foundation.protobuf.internal.ProtoUtils; +import com.fasterxml.jackson.databind.JavaType; + import io.protostuff.compiler.model.Message; @SuppressWarnings("rawtypes") @@ -123,7 +125,7 @@ public class OperationProtobuf { ProtoMapper mapper = scopedProtobufSchemaManager.getOrCreateProtoMapper(operationMeta.getSchemaMeta()); Message responseMessage = mapper.getResponseMessage(operationMeta.getOperationId()); -Type responseType = operationMeta.getResponsesMeta().findResponseType(Status.OK.getStatusCode()); +JavaType responseType = operationMeta.getResponsesMeta().findResponseType(Status.OK.getStatusCode()); if (operationMeta.getSwaggerProducerOperation() != null) { if (ProtoUtils.isWrapProperty(responseMessage)) { responseRootSerializer = new ResponseRootSerializer( @@ -142,18 +144,18 @@ public class OperationProtobuf { responseRootSerializer = new ResponseRootSerializer( mapper.createRootSerializer(responseMessage, responseType), true, false); responseRootDeserializer = new ResponseRootDeserializer<>( -mapper.createRootDeserializer(responseMessage, responseType), true, false); +mapper.createRootDeserializer(responseMessage, responseType), false); } else { if (ProtoUtils.isEmptyMessage(responseMessage)) { responseRootSerializer = new ResponseRootSerializer(mapper.createRootSerializer(responseMessage, Object.class), false, false); responseRootDeserializer = new ResponseRootDeserializer<>( - mapper.createRootDeserializer(responseMessage, Object.class), false, true); + mapper.createRootDeserializer(responseMessage, Object.class), true); } else { responseRootSerializer = new ResponseRootSerializer(mapper.createRootSerializer(responseMessage, responseType), false, false); responseRootDeserializer = new ResponseRootDeserializer<>( - mapper.createRootDeserializer(responseMessage, responseType), false, false); + mapper.createRootDeserializer(responseMessage, responseType), false); } } } diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/RequestRootDeserializer.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/RequestRootDeserializer.java index 049c7c0..c8b70f4 100644 --- a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/RequestRootDeserializer.java +++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/definition/RequestRootDeserializer.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.Map; import
[servicecomb-java-chassis] branch master updated (932291a -> e3d0be4)
This is an automated email from the ASF dual-hosted git repository. liubao pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git. from 932291a [SCB-1722]add generics test case and fix know problems new 3dd9fc0 [SCB-1727]support encode/decode Object(Any) types new e3d0be4 [SCB-1728]support response headers in Response type The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../protobuf/definition/OperationProtobuf.java | 10 +-- .../definition/RequestRootDeserializer.java| 11 ++- .../definition/ResponseRootDeserializer.java | 24 --- .../internal/converter/TestSchemaMetaCodec.java| 81 -- .../converter/TestSchemaMetaCodecRestTemplate.java | 8 ++- .../servicecomb/demo/pojo/client/TestWeakPojo.java | 36 -- .../servicecomb/demo/pojo/server/WeakPojo.java | 4 ++ .../client/CodeFirstRestTemplateSpringmvc.java | 2 +- .../demo/springmvc/client/TestObject.java | 24 +++ .../demo/springmvc/client/TestResponse.java| 7 +- .../demo/springmvc/client/TestRestTemplate.java| 3 +- .../foundation/protobuf/internal/ProtoUtils.java | 4 ++ .../internal/schema/any/AnyEntrySchema.java| 48 +++-- .../protobuf/internal/schema/any/AnySchema.java| 4 +- .../deserializer/DeserializerSchemaManager.java| 8 ++- .../repeated/impl/AnyRepeatedReadSchemas.java | 2 +- .../schema/serializer/SerializerSchemaManager.java | 5 ++ .../protobuf/internal/schema/TestAnySchema.java| 3 +- .../scaffolding/model/{User.java => People.java} | 4 +- .../transport/highway/HighwayCodec.java| 6 +- .../transport/highway/message/ResponseHeader.java | 1 - .../src/main/resources/LoginRequest.proto | 6 +- .../src/main/resources/LoginResponse.proto | 6 +- .../src/main/resources/RequestHeader.proto | 12 ++-- .../src/main/resources/ResponseHeader.proto| 18 +++-- 25 files changed, 251 insertions(+), 86 deletions(-) copy foundations/foundation-test-scaffolding/src/main/java/org/apache/servicecomb/foundation/test/scaffolding/model/{User.java => People.java} (94%)
[GitHub] [servicecomb-java-chassis] whuxiari opened a new issue #1542: 为什么服务端读出的cookie会丢失内容?
whuxiari opened a new issue #1542: 为什么服务端读出的cookie会丢失内容? URL: https://github.com/apache/servicecomb-java-chassis/issues/1542 背景: 1、由于题主的微服务前端是嵌入在某个框架上的,需要用到框架的cookie来做相关的认证。因此,cookie是由别的框架写入的,题主的的微服务二级域名和框架的二级域名相同,因此不会产生跨域问题。 2、在题主微服务后端的Nginx查看,cookie中的authInfo字段内容是有到Nginx的,但在服务端解析时,却丢失了这部分内容。 3、题主试过对authInfo字段进行URL编码,通过工具发送请求到服务端,服务端是可以获取到authInfo这部分内容的。 nginx截图: ![image](https://user-images.githubusercontent.com/9291379/72509956-887d3680-3883-11ea-8da6-e3662c438f89.png) This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1541: 重写返回值序列化,工程启动报LinkageError
liubao68 commented on issue #1541: 重写返回值序列化,工程启动报LinkageError URL: https://github.com/apache/servicecomb-java-chassis/issues/1541#issuecomment-575049406 可能自定义的类使用BizClassLoader加载的,这个类依赖的JavaType在另外的class loader加载的,就出现了上面的错误。 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [servicecomb-java-chassis] WellaceZ opened a new issue #1541: 重写返回值序列化,工程启动报LinkageError
WellaceZ opened a new issue #1541: 重写返回值序列化,工程启动报LinkageError URL: https://github.com/apache/servicecomb-java-chassis/issues/1541 业务需要REST返回值支持compactFormat和PrettyPrint两种输出格式,因此重写了ProduceJsonProcessor。但是工程启动却报LinkageError错误。如何解决? (1)自定义的ProduceProcessor实现类如下: public class MyProduceProcessor implements ProduceProcessor { @Override public String getName() { return String.valueOf(MediaType.APPLICATION_JSON); } @Override public int getOrder() { return -1; } @Override public void doEncodeResponse(OutputStream outputStream, Object o) throws Exception { RestObjectMapperFactory.getRestObjectMapper().writerWithDefaultPrettyPrinter().writeValue(outputStream, o); } @Override public Object doDecodeResponse(InputStream inputStream, JavaType javaType) throws Exception { return RestObjectMapperFactory.getRestObjectMapper().readValue(inputStream, javaType); } } (2)自定义的ProduceProcessor实现类如下: This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services