You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2022/04/11 13:09:56 UTC

[tomee] 03/04: Make sure we always have a default tracer

This is an automated email from the ASF dual-hosted git repository.

jlmonteiro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 3c6c6591c63597fbdb9a53b13c169e349bf6724a
Author: Jean-Louis Monteiro <jl...@tomitribe.com>
AuthorDate: Mon Apr 11 15:09:24 2022 +0200

    Make sure we always have a default tracer
---
 .../microprofile/opentracing/TracerProducer.java   | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentracing/TracerProducer.java b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentracing/TracerProducer.java
new file mode 100644
index 0000000000..2e9dd317ec
--- /dev/null
+++ b/tomee/tomee-microprofile/mp-common/src/main/java/org/apache/tomee/microprofile/opentracing/TracerProducer.java
@@ -0,0 +1,32 @@
+/*
+ * 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.tomee.microprofile.opentracing;
+
+import io.opentracing.Tracer;
+import io.opentracing.util.GlobalTracer;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.context.Dependent;
+import jakarta.enterprise.inject.Produces;
+
+@Dependent
+public class TracerProducer {
+    @Produces
+    @ApplicationScoped
+    Tracer tracer() {
+        return GlobalTracer.get();
+    }
+}
\ No newline at end of file