-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect jaeger.service-name property (#57)
* Respect jaeger.service-name property JAEGER_SERVICE_NAME is an environment variable set by e.g. the jaeger-operator when it injects environment variables into containers. This change means that Spring apps can use the auto-container inject feature of the operator and be identified correctly by default. See https://www.jaegertracing.io/docs/1.13/client-features/ See #56
- Loading branch information
1 parent
ed37e7c
commit 4af8d85
Showing
3 changed files
with
44 additions
and
3 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
41 changes: 41 additions & 0 deletions
41
...a/spring/jaeger/starter/basic/JaegerTracerServiceNameSetWithoutOpentracingPrefixTest.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,41 @@ | ||
/** | ||
* Copyright 2018-2019 The OpenTracing 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.opentracing.contrib.java.spring.jaeger.starter.basic; | ||
|
||
import static org.assertj.core.api.Java6Assertions.assertThat; | ||
|
||
import io.opentracing.contrib.java.spring.jaeger.starter.AbstractTracerSpringTest; | ||
import org.junit.Test; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
@TestPropertySource( | ||
properties = { | ||
"spring.main.banner-mode=off", | ||
"opentracing.jaeger.enabled=true", | ||
"jaeger.service-name=foo", | ||
"spring.application.name=bar" | ||
} | ||
) | ||
public class JaegerTracerServiceNameSetWithoutOpentracingPrefixTest extends AbstractTracerSpringTest { | ||
|
||
@Test | ||
public void testNameIsAsExpected() { | ||
assertThat(tracer).isNotNull(); | ||
assertThat(tracer).isInstanceOf(io.jaegertracing.internal.JaegerTracer.class); | ||
|
||
// 'jaeger.service-name' should take priority over 'spring.application.name' | ||
assertThat((getTracer()).getServiceName()).isEqualTo("foo"); | ||
} | ||
} |