diff --git a/.gitignore b/.gitignore
index 40b20c3..249346c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
+.classpath
.project
.settings
target
diff --git a/brave-exporter/pom.xml b/brave-exporter/pom.xml
new file mode 100644
index 0000000..e1b38b5
--- /dev/null
+++ b/brave-exporter/pom.xml
@@ -0,0 +1,83 @@
+
+
+
+ 4.0.0
+
+ io.zipkin.brave.karaf
+ brave-karaf-parent
+ 1.0.0-SNAPSHOT
+
+
+ brave-exporter
+
+
+ ${project.basedir}/..
+
+
+
+
+ org.osgi
+ osgi.core
+ 6.0.0
+
+
+ org.osgi
+ osgi.cmpn
+ 6.0.0
+
+
+ io.zipkin.brave
+ brave-core
+
+
+ io.zipkin.reporter
+ zipkin-reporter
+
+
+ io.zipkin.reporter
+ zipkin-sender-urlconnection
+
+
+
+
+
+
+ biz.aQute.bnd
+ bnd-maven-plugin
+ 3.3.0
+
+
+
+ bnd-process
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.0.2
+
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+
+
+
+
+
\ No newline at end of file
diff --git a/brave-exporter/src/main/java/io/zipkin/brave/osgi/exporter/BraveExporter.java b/brave-exporter/src/main/java/io/zipkin/brave/osgi/exporter/BraveExporter.java
new file mode 100644
index 0000000..04b9536
--- /dev/null
+++ b/brave-exporter/src/main/java/io/zipkin/brave/osgi/exporter/BraveExporter.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright 2016 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 io.zipkin.brave.osgi.exporter;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import com.github.kristofa.brave.Brave;
+import com.github.kristofa.brave.Sampler;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+import zipkin.Span;
+import zipkin.reporter.Reporter;
+
+@Component //
+( //
+ immediate = true, //
+ name = "io.zipkin.brave" //
+)
+@Designate(ocd = BraveExporter.Config.class)
+public class BraveExporter {
+ @Reference
+ Reporter reporter;
+
+ private ServiceRegistration reg;
+
+ @ObjectClassDefinition(name = "Brave")
+ @interface Config {
+ String name() default "default";
+ boolean traceId128Bit() default false;
+ float rate() default 1;
+ }
+
+ @Activate
+ public void activate(Config config, BundleContext context, Map properties) {
+ Brave brave = new Brave.Builder(config.name())
+ .reporter(reporter) //
+ .traceId128Bit(config.traceId128Bit()) //
+ .traceSampler(Sampler.create(config.rate()))
+ .build();
+ reg = context.registerService(Brave.class, brave, new Hashtable(properties));
+ }
+
+ @Deactivate
+ public void deactive() {
+ reg.unregister();
+ }
+
+}
diff --git a/brave-exporter/src/main/java/io/zipkin/brave/osgi/exporter/urlconnect/SenderUrlConnectExporter.java b/brave-exporter/src/main/java/io/zipkin/brave/osgi/exporter/urlconnect/SenderUrlConnectExporter.java
new file mode 100644
index 0000000..94f85b9
--- /dev/null
+++ b/brave-exporter/src/main/java/io/zipkin/brave/osgi/exporter/urlconnect/SenderUrlConnectExporter.java
@@ -0,0 +1,71 @@
+/**
+ * Copyright 2016 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 io.zipkin.brave.osgi.exporter.urlconnect;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.ConfigurationPolicy;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.metatype.annotations.Designate;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+import zipkin.Span;
+import zipkin.reporter.AsyncReporter;
+import zipkin.reporter.Reporter;
+import zipkin.reporter.urlconnection.URLConnectionSender;
+
+@Component //
+( //
+ immediate = true, //
+ name = "io.zipkin.reporter.urlconnect", //
+ configurationPolicy = ConfigurationPolicy.REQUIRE
+)
+@Designate(ocd = SenderUrlConnectExporter.Config.class)
+public class SenderUrlConnectExporter {
+
+ @SuppressWarnings("rawtypes")
+ private ServiceRegistration reg;
+ private AsyncReporter reporter;
+
+ @ObjectClassDefinition(name = "Zipkin Reporter URLConnect")
+ @interface Config {
+ String endpoint() default "http://localhost:9411/api/v1/spans";
+ boolean compressionEnabled() default true;
+ int connectTimeout() default 10 * 1000;
+ int messageMaxBytes() default 5 * 1024 * 1024;
+ }
+
+ @Activate
+ public void activate(Config config, BundleContext context, Map properties) {
+ URLConnectionSender sender = URLConnectionSender.builder()
+ .endpoint(config.endpoint()) //
+ .compressionEnabled(config.compressionEnabled()) //
+ .connectTimeout(config.connectTimeout())
+ .messageMaxBytes(config.messageMaxBytes())
+ .build();
+ reporter = AsyncReporter.builder(sender).build();
+ reg = context.registerService(Reporter.class, reporter, new Hashtable(properties));
+ }
+
+ @Deactivate
+ public void deactive() {
+ reg.unregister();
+ reporter.close();
+ }
+
+}
diff --git a/brave-features/src/main/resources/features.xml b/brave-features/src/main/resources/features.xml
index 2b70909..d2fe602 100644
--- a/brave-features/src/main/resources/features.xml
+++ b/brave-features/src/main/resources/features.xml
@@ -18,13 +18,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
- mvn:org.apache.cxf.karaf/apache-cxf/3.1.8/xml/features
-
+ scr
mvn:io.zipkin.java/zipkin/${zipkin.version}
mvn:io.zipkin.reporter/zipkin-reporter/${zipkin.reporter.version}
mvn:io.zipkin.reporter/zipkin-sender-urlconnection/${zipkin.reporter.version}
mvn:io.zipkin.brave/brave-core/${brave.version}
+ mvn:io.zipkin.brave.karaf/brave-exporter/${project.version}
@@ -35,6 +35,7 @@
brave-core
+ mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr339-api-2.0.1/2.6.0
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_2
mvn:io.zipkin.brave/brave-http/${brave.version}
mvn:io.zipkin.brave/brave-jaxrs2/${brave.version}
diff --git a/brave-itests/.classpath b/brave-itests/.classpath
deleted file mode 100644
index b2acffc..0000000
--- a/brave-itests/.classpath
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/brave-itests/pom.xml b/brave-itests/pom.xml
index 2836630..46a39e6 100644
--- a/brave-itests/pom.xml
+++ b/brave-itests/pom.xml
@@ -39,7 +39,6 @@
io.zipkin.brave
brave-core
- ${brave.version}
diff --git a/brave-itests/src/test/java/io/zipkin/brave/itests/BraveTest.java b/brave-itests/src/test/java/io/zipkin/brave/itests/BraveTest.java
index 898817b..abdd14f 100644
--- a/brave-itests/src/test/java/io/zipkin/brave/itests/BraveTest.java
+++ b/brave-itests/src/test/java/io/zipkin/brave/itests/BraveTest.java
@@ -43,7 +43,7 @@
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public class BraveTest {
- List