Fixed some bugs with browser-recevier (#5543)

This commit is contained in:
zhang-wei 2020-09-23 18:48:06 +08:00 committed by GitHub
parent f3967840c5
commit 7135414c3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 33 additions and 14 deletions

View File

@ -52,6 +52,7 @@
<include>service-apdex-threshold.yml</include>
<include>endpoint-name-grouping.yml</include>
<include>ui-initialized-templates.yml</include>
<include>oal/browser.oal</include>
<include>oal/core.oal</include>
<include>oal/java-agent.oal</include>
<include>oal/dotnet-agent.oal</include>

View File

@ -52,6 +52,7 @@
<include>service-apdex-threshold.yml</include>
<include>ui-initialized-templates.yml</include>
<include>endpoint-name-grouping.yml</include>
<include>oal/browser.oal</include>
<include>oal/core.oal</include>
<include>oal/java-agent.oal</include>
<include>oal/dotnet-agent.oal</include>

View File

@ -37,9 +37,7 @@ Input:
OutPut:
```json
```
Http Status: 204
## Error Log Report
@ -80,6 +78,10 @@ Input:
]
```
OutPut:
Http Status: 204
### POST http://localhost:12800/browser/errorLog
Send a single error log object with JSON format.
@ -103,6 +105,4 @@ Input:
OutPut:
```json
```
Http Status: 204

View File

@ -65,6 +65,7 @@ receiver-profile:
receiver-browser:
selector: ${SW_RECEIVER_BROWSER:default}
default:
sampleRate: ${SW_RECEIVER_BROWSER_SAMPLE_RATE:10000}
```
## gRPC/HTTP server for receiver

View File

@ -198,6 +198,8 @@ core|default|role|Option values, `Mixed/Receiver/Aggregator`. **Receiver** mode
| - | - | topicNameOfProfiling | Specifying Kafka topic name for Profiling data. | - | skywalking-profilings |
| - | - | topicNameOfTracingSegments | Specifying Kafka topic name for Tracing data. | - | skywalking-segments |
| - | - | topicNameOfManagements | Specifying Kafka topic name for service instance reporting and registering. | - | skywalking-managements |
| receiver-browser | default | Read [receiver doc](backend-receivers.md) for more details | - | - | - |
| - | - | sampleRate | Sampling rate for receiving trace. The precision is 1/10000. 10000 means 100% sample in default. | SW_RECEIVER_BROWSER_SAMPLE_RATE | 10000 |
| query | graphql | - | GraphQL query implementation | - |
| - | - | path | Root path of GraphQL query and mutation. | SW_QUERY_GRAPHQL_PATH | /graphql|
| alarm | default | - | Read [alarm doc](backend-alarm.md) for more details. | - |

View File

@ -258,6 +258,7 @@
<exclude>service-apdex-threshold.yml</exclude>
<exclude>endpoint-name-grouping.yml</exclude>
<exclude>ui-initialized-templates.yml</exclude>
<exclude>oal/browser.oal</exclude>
<exclude>oal/core.oal</exclude>
<exclude>oal/java-agent.oal</exclude>
<exclude>oal/dotnet-agent.oal</exclude>

View File

@ -284,6 +284,8 @@ receiver_jaeger:
receiver-browser:
selector: ${SW_RECEIVER_BROWSER:default}
default:
# The sample rate precision is 1/10000. 10000 means 100% sample in default.
sampleRate: ${SW_RECEIVER_BROWSER_SAMPLE_RATE:10000}
query:
selector: ${SW_QUERY:graphql}

View File

@ -62,6 +62,9 @@ public abstract class RateMetrics extends Metrics implements IntValueHolder {
@Override
public void calculate() {
if (denominator == 0) {
return;
}
percentage = (int) (numerator * 10000 / denominator);
}

View File

@ -21,11 +21,11 @@ import lombok.Getter;
import lombok.Setter;
import org.apache.skywalking.oap.server.library.module.ModuleConfig;
@Setter
@Getter
public class BrowserServiceModuleConfig extends ModuleConfig {
/**
* The sample rate precision is 1/10000. 10000 means 100% sample in default.
*/
@Setter
@Getter
private int sampleRate = 10000;
}

View File

@ -37,7 +37,7 @@ import org.apache.skywalking.oap.server.telemetry.api.MetricsCreator;
import org.apache.skywalking.oap.server.telemetry.api.MetricsTag;
/**
* Collect and process the performance and error log.
* Collect and process the performance data and error log.
*/
@Slf4j
public class BrowserPerfServiceHandler extends BrowserPerfServiceGrpc.BrowserPerfServiceImplBase implements GRPCHandler {

View File

@ -35,6 +35,9 @@ import org.apache.skywalking.oap.server.telemetry.api.HistogramMetrics;
import org.apache.skywalking.oap.server.telemetry.api.MetricsCreator;
import org.apache.skywalking.oap.server.telemetry.api.MetricsTag;
/**
* Collect and process the error log
*/
@Slf4j
public abstract class BrowserErrorLogReportBaseServletHandler extends JettyHandler {
private final ModuleManager moduleManager;
@ -84,6 +87,7 @@ public abstract class BrowserErrorLogReportBaseServletHandler extends JettyHandl
ErrorLogAnalyzer analyzer = new ErrorLogAnalyzer(moduleManager, errorLogListenerManager, config);
analyzer.doAnalysis(browserErrorLog);
}
resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
} catch (Throwable e) {
log.error(e.getMessage(), e);
logErrorCounter.inc();

View File

@ -36,6 +36,9 @@ import org.apache.skywalking.oap.server.telemetry.api.HistogramMetrics;
import org.apache.skywalking.oap.server.telemetry.api.MetricsCreator;
import org.apache.skywalking.oap.server.telemetry.api.MetricsTag;
/**
* Collect and process the performance data
*/
@Slf4j
public class BrowserPerfDataReportServletHandler extends JettyHandler {
private final ModuleManager moduleManager;
@ -55,7 +58,6 @@ public class BrowserPerfDataReportServletHandler extends JettyHandler {
MetricsCreator metricsCreator = moduleManager.find(TelemetryModule.NAME)
.provider()
.getService(MetricsCreator.class);
perfHistogram = metricsCreator.createHistogramMetric(
"browser_perf_data_in_latency", "The process latency of browser performance data",
new MetricsTag.Keys("protocol"), new MetricsTag.Values("http")
@ -84,6 +86,7 @@ public class BrowserPerfDataReportServletHandler extends JettyHandler {
BrowserPerfData browserPerfData = parseBrowserPerfData(req);
PerfDataAnalyzer analyzer = new PerfDataAnalyzer(moduleManager, perfDataListenerManager, config);
analyzer.doAnalysis(browserPerfData);
resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
} catch (Throwable e) {
log.error(e.getMessage(), e);
perfErrorCounter.inc();

View File

@ -78,16 +78,17 @@ public class ErrorLogRecordListener implements ErrorLogAnalysisListener {
// service
String serviceName = namingControl.formatServiceName(decorator.getService());
errorLog.setServiceId(IDManager.ServiceID.buildId(serviceName, NodeType.Browser));
String serviceId = IDManager.ServiceID.buildId(serviceName, NodeType.Browser);
errorLog.setServiceId(serviceId);
// service version
String serviceVersionName = namingControl.formatInstanceName(decorator.getServiceVersion());
errorLog.setServiceVersionId(IDManager.ServiceInstanceID.buildId(serviceName, serviceVersionName));
errorLog.setServiceVersionId(IDManager.ServiceInstanceID.buildId(serviceId, namingControl.formatInstanceName(
decorator.getServiceVersion())));
// page
String pagePath = namingControl.formatEndpointName(serviceName, decorator.getPagePath());
errorLog.setPagePath(pagePath);
errorLog.setPagePathId(IDManager.EndpointID.buildId(serviceName, pagePath));
errorLog.setPagePathId(IDManager.EndpointID.buildId(serviceId, pagePath));
// raw data
errorLog.setErrorCategory(BrowserErrorCategory.fromErrorCategory(decorator.getCategory()));