Intellij cleanup of markdown and yaml (#3284)

* Intellij cleanup of markdown and yaml

* Revert required yaml param
This commit is contained in:
Trask Stalnaker 2021-06-14 03:13:01 -07:00 committed by GitHub
parent 8be100637a
commit f1beb2397f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 82 additions and 81 deletions

View File

@ -5,7 +5,8 @@ on:
paths:
- 'smoke-tests/grpc/**'
- '.github/workflows/build-grpc-smoke-dist.yml'
branches: 'main'
branches:
- main
workflow_dispatch:
jobs:

View File

@ -5,7 +5,8 @@ on:
paths:
- 'smoke-tests/play/**'
- '.github/workflows/build-play-smoke-dist.yml'
branches: 'main'
branches:
- main
workflow_dispatch:
jobs:

View File

@ -5,7 +5,8 @@ on:
paths:
- 'smoke-tests/springboot/**'
- '.github/workflows/build-springboot-smoke-dist.yml'
branches: 'main'
branches:
- main
workflow_dispatch:
jobs:

View File

@ -9,6 +9,7 @@ on:
required: true
commits:
description: Comma separated list of commit shas to cherrypick
required: false
jobs:
prepare-release-branch:

View File

@ -102,7 +102,7 @@ behavior you find.*
## Supported libraries, frameworks, and application servers
We support an impressively huge number of [libraries and frameworks](docs/supported-libraries.md#libraries---frameworks) and
We support an impressively huge number of [libraries and frameworks](docs/supported-libraries.md#libraries--frameworks) and
a majority of the most popular [application servers](docs/supported-libraries.md#application-servers)...right out of the box!
[Click here to see the full list](docs/supported-libraries.md) and to learn more about
[disabled instrumentation](docs/supported-libraries.md#disabled-instrumentations)

View File

@ -11,8 +11,8 @@ or they might want to manually create spans for their own custom code.
* [Maven](#maven)
* [Gradle](#gradle)
- [Adding attributes to the current span](#adding-attributes-to-the-current-span)
- [Creating spans around methods with `@WithSpan`](#creating-spans-around-methods-with---withspan-)
* [Suppressing `@WithSpan` instrumentation](#suppressing---withspan--instrumentation)
- [Creating spans around methods with `@WithSpan`](#creating-spans-around-methods-with-withspan)
* [Suppressing `@WithSpan` instrumentation](#suppressing-withspan-instrumentation)
* [Creating spans around methods with `otel.instrumentation.methods.include`](#creating-spans-around-methods-with-otelinstrumentationmethodsinclude)
- [Creating spans manually with a Tracer](#creating-spans-manually-with-a-tracer)

View File

@ -9,7 +9,7 @@ or [contributing](../CONTRIBUTING.md).
## Contents
* [Libraries / Frameworks](#libraries---frameworks)
* [Libraries / Frameworks](#libraries--frameworks)
* [Application Servers](#application-servers)
* [JVMs and Operating Systems](#jvms-and-operating-systems)
* [Disabled instrumentations](#disabled-instrumentations)

View File

@ -62,7 +62,7 @@ Write a _new_ instrumentation which injects its own advice into the same method
Use `order` method to ensure it is run after the original instrumentation.
Now you can augment current span with new information.
See [DemoServlet3InstrumentationModule](instrumentation/servlet-3/src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java).
See [DemoServlet3InstrumentationModule](src/main/java/com/example/javaagent/instrumentation/DemoServlet3InstrumentationModule.java).
### I want to remove some attributes
Write custom exporter or use attribute filtering functionality in Collector.

View File

@ -8,7 +8,7 @@ The [first section](#manual-instrumentation-with-java-sdk) will walk you through
The [second section](#manual-instrumentation-using-handlers-and-filters) will build on the first. It will walk you through implementing spring-web handler and filter interfaces to create traces with minimal changes to existing application code. Using the OpenTelemetry API, this approach involves copy and pasting files and a significant amount of manual configurations.
The [third section](#auto-instrumentation-using-spring-starters) with build on the first two sections. We will use spring auto-configurations and instrumentation tools packaged in OpenTelemetry [Spring Starters](starters/) to streamline the set up of OpenTelemetry using Spring. With these tools you will be able to setup distributed tracing with little to no changes to existing configurations and easily customize traces with minor additions to application code.
The [third section](#auto-instrumentation-using-spring-starters) with build on the first two sections. We will use spring auto-configurations and instrumentation tools packaged in OpenTelemetry [Spring Starters](starters) to streamline the set up of OpenTelemetry using Spring. With these tools you will be able to setup distributed tracing with little to no changes to existing configurations and easily customize traces with minor additions to application code.
In this guide we will be using a running example. In section one and two, we will create two spring web services using Spring Boot. We will then trace requests between these services using two different approaches. Finally, in section three we will explore tools documented in [opentelemetry-spring-boot-autoconfigure](/spring-boot-autoconfigure/README.md#features) which can improve this process.
@ -107,7 +107,7 @@ import io.opentelemetry.exporters.logging.*;
public class OtelConfig {
private static final String tracerName = "fooTracer";
@Bean
public Tracer otelTracer() throws Exception {
public Tracer otelTracer() {
Tracer tracer = OpenTelemetry.getGlobalTracer(tracerName);
SpanProcessor logProcessor = SimpleSpanProcessor.newBuilder(new LoggingSpanExporter()).build();
@ -155,7 +155,7 @@ Required dependencies and configurations for MainService and TimeService project
@SpringBootApplication
public class MainServiceApplication {
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
SpringApplication.run(MainServiceApplication.class, args);
}
}
@ -211,7 +211,6 @@ public class MainServiceController {
HttpUtils is a helper class that injects the current span context into outgoing requests. This involves adding the tracer id and the trace-state to a request header. For this example, we used `RestTemplate` to send requests from `MainService` to `TimeService`. A similar approach can be used with popular Java Web Clients such as [okhttp](https://square.github.io/okhttp/) and [apache http client](https://www.tutorialspoint.com/apache_httpclient/apache_httpclient_quick_guide.htm). The key to this implementation is to override the put method in `TextMapPropagator.Setter<?>` to handle your request format. `TextMapPropagator.inject` will use this setter to set `traceparent` and `tracestate` headers in your requests. These values will be used to propagate your span context to external services.
```java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
@ -231,35 +230,35 @@ import io.opentelemetry.api.trace.Tracer;
@Component
public class HttpUtils {
private static final TextMapPropagator.Setter<HttpHeaders> setter = new TextMapPropagator.Setter<HttpHeaders>() {
@Override
public void set(HttpHeaders headers, String key, String value) {
headers.set(key, value);
}
};
private static final TextMapPropagator.Setter<HttpHeaders> setter = new TextMapPropagator.Setter<HttpHeaders>() {
@Override
public void set(HttpHeaders headers, String key, String value) {
headers.set(key, value);
}
};
@Autowired
private Tracer tracer;
@Autowired
private Tracer tracer;
private TextMapPropagator<SpanContext> textFormat;
private final TextMapPropagator<SpanContext> textFormat;
public HttpUtils(Tracer tracer) {
textFormat = tracer.getTextMapPropagator();
}
public HttpUtils(Tracer tracer) {
textFormat = tracer.getTextMapPropagator();
}
public String callEndpoint(String url) throws Exception {
HttpHeaders headers = new HttpHeaders();
public String callEndpoint(String url) {
HttpHeaders headers = new HttpHeaders();
textFormat.inject(Context.current(), headers, setter);
textFormat.inject(Context.current(), headers, setter);
HttpEntity<String> entity = new HttpEntity<String>(headers);
RestTemplate restTemplate = new RestTemplate();
HttpEntity<String> entity = new HttpEntity<String>(headers);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> response =
restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
ResponseEntity<String> response =
restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
return response.getBody();
}
return response.getBody();
}
}
```
### Instrumentation of TimeService
@ -277,7 +276,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TimeServiceApplication {
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
SpringApplication.run(TimeServiceApplication.class, args);
}
}
@ -358,7 +357,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TimeServiceApplication {
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
SpringApplication.run(TimeServiceApplication.class, args);
}
}
@ -408,8 +407,7 @@ public class ControllerFilter implements Filter {
};
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {
LOG.info("start doFilter");
HttpServletRequest req = (HttpServletRequest) request;
@ -444,7 +442,7 @@ Ensure the main method in MainServiceApplication is defined. This will be the en
@SpringBootApplication
public class MainServiceApplication {
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
SpringApplication.run(MainServiceApplication.class, args);
}
}
@ -499,7 +497,6 @@ To propagate the span context from MainService to TimeService we must inject the
Include the two classes below to your MainService project to add this functionality:
```java
import java.io.IOException;
@ -520,35 +517,35 @@ import io.opentelemetry.api.trace.Tracer;
@Component
public class RestTemplateInterceptor implements ClientHttpRequestInterceptor {
@Autowired
private Tracer tracer;
@Autowired
private Tracer tracer;
private static final TextMapPropagator.Setter<HttpRequest> setter =
new TextMapPropagator.Setter<HttpRequest>() {
@Override
public void set(HttpRequest carrier, String key, String value) {
carrier.getHeaders().set(key, value);
}
};
private static final TextMapPropagator.Setter<HttpRequest> setter =
new TextMapPropagator.Setter<HttpRequest>() {
@Override
public void set(HttpRequest carrier, String key, String value) {
carrier.getHeaders().set(key, value);
}
};
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
ClientHttpRequestExecution execution) throws IOException {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
ClientHttpRequestExecution execution) {
String spanName = request.getMethodValue() + " " + request.getURI().toString();
Span currentSpan = tracer.spanBuilder(spanName).setSpanKind(SpanKind.CLIENT).startSpan();
String spanName = request.getMethodValue() + " " + request.getURI().toString();
Span currentSpan = tracer.spanBuilder(spanName).setSpanKind(SpanKind.CLIENT).startSpan();
try (Scope scope = tracer.withSpan(currentSpan)) {
OpenTelemetry.getPropagators().getTextMapPropagator().inject(Context.current(), request, setter);
ClientHttpResponse response = execution.execute(request, body);
LOG.info(String.format("Request sent from RestTemplateInterceptor"));
try (Scope scope = tracer.withSpan(currentSpan)) {
OpenTelemetry.getPropagators().getTextMapPropagator().inject(Context.current(), request, setter);
ClientHttpResponse response = execution.execute(request, body);
LOG.info("Request sent from RestTemplateInterceptor");
return response;
}finally {
currentSpan.end();
}
}
return response;
} finally {
currentSpan.end();
}
}
}
```
@ -642,26 +639,26 @@ import org.springframework.web.client.RestTemplate;
@SpringBootApplication
public class MainServiceApplication {
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
SpringApplication.run(MainServiceApplication.class, args);
}
@RestController
@RequestMapping(value = "/message")
public class MainServiceController {
private static final String TIME_SERVICE_URL = "http://localhost:8080/time";
@Autowired
private RestTemplate restTemplate;
public static class MainServiceController {
private static final String TIME_SERVICE_URL = "http://localhost:8080/time";
@Autowired
private RestTemplate restTemplate;
@GetMapping
public String message() {
return restTemplate.exchange(TIME_SERVICE_URL, HttpMethod.GET, null, String.class).getBody();
}
@GetMapping
public String message() {
return restTemplate.exchange(TIME_SERVICE_URL, HttpMethod.GET, null, String.class).getBody();
}
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
return new RestTemplate();
}
}
}
@ -714,7 +711,7 @@ import io.opentelemetry.api.trace.Tracer;
@SpringBootApplication
public class TimeServiceApplication {
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
SpringApplication.run(TimeServiceApplication.class, args);
}

View File

@ -1,6 +1,6 @@
# OpenTelemetry Spring Auto-Configuration
Auto-configures OpenTelemetry instrumentation for [spring-web](../spring-web-3.1/), [spring-webmvc](../spring-webmvc-3.1/), and [spring-webflux](../spring-webflux-5.0/). Leverages Spring Aspect Oriented Programming, dependency injection, and bean post-processing to trace spring applications. To include all features listed below use the [opentelemetry-spring-starter](../starters/spring-starter/README.md).
Auto-configures OpenTelemetry instrumentation for [spring-web](../spring-web-3.1), [spring-webmvc](../spring-webmvc-3.1), and [spring-webflux](../spring-webflux-5.0). Leverages Spring Aspect Oriented Programming, dependency injection, and bean post-processing to trace spring applications. To include all features listed below use the [opentelemetry-spring-starter](../starters/spring-starter/README.md).
## Quickstart
@ -152,15 +152,15 @@ Provides a OpenTelemetry tracer bean (`io.opentelemetry.api.trace.Tracer`) if on
#### Spring Web Auto Configuration
Provides auto-configuration for the OpenTelemetry RestTemplate trace interceptor defined in [opentelemetry-spring-web-3.1](../spring-web-3.1/). This auto-configuration instruments all requests sent using Spring RestTemplate beans by applying a RestTemplate bean post processor. This feature is supported for spring web versions 3.1+ and can be disabled by adding `opentelemetry.trace.httpclients.enabled=false` to your `resources/applications.properties` file. [Spring Web - RestTemplate Client Span]('#spring-web-resttemplate-client-span') show cases a sample client span generated by this auto-configuration. Check out [opentelemetry-spring-web-3.1](../spring-web-3.1/) to learn more about the OpenTelemetry RestTemplateInterceptor.
Provides auto-configuration for the OpenTelemetry RestTemplate trace interceptor defined in [opentelemetry-spring-web-3.1](../spring-web-3.1). This auto-configuration instruments all requests sent using Spring RestTemplate beans by applying a RestTemplate bean post processor. This feature is supported for spring web versions 3.1+ and can be disabled by adding `opentelemetry.trace.httpclients.enabled=false` to your `resources/applications.properties` file. [Spring Web - RestTemplate Client Span](#spring-web---resttemplate-client-span) show cases a sample client span generated by this auto-configuration. Check out [opentelemetry-spring-web-3.1](../spring-web-3.1) to learn more about the OpenTelemetry RestTemplateInterceptor.
#### Spring Web MVC Auto Configuration
This feature auto-configures instrumentation for spring-webmvc controllers by adding a [WebMvcTracingFilter](../spring-webmvc-3.1/src/main/java/io/opentelemetry/instrumentation/springwebmvc/WebMvcTracingFilter.java) bean to the application context. This request filter implements the [OncePerRequestFilter](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/filter/OncePerRequestFilter.html) interface to capture OpenTelemetry server spans and propagate distribute tracing context if provided in the request. [Spring Web MVC - Server Span]('#spring-web-mvc-server-span') show cases a sample span generated by the WebMvcTracingFilter. Check out [opentelemetry-spring-webmvc-3.1](../spring-webmvc-3.1/) to learn more about the OpenTelemetry WebMvcTracingFilter.
This feature auto-configures instrumentation for spring-webmvc controllers by adding a [WebMvcTracingFilter](../spring-webmvc-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/WebMvcTracingFilter.java) bean to the application context. This request filter implements the [OncePerRequestFilter](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/filter/OncePerRequestFilter.html) interface to capture OpenTelemetry server spans and propagate distribute tracing context if provided in the request. [Spring Web MVC - Server Span](#spring-web-mvc---server-span) show cases a sample span generated by the WebMvcTracingFilter. Check out [opentelemetry-spring-webmvc-3.1](../spring-webmvc-3.1/) to learn more about the OpenTelemetry WebMvcTracingFilter.
#### Spring WebFlux Auto Configuration
Provides auto-configurations for the OpenTelemetry WebClient ExchangeFilter defined in [opentelemetry-spring-webflux-5.0](../spring-webflux-5.0/). This auto-configuration instruments all outgoing http requests sent using Spring's WebClient and WebClient Builder beans by applying a bean post processor. This feature is supported for spring webflux versions 5.0+ and can be disabled by adding `opentelemetry.trace.httpclients.enabled=false` to your `resources/applications.properties` file. [Spring Web-Flux - WebClient Span]('#spring-web-flux-webclient-span') showcases a sample span generated by the WebClientFilter. Check out [opentelemetry-spring-webflux-5.0](../spring-webflux-5.0/) to learn more about the OpenTelemetry WebClientFilter.
Provides auto-configurations for the OpenTelemetry WebClient ExchangeFilter defined in [opentelemetry-spring-webflux-5.0](../spring-webflux-5.0). This auto-configuration instruments all outgoing http requests sent using Spring's WebClient and WebClient Builder beans by applying a bean post processor. This feature is supported for spring webflux versions 5.0+ and can be disabled by adding `opentelemetry.trace.httpclients.enabled=false` to your `resources/applications.properties` file. [Spring Web-Flux - WebClient Span](#spring-web-flux---webclient-span) showcases a sample span generated by the WebClientFilter. Check out [opentelemetry-spring-webflux-5.0](../spring-webflux-5.0) to learn more about the OpenTelemetry WebClientFilter.
#### Manual Instrumentation Support - @WithSpan
@ -365,7 +365,7 @@ public class OpenTelemetryConfig {}
This package provides auto configurations for [OTLP](https://github.com/open-telemetry/opentelemetry-java/tree/master/exporters/otlp), [Jaeger](https://github.com/open-telemetry/opentelemetry-java/tree/master/exporters/jaeger), [Zipkin](https://github.com/open-telemetry/opentelemetry-java/tree/master/exporters/zipkin), and [Logging](https://github.com/open-telemetry/opentelemetry-java/tree/master/exporters/logging) Span Exporters.
If an exporter is present in the classpath during runtime and a spring bean of the exporter is missing from the spring application context. An exporter bean is initialized and added to a simple span processor in the active tracer provider. Check out the implementation [here](/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/TracerAutoConfiguration.java).
If an exporter is present in the classpath during runtime and a spring bean of the exporter is missing from the spring application context. An exporter bean is initialized and added to a simple span processor in the active tracer provider. Check out the implementation [here](/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java).
#### Configuration Properties