You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "vox-vox-vox (via GitHub)" <gi...@apache.org> on 2025/03/12 08:04:31 UTC
[PR] [rest] Add requestId and log into rest client [paimon]
vox-vox-vox opened a new pull request, #5267:
URL: https://github.com/apache/paimon/pull/5267
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
### Purpose
<!-- Linking this pull request to the issue -->
We need requestId and logs to improve troubleshooting efficiency and increase observability in rest catalog.
<!-- What is the purpose of the change -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #5267:
URL: https://github.com/apache/paimon/pull/5267#discussion_r1991005833
##########
paimon-core/src/main/java/org/apache/paimon/rest/LoggingInterceptor.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.apache.paimon.rest;
+
+import okhttp3.Interceptor;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static org.apache.paimon.rest.RequestIdInterceptor.REQUEST_ID_KEY;
+
+/** Defines HTTP request log interceptor. */
+public class LoggingInterceptor implements Interceptor {
+ private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
+
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request request = chain.request();
+ long startTime = System.nanoTime();
+ Response response = chain.proceed(request);
+ long durationMs = (System.nanoTime() - startTime) / 1_000_000;
+ LOG.info(
Review Comment:
Use debug?
if (LOG.isDebugEnabled) {
LOG.debug
}
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #5267:
URL: https://github.com/apache/paimon/pull/5267
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #5267:
URL: https://github.com/apache/paimon/pull/5267#discussion_r1992917981
##########
paimon-core/src/main/java/org/apache/paimon/rest/LoggingInterceptor.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+package org.apache.paimon.rest;
+
+import okhttp3.Interceptor;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+/** Defines HTTP request log interceptor. */
+public class LoggingInterceptor implements Interceptor {
+ private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
+ public static final String REQUEST_ID_KEY = "x-dlf-request-id";
+ public static final String DEFAULT_REQUEST_ID = "unknown";
+
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request request = chain.request();
+ long startTime = System.nanoTime();
+ Response response = chain.proceed(request);
+ long durationMs = (System.nanoTime() - startTime) / 1_000_000;
+ String requestId = response.header(REQUEST_ID_KEY, DEFAULT_REQUEST_ID);
+ LOG.info(
+ "method:{} url:{} requestId:{} duration:{}ms",
Review Comment:
`requestId` can be first?
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #5267:
URL: https://github.com/apache/paimon/pull/5267#issuecomment-2720222845
+1
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "jerry-024 (via GitHub)" <gi...@apache.org>.
jerry-024 commented on code in PR #5267:
URL: https://github.com/apache/paimon/pull/5267#discussion_r1992566357
##########
paimon-core/src/main/java/org/apache/paimon/rest/LoggingInterceptor.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.apache.paimon.rest;
+
+import okhttp3.Interceptor;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static org.apache.paimon.rest.RequestIdInterceptor.REQUEST_ID_KEY;
+
+/** Defines HTTP request log interceptor. */
+public class LoggingInterceptor implements Interceptor {
+ private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
+
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request request = chain.request();
Review Comment:
+1
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #5267:
URL: https://github.com/apache/paimon/pull/5267#discussion_r1991007259
##########
paimon-core/src/main/java/org/apache/paimon/rest/LoggingInterceptor.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.apache.paimon.rest;
+
+import okhttp3.Interceptor;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static org.apache.paimon.rest.RequestIdInterceptor.REQUEST_ID_KEY;
+
+/** Defines HTTP request log interceptor. */
+public class LoggingInterceptor implements Interceptor {
+ private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
+
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request request = chain.request();
Review Comment:
if (!LOG.isDebugEnabled()) {
return response?
}
##########
paimon-core/src/main/java/org/apache/paimon/rest/LoggingInterceptor.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.apache.paimon.rest;
+
+import okhttp3.Interceptor;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static org.apache.paimon.rest.RequestIdInterceptor.REQUEST_ID_KEY;
+
+/** Defines HTTP request log interceptor. */
+public class LoggingInterceptor implements Interceptor {
+ private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
+
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request request = chain.request();
Review Comment:
```
if (!LOG.isDebugEnabled()) {
return response?
}
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #5267:
URL: https://github.com/apache/paimon/pull/5267#discussion_r1991005833
##########
paimon-core/src/main/java/org/apache/paimon/rest/LoggingInterceptor.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.apache.paimon.rest;
+
+import okhttp3.Interceptor;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static org.apache.paimon.rest.RequestIdInterceptor.REQUEST_ID_KEY;
+
+/** Defines HTTP request log interceptor. */
+public class LoggingInterceptor implements Interceptor {
+ private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
+
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request request = chain.request();
+ long startTime = System.nanoTime();
+ Response response = chain.proceed(request);
+ long durationMs = (System.nanoTime() - startTime) / 1_000_000;
+ LOG.info(
Review Comment:
Use debug?
if (LOG.isDebugEnabled) {
LOG.debug
}
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "vox-vox-vox (via GitHub)" <gi...@apache.org>.
vox-vox-vox commented on code in PR #5267:
URL: https://github.com/apache/paimon/pull/5267#discussion_r1992572817
##########
paimon-core/src/main/java/org/apache/paimon/rest/LoggingInterceptor.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.apache.paimon.rest;
+
+import okhttp3.Interceptor;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static org.apache.paimon.rest.RequestIdInterceptor.REQUEST_ID_KEY;
+
+/** Defines HTTP request log interceptor. */
+public class LoggingInterceptor implements Interceptor {
+ private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
+
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request request = chain.request();
Review Comment:
log level change to INFO
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "jerry-024 (via GitHub)" <gi...@apache.org>.
jerry-024 commented on PR #5267:
URL: https://github.com/apache/paimon/pull/5267#issuecomment-2717049824
+1
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [rest] Add requestId and log into rest client [paimon]
Posted by "vox-vox-vox (via GitHub)" <gi...@apache.org>.
vox-vox-vox commented on code in PR #5267:
URL: https://github.com/apache/paimon/pull/5267#discussion_r1992572817
##########
paimon-core/src/main/java/org/apache/paimon/rest/LoggingInterceptor.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.apache.paimon.rest;
+
+import okhttp3.Interceptor;
+import okhttp3.Request;
+import okhttp3.Response;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+import static org.apache.paimon.rest.RequestIdInterceptor.REQUEST_ID_KEY;
+
+/** Defines HTTP request log interceptor. */
+public class LoggingInterceptor implements Interceptor {
+ private static final Logger LOG = LoggerFactory.getLogger(LoggingInterceptor.class);
+
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request request = chain.request();
Review Comment:
log level change to DEBUG
--
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.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org