You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/12/29 13:01:47 UTC
[GitHub] [skywalking] wu-sheng opened a new pull request, #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql` …
wu-sheng opened a new pull request, #10218:
URL: https://github.com/apache/skywalking/pull/10218
…of MAL
<!--
⚠️ Please make sure to read this template first, pull requests that don't accord with this template
maybe closed without notice.
Texts surrounded by `<` and `>` are meant to be replaced by you, e.g. <framework name>, <issue number>.
Put an `x` in the `[ ]` to mark the item as CHECKED. `[x]`
-->
<!-- ==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👇 ====
### Fix <bug description or the bug issue number or bug issue link>
- [ ] Add a unit test to verify that the fix works.
- [ ] Explain briefly why the bug exists and how to fix it.
==== 🐛 Remove this line WHEN AND ONLY WHEN you're fixing a bug, follow the checklist 👆 ==== -->
<!-- ==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👇 ====
### Improve the performance of <class or module or ...>
- [ ] Add a benchmark for the improvement, refer to [the existing ones](https://github.com/apache/skywalking/blob/master/apm-commons/apm-datacarrier/src/test/java/org/apache/skywalking/apm/commons/datacarrier/LinkedArrayBenchmark.java)
- [ ] The benchmark result.
```text
<Paste the benchmark results here>
```
- [ ] Links/URLs to the theory proof or discussion articles/blogs. <links/URLs here>
==== 📈 Remove this line WHEN AND ONLY WHEN you're improving the performance, follow the checklist 👆 ==== -->
<!-- ==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👇 ====
### <Feature description>
- [ ] If this is non-trivial feature, paste the links/URLs to the design doc.
- [ ] Update the documentation to include this new feature.
- [ ] Tests(including UT, IT, E2E) are added to verify the new feature.
- [ ] If it's UI related, attach the screenshots below.
==== 🆕 Remove this line WHEN AND ONLY WHEN you're adding a new feature, follow the checklist 👆 ==== -->
- [ ] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #<issue number>.
- [ ] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/docs/en/changes/changes.md).
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058949639
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -267,14 +267,8 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
DatabaseSlowStatementBuilder builder = new DatabaseSlowStatementBuilder(namingControl);
builder.setLayer(Layer.nameOf(log.getLayer()));
- long timeBucket = TimeBucket.getTimeBucket(log.getTimestamp(), DownSampling.Minute);
builder.setServiceName(log.getService());
- ServiceMeta serviceMeta = new ServiceMeta();
- String serviceName = namingControl.formatServiceName(log.getService());
- serviceMeta.setName(serviceName);
- serviceMeta.setLayer(builder.getLayer());
- serviceMeta.setTimeBucket(builder.getTimeBucket());
Review Comment:
<img width="935" alt="image" src="https://user-images.githubusercontent.com/5441976/209957799-b3438531-9f44-4e43-a025-f714d717e5da.png">
Check the code history, you build a timestamp from it, but you never use it. Ths easy fix could be one line

I changed others because you did duplicate `naming control` and are unnecessary to set `entity id`.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql` …
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058942479
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -267,14 +267,8 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
DatabaseSlowStatementBuilder builder = new DatabaseSlowStatementBuilder(namingControl);
builder.setLayer(Layer.nameOf(log.getLayer()));
- long timeBucket = TimeBucket.getTimeBucket(log.getTimestamp(), DownSampling.Minute);
builder.setServiceName(log.getService());
- ServiceMeta serviceMeta = new ServiceMeta();
- String serviceName = namingControl.formatServiceName(log.getService());
- serviceMeta.setName(serviceName);
- serviceMeta.setLayer(builder.getLayer());
- serviceMeta.setTimeBucket(builder.getTimeBucket());
Review Comment:
At here, `builder.getTimeBucket()` is always not initialized. Or the time bucket of ServiceTraffic is always wrong. OAP just fixed this due to this service's traffic also generated through MAL, which provides the correct timestamp.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] yswdqz commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
yswdqz commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058956551
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -267,14 +267,8 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
DatabaseSlowStatementBuilder builder = new DatabaseSlowStatementBuilder(namingControl);
builder.setLayer(Layer.nameOf(log.getLayer()));
- long timeBucket = TimeBucket.getTimeBucket(log.getTimestamp(), DownSampling.Minute);
builder.setServiceName(log.getService());
- ServiceMeta serviceMeta = new ServiceMeta();
- String serviceName = namingControl.formatServiceName(log.getService());
- serviceMeta.setName(serviceName);
- serviceMeta.setLayer(builder.getLayer());
- serviceMeta.setTimeBucket(builder.getTimeBucket());
Review Comment:
I found the problem and it was my mistake. Sorry about that.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058963256
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -267,14 +267,8 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
DatabaseSlowStatementBuilder builder = new DatabaseSlowStatementBuilder(namingControl);
builder.setLayer(Layer.nameOf(log.getLayer()));
- long timeBucket = TimeBucket.getTimeBucket(log.getTimestamp(), DownSampling.Minute);
builder.setServiceName(log.getService());
- ServiceMeta serviceMeta = new ServiceMeta();
- String serviceName = namingControl.formatServiceName(log.getService());
- serviceMeta.setName(serviceName);
- serviceMeta.setLayer(builder.getLayer());
- serviceMeta.setTimeBucket(builder.getTimeBucket());
Review Comment:
> I found the problem and it was my mistake. Sorry about that.
You don't need to be `sorry`. **Bugs** is a part of engineers' daily life. If SkyWalking needs one to say `sorry`, that would be me. I did the most damage to the project.
So, don't worry. I just want to double-check I found the right bug, and fix it in a right way.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] yswdqz commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
yswdqz commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058948073
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -267,14 +267,8 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
DatabaseSlowStatementBuilder builder = new DatabaseSlowStatementBuilder(namingControl);
builder.setLayer(Layer.nameOf(log.getLayer()));
- long timeBucket = TimeBucket.getTimeBucket(log.getTimestamp(), DownSampling.Minute);
builder.setServiceName(log.getService());
- ServiceMeta serviceMeta = new ServiceMeta();
- String serviceName = namingControl.formatServiceName(log.getService());
- serviceMeta.setName(serviceName);
- serviceMeta.setLayer(builder.getLayer());
- serviceMeta.setTimeBucket(builder.getTimeBucket());
Review Comment:
I think `builder.getTimeBucket()` should be initialized by MAL such as

--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql` …
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058941020
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -291,12 +285,14 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
builder.setTimeBucket(timeBucketForDB);
builder.setTimestamp(log.getTimestamp());
- String entityId = serviceMeta.getEntityId();
builder.prepare();
- DatabaseSlowStatement databaseSlowStatement = builder.toDatabaseSlowStatement();
- databaseSlowStatement.setDatabaseServiceId(entityId);
Review Comment:
@yswdqz I think `entityId` had been set in `builder.toDatabaseSlowStatement()`. Please confirm why this was required.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058942479
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -267,14 +267,8 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
DatabaseSlowStatementBuilder builder = new DatabaseSlowStatementBuilder(namingControl);
builder.setLayer(Layer.nameOf(log.getLayer()));
- long timeBucket = TimeBucket.getTimeBucket(log.getTimestamp(), DownSampling.Minute);
builder.setServiceName(log.getService());
- ServiceMeta serviceMeta = new ServiceMeta();
- String serviceName = namingControl.formatServiceName(log.getService());
- serviceMeta.setName(serviceName);
- serviceMeta.setLayer(builder.getLayer());
- serviceMeta.setTimeBucket(builder.getTimeBucket());
Review Comment:
At here, `builder.getTimeBucket()` is always not initialized. Then the time bucket of ServiceTraffic is always wrong. OAP just fixed this due to this service's traffic also being generated through MAL, which provides the correct timestamp.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058948857
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -267,14 +267,8 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
DatabaseSlowStatementBuilder builder = new DatabaseSlowStatementBuilder(namingControl);
builder.setLayer(Layer.nameOf(log.getLayer()));
- long timeBucket = TimeBucket.getTimeBucket(log.getTimestamp(), DownSampling.Minute);
builder.setServiceName(log.getService());
- ServiceMeta serviceMeta = new ServiceMeta();
- String serviceName = namingControl.formatServiceName(log.getService());
- serviceMeta.setName(serviceName);
- serviceMeta.setLayer(builder.getLayer());
- serviceMeta.setTimeBucket(builder.getTimeBucket());
Review Comment:
That is `log.getTimestamp()`. Not this timestamp.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] yswdqz commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
yswdqz commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058960408
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -291,12 +285,14 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
builder.setTimeBucket(timeBucketForDB);
builder.setTimestamp(log.getTimestamp());
- String entityId = serviceMeta.getEntityId();
builder.prepare();
- DatabaseSlowStatement databaseSlowStatement = builder.toDatabaseSlowStatement();
- databaseSlowStatement.setDatabaseServiceId(entityId);
Review Comment:
It's right. I was worried that the IDs generated twice would be different before. But it probably doesn't need to be worried about.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058963256
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -267,14 +267,8 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
DatabaseSlowStatementBuilder builder = new DatabaseSlowStatementBuilder(namingControl);
builder.setLayer(Layer.nameOf(log.getLayer()));
- long timeBucket = TimeBucket.getTimeBucket(log.getTimestamp(), DownSampling.Minute);
builder.setServiceName(log.getService());
- ServiceMeta serviceMeta = new ServiceMeta();
- String serviceName = namingControl.formatServiceName(log.getService());
- serviceMeta.setName(serviceName);
- serviceMeta.setLayer(builder.getLayer());
- serviceMeta.setTimeBucket(builder.getTimeBucket());
Review Comment:
> I found the problem and it was my mistake. Sorry about that.
You don't need to be `sorry`. **Bugs** is a part of engineers' daily life. If SkyWalking needs one to say `sorry`, that would be me. I did the most damage to the project.
So, don't worry. I just want to double-check check I found the right bug, and fix it in a right way.
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] yswdqz commented on a diff in pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
yswdqz commented on code in PR #10218:
URL: https://github.com/apache/skywalking/pull/10218#discussion_r1058965827
##########
oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/extractor/ExtractorSpec.java:
##########
@@ -267,14 +267,8 @@ public void slowSql(@DelegatesTo(SlowSqlSpec.class) final Closure<?> cl) {
DatabaseSlowStatementBuilder builder = new DatabaseSlowStatementBuilder(namingControl);
builder.setLayer(Layer.nameOf(log.getLayer()));
- long timeBucket = TimeBucket.getTimeBucket(log.getTimestamp(), DownSampling.Minute);
builder.setServiceName(log.getService());
- ServiceMeta serviceMeta = new ServiceMeta();
- String serviceName = namingControl.formatServiceName(log.getService());
- serviceMeta.setName(serviceName);
- serviceMeta.setLayer(builder.getLayer());
- serviceMeta.setTimeBucket(builder.getTimeBucket());
Review Comment:
I get it. Thank you!
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [skywalking] wu-sheng merged pull request #10218: Fix `time_bucket` of `ServiceTraffic` not set correctly in `slowSql`
Posted by GitBox <gi...@apache.org>.
wu-sheng merged PR #10218:
URL: https://github.com/apache/skywalking/pull/10218
--
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org