-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt new Browser data upload protocol
- Loading branch information
Showing
13 changed files
with
366 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...va/org/apache/skywalking/oap/server/core/browser/source/BrowserAppWebInteractionPerf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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.skywalking.oap.server.core.browser.source; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.apache.skywalking.oap.server.core.analysis.IDManager; | ||
import org.apache.skywalking.oap.server.core.source.ScopeDeclaration; | ||
import org.apache.skywalking.oap.server.core.source.ScopeDefaultColumn; | ||
import org.apache.skywalking.oap.server.core.source.Source; | ||
|
||
import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.BROWSER_APP_WEB_INTERACTION_PAGE_PERF; | ||
import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.ENDPOINT_CATALOG_NAME; | ||
|
||
@ScopeDeclaration(id = BROWSER_APP_WEB_INTERACTION_PAGE_PERF, name = "BrowserAppWebInteractionPerf", catalog = ENDPOINT_CATALOG_NAME) | ||
@ScopeDefaultColumn.VirtualColumnDefinition(fieldName = "entityId", columnName = "entity_id", isID = true, type = String.class) | ||
@Setter | ||
@Getter | ||
public class BrowserAppWebInteractionPerf extends Source { | ||
@Override | ||
public int scope() { | ||
return BROWSER_APP_WEB_INTERACTION_PAGE_PERF; | ||
} | ||
|
||
@Override | ||
public String getEntityId() { | ||
return IDManager.EndpointID.buildId(serviceId, path); | ||
} | ||
|
||
@ScopeDefaultColumn.DefinedByField(columnName = "service_id") | ||
@ScopeDefaultColumn.BanyanDB(groupByCondInTopN = true) | ||
private String serviceId; | ||
@ScopeDefaultColumn.DefinedByField(columnName = "service_name", requireDynamicActive = true) | ||
private String serviceName; | ||
private String path; | ||
private int inpTime; | ||
|
||
@Override | ||
public void prepare() { | ||
serviceId = IDManager.ServiceID.buildId(serviceName, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...rowser/provider/parser/performance/decorators/BrowserWebInteractionPerfDataDecorator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* 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.skywalking.oap.server.receiver.browser.provider.parser.performance.decorators; | ||
|
||
import org.apache.skywalking.apm.network.language.agent.v3.BrowserWebInteractionsPerfData; | ||
|
||
public class BrowserWebInteractionPerfDataDecorator implements BrowserPerfDecorator { | ||
private BrowserWebInteractionsPerfData.Builder builder; | ||
|
||
public BrowserWebInteractionPerfDataDecorator(BrowserWebInteractionsPerfData data) { | ||
this.builder = data.toBuilder(); | ||
} | ||
|
||
@Override | ||
public String getService() { | ||
return builder.getService(); | ||
} | ||
|
||
@Override | ||
public void setTime(long time) { | ||
builder.setTime(time); | ||
} | ||
|
||
@Override | ||
public String getServiceVersion() { | ||
return builder.getServiceVersion(); | ||
} | ||
|
||
@Override | ||
public void setServiceVersion(String serviceVersion) { | ||
builder.setServiceVersion(serviceVersion); | ||
} | ||
|
||
@Override | ||
public String getPagePath() { | ||
return builder.getPagePath(); | ||
} | ||
|
||
@Override | ||
public void setPagePath(String pagePath) { | ||
builder.setPagePath(pagePath); | ||
} | ||
|
||
public int getInpTime() { | ||
return builder.getInpTime(); | ||
} | ||
|
||
public long getTime() { | ||
return builder.getTime(); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
...r/provider/parser/performance/listener/BrowserWebInteractionPerfDataAnalysisListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* 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.skywalking.oap.server.receiver.browser.provider.parser.performance.listener; | ||
|
||
import org.apache.skywalking.oap.server.core.CoreModule; | ||
import org.apache.skywalking.oap.server.core.analysis.TimeBucket; | ||
import org.apache.skywalking.oap.server.core.browser.source.BrowserAppWebInteractionPerf; | ||
import org.apache.skywalking.oap.server.core.config.NamingControl; | ||
import org.apache.skywalking.oap.server.core.source.SourceReceiver; | ||
import org.apache.skywalking.oap.server.library.module.ModuleManager; | ||
import org.apache.skywalking.oap.server.receiver.browser.provider.BrowserServiceModuleConfig; | ||
import org.apache.skywalking.oap.server.receiver.browser.provider.parser.performance.decorators.BrowserWebInteractionPerfDataDecorator; | ||
|
||
public class BrowserWebInteractionPerfDataAnalysisListener implements PerfDataAnalysisListener<BrowserWebInteractionPerfDataDecorator> { | ||
private final SourceReceiver sourceReceiver; | ||
private final NamingControl namingControl; | ||
private BrowserAppWebInteractionPerf browserAppWebInteractionPerf; | ||
|
||
public BrowserWebInteractionPerfDataAnalysisListener(SourceReceiver sourceReceiver, NamingControl namingControl) { | ||
this.sourceReceiver = sourceReceiver; | ||
this.namingControl = namingControl; | ||
} | ||
|
||
@Override | ||
public void build() { | ||
sourceReceiver.receive(browserAppWebInteractionPerf); | ||
} | ||
|
||
@Override | ||
public void parse(BrowserWebInteractionPerfDataDecorator decorator) { | ||
browserAppWebInteractionPerf = new BrowserAppWebInteractionPerf(); | ||
browserAppWebInteractionPerf.setTimeBucket(TimeBucket.getMinuteTimeBucket(decorator.getTime())); | ||
browserAppWebInteractionPerf.setServiceName(namingControl.formatServiceName(decorator.getService())); | ||
browserAppWebInteractionPerf.setPath(namingControl.formatEndpointName(browserAppWebInteractionPerf.getServiceName(), decorator.getPagePath())); | ||
browserAppWebInteractionPerf.setInpTime(decorator.getInpTime()); | ||
} | ||
|
||
public static class Factory implements PerfDataListenerFactory<BrowserWebInteractionPerfDataDecorator> { | ||
|
||
private final SourceReceiver sourceReceiver; | ||
private final NamingControl namingControl; | ||
|
||
public Factory(ModuleManager moduleManager, BrowserServiceModuleConfig moduleConfig) { | ||
this.sourceReceiver = moduleManager.find(CoreModule.NAME) | ||
.provider() | ||
.getService(SourceReceiver.class); | ||
|
||
this.namingControl = moduleManager.find(CoreModule.NAME) | ||
.provider() | ||
.getService(NamingControl.class); | ||
} | ||
|
||
@Override | ||
public PerfDataAnalysisListener<BrowserWebInteractionPerfDataDecorator> create(ModuleManager moduleManager, BrowserServiceModuleConfig moduleConfig) { | ||
return new BrowserWebInteractionPerfDataAnalysisListener(sourceReceiver, namingControl); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.