-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support collect OTLP traces in v3 server (#3580)
- Loading branch information
Showing
40 changed files
with
688 additions
and
458 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>zipkin-server-parent</artifactId> | ||
<groupId>io.zipkin</groupId> | ||
<version>2.24.4-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>receiver-otlp-trace</artifactId> | ||
<name>OTLP Trace Receiver</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.skywalking</groupId> | ||
<artifactId>otel-receiver-plugin</artifactId> | ||
<version>${skywalking.version}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.apache.skywalking</groupId> | ||
<artifactId>skywalking-sharing-server-plugin</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.apache.skywalking</groupId> | ||
<artifactId>meter-analyzer</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.apache.skywalking</groupId> | ||
<artifactId>log-analyzer</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
20 changes: 20 additions & 0 deletions
20
...server/receiver-otlp-trace/src/main/java/zipkin/server/receiver/otlp/OTLPTraceConfig.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,20 @@ | ||
/* | ||
* Copyright 2015-2023 The OpenZipkin Authors | ||
* | ||
* Licensed 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 zipkin.server.receiver.otlp; | ||
|
||
import org.apache.skywalking.oap.server.library.module.ModuleConfig; | ||
|
||
public class OTLPTraceConfig extends ModuleConfig { | ||
} |
81 changes: 81 additions & 0 deletions
81
...rver/receiver-otlp-trace/src/main/java/zipkin/server/receiver/otlp/OTLPTraceProvider.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,81 @@ | ||
/* | ||
* Copyright 2015-2023 The OpenZipkin Authors | ||
* | ||
* Licensed 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 zipkin.server.receiver.otlp; | ||
|
||
import org.apache.skywalking.oap.server.core.CoreModule; | ||
import org.apache.skywalking.oap.server.core.server.GRPCHandlerRegister; | ||
import org.apache.skywalking.oap.server.library.module.ModuleConfig; | ||
import org.apache.skywalking.oap.server.library.module.ModuleDefine; | ||
import org.apache.skywalking.oap.server.library.module.ModuleProvider; | ||
import org.apache.skywalking.oap.server.library.module.ModuleStartException; | ||
import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException; | ||
import org.apache.skywalking.oap.server.receiver.otel.OtelMetricReceiverConfig; | ||
import org.apache.skywalking.oap.server.receiver.otel.OtelMetricReceiverModule; | ||
import org.apache.skywalking.oap.server.receiver.otel.otlp.OpenTelemetryMetricRequestProcessor; | ||
import org.apache.skywalking.oap.server.receiver.otel.otlp.OpenTelemetryTraceHandler; | ||
import zipkin.server.receiver.otlp.handler.OTLPTraceHandler; | ||
|
||
public class OTLPTraceProvider extends ModuleProvider { | ||
private OTLPTraceConfig moduleConfig; | ||
private OpenTelemetryTraceHandler traceHandler; | ||
|
||
@Override | ||
public String name() { | ||
return "zipkin"; | ||
} | ||
|
||
@Override | ||
public Class<? extends ModuleDefine> module() { | ||
return OtelMetricReceiverModule.class; | ||
} | ||
|
||
@Override | ||
public ConfigCreator<? extends ModuleConfig> newConfigCreator() { | ||
return new ConfigCreator<OTLPTraceConfig>() { | ||
|
||
@Override | ||
public Class<OTLPTraceConfig> type() { | ||
return OTLPTraceConfig.class; | ||
} | ||
|
||
@Override | ||
public void onInitialized(OTLPTraceConfig initialized) { | ||
moduleConfig = initialized; | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
public void prepare() throws ServiceNotProvidedException, ModuleStartException { | ||
this.registerServiceImplementation(OpenTelemetryMetricRequestProcessor.class, | ||
new OpenTelemetryMetricRequestProcessor(getManager(), new OtelMetricReceiverConfig())); | ||
} | ||
|
||
@Override | ||
public void start() throws ServiceNotProvidedException, ModuleStartException { | ||
GRPCHandlerRegister handlerRegister = getManager().find(CoreModule.NAME).provider().getService(GRPCHandlerRegister.class); | ||
traceHandler = new OTLPTraceHandler(handlerRegister, getManager()); | ||
traceHandler.active(); | ||
} | ||
|
||
@Override | ||
public void notifyAfterCompleted() throws ServiceNotProvidedException, ModuleStartException { | ||
} | ||
|
||
@Override | ||
public String[] requiredModules() { | ||
return new String[0]; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...ceiver-otlp-trace/src/main/java/zipkin/server/receiver/otlp/handler/OTLPTraceHandler.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,33 @@ | ||
/* | ||
* Copyright 2015-2023 The OpenZipkin Authors | ||
* | ||
* Licensed 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 zipkin.server.receiver.otlp.handler; | ||
|
||
import org.apache.skywalking.oap.server.core.server.GRPCHandlerRegister; | ||
import org.apache.skywalking.oap.server.library.module.ModuleManager; | ||
import org.apache.skywalking.oap.server.library.module.ModuleStartException; | ||
import org.apache.skywalking.oap.server.receiver.otel.otlp.OpenTelemetryTraceHandler; | ||
|
||
public class OTLPTraceHandler extends OpenTelemetryTraceHandler { | ||
private final GRPCHandlerRegister register; | ||
public OTLPTraceHandler(GRPCHandlerRegister register, ModuleManager manager) { | ||
super(manager); | ||
this.register = register; | ||
} | ||
|
||
@Override | ||
public void active() throws ModuleStartException { | ||
register.addHandler(this); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...esources/META-INF/services/org.apache.skywalking.oap.server.library.module.ModuleProvider
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,19 @@ | ||
# | ||
# 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. | ||
# | ||
# | ||
|
||
zipkin.server.receiver.otlp.OTLPTraceProvider |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>zipkin-server-parent</artifactId> | ||
<groupId>io.zipkin</groupId> | ||
<version>2.24.4-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>receiver-zipkin-core</artifactId> | ||
<name>Zipkin Receiver Core</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.zipkin</groupId> | ||
<artifactId>zipkin-server-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.skywalking</groupId> | ||
<artifactId>zipkin-receiver-plugin</artifactId> | ||
<version>${skywalking.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
36 changes: 36 additions & 0 deletions
36
...eceiver-zipkin-core/src/main/java/zipkin/server/receiver/zipkin/core/SpanForwardCore.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,36 @@ | ||
/* | ||
* Copyright 2015-2023 The OpenZipkin Authors | ||
* | ||
* Licensed 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 zipkin.server.receiver.zipkin.core; | ||
|
||
import org.apache.skywalking.oap.server.core.Const; | ||
import org.apache.skywalking.oap.server.library.module.ModuleManager; | ||
import org.apache.skywalking.oap.server.receiver.zipkin.ZipkinReceiverConfig; | ||
import org.apache.skywalking.oap.server.receiver.zipkin.trace.SpanForward; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class SpanForwardCore extends SpanForward { | ||
private final ZipkinReceiverConfig config; | ||
public SpanForwardCore(ZipkinReceiverConfig config, ModuleManager manager) { | ||
super(config, manager); | ||
this.config = config; | ||
} | ||
|
||
public Set<String> getTagAutocompleteKeys() { | ||
return new HashSet<>(Arrays.asList(config.getSearchableTracesTags().split(Const.COMMA))); | ||
} | ||
} |
Oops, something went wrong.