Mark all public classes as final in the examples (#2846)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
parent
fa15e8b2d0
commit
3f45fe0e95
|
|
@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class HelloWorldClient {
|
||||
public final class HelloWorldClient {
|
||||
private static final Logger logger = Logger.getLogger(HelloWorldClient.class.getName());
|
||||
private final ManagedChannel channel;
|
||||
private final String serverHostname;
|
||||
|
|
@ -97,7 +97,7 @@ public class HelloWorldClient {
|
|||
}
|
||||
}
|
||||
|
||||
public class OpenTelemetryClientInterceptor implements ClientInterceptor {
|
||||
public final class OpenTelemetryClientInterceptor implements ClientInterceptor {
|
||||
|
||||
@Override
|
||||
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class HelloWorldClientStream {
|
||||
public final class HelloWorldClientStream {
|
||||
private static final Logger logger = Logger.getLogger(HelloWorldClientStream.class.getName());
|
||||
private final ManagedChannel channel;
|
||||
private final String serverHostname;
|
||||
|
|
@ -145,7 +145,7 @@ public class HelloWorldClientStream {
|
|||
}
|
||||
}
|
||||
|
||||
public class OpenTelemetryClientInterceptor implements ClientInterceptor {
|
||||
public final class OpenTelemetryClientInterceptor implements ClientInterceptor {
|
||||
|
||||
@Override
|
||||
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.net.InetSocketAddress;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
/** Server that manages startup/shutdown of a {@code Greeter} server. */
|
||||
public class HelloWorldServer {
|
||||
public final class HelloWorldServer {
|
||||
private static final Logger logger = Logger.getLogger(HelloWorldServer.class.getName());
|
||||
|
||||
private static final int PORT = 50051;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import java.net.URL;
|
|||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
public class HttpClient {
|
||||
public final class HttpClient {
|
||||
|
||||
// it's important to initialize the OpenTelemetry SDK as early in your applications lifecycle as
|
||||
// possible.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import java.io.OutputStream;
|
|||
import java.net.InetSocketAddress;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
public class HttpServer {
|
||||
public final class HttpServer {
|
||||
// It's important to initialize your OpenTelemetry SDK as early in your application's lifecycle as
|
||||
// possible.
|
||||
private static final OpenTelemetry openTelemetry = ExampleConfiguration.initOpenTelemetry();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import io.opentelemetry.api.OpenTelemetry;
|
|||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
|
||||
public class JaegerExample {
|
||||
public final class JaegerExample {
|
||||
|
||||
private final Tracer tracer;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import java.util.Collections;
|
|||
* All SDK management takes place here, away from the instrumentation code, which should only access
|
||||
* the OpenTelemetry APIs.
|
||||
*/
|
||||
public class ExampleConfiguration {
|
||||
public final class ExampleConfiguration {
|
||||
|
||||
/** The number of milliseconds between metric exports. */
|
||||
private static final long METRIC_EXPORT_INTERVAL_MS = 800L;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import io.opentelemetry.api.trace.Tracer;
|
|||
* An example of using {@link io.opentelemetry.exporter.logging.LoggingSpanExporter} and {@link
|
||||
* io.opentelemetry.exporter.logging.LoggingMetricExporter}.
|
||||
*/
|
||||
public class LoggingExporterExample {
|
||||
public final class LoggingExporterExample {
|
||||
private static final String INSTRUMENTATION_NAME = LoggingExporterExample.class.getName();
|
||||
|
||||
private final Tracer tracer;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import javax.swing.filechooser.FileSystemView;
|
|||
* Example of using {@link DoubleCounter} to count disk space used by files with specific
|
||||
* extensions.
|
||||
*/
|
||||
public class DoubleCounterExample {
|
||||
public final class DoubleCounterExample {
|
||||
private static final OpenTelemetry openTelemetry = GlobalOpenTelemetry.get();
|
||||
private static final Tracer tracer =
|
||||
openTelemetry.getTracer("io.opentelemetry.example.metrics", "0.13.1");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import javax.swing.filechooser.FileSystemView;
|
|||
/**
|
||||
* Example of using {@link LongCounter} and {@link BoundLongCounter} to count searched directories.
|
||||
*/
|
||||
public class LongCounterExample {
|
||||
public final class LongCounterExample {
|
||||
private static final OpenTelemetry openTelemetry = GlobalOpenTelemetry.get();
|
||||
private static final Tracer tracer =
|
||||
openTelemetry.getTracer("io.opentelemetry.example.metrics", "0.13.1");
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import io.opentelemetry.api.metrics.common.Labels;
|
|||
* {@link LongValueObserver} updater sets a callback that gets executed every collection interval.
|
||||
* Useful for expensive measurements that would be wastefully to calculate each request.
|
||||
*/
|
||||
public class LongValueObserverExample {
|
||||
public final class LongValueObserverExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Meter sampleMeter =
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
|
|||
* All SDK management takes place here, away from the instrumentation code, which should only access
|
||||
* the OpenTelemetry APIs.
|
||||
*/
|
||||
public class ExampleConfiguration {
|
||||
public final class ExampleConfiguration {
|
||||
|
||||
/**
|
||||
* Adds a BatchSpanProcessor initialized with OtlpGrpcSpanExporter to the TracerSdkProvider.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import io.opentelemetry.context.Scope;
|
|||
* default port. There is a docker-compose configuration for doing this in the docker subdirectory
|
||||
* of this module.
|
||||
*/
|
||||
public class OtlpExporterExample {
|
||||
public final class OtlpExporterExample {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
// this will make sure that a proper service.name attribute is set on all the spans/metrics.
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import io.opentelemetry.sdk.metrics.SdkMeterProvider;
|
|||
import io.prometheus.client.exporter.HTTPServer;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ExampleConfiguration {
|
||||
public final class ExampleConfiguration {
|
||||
private static HTTPServer server;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||
* awaiting processing. The {@link LongValueObserver} Updater gets executed every collection
|
||||
* interval.
|
||||
*/
|
||||
public class PrometheusExample {
|
||||
public final class PrometheusExample {
|
||||
private long incomingMessageCount;
|
||||
|
||||
public PrometheusExample(MeterProvider meterProvider) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/** This example shows how to instantiate different Span Processors. */
|
||||
public class ConfigureSpanProcessorExample {
|
||||
public final class ConfigureSpanProcessorExample {
|
||||
|
||||
private static final LoggingSpanExporter exporter = new LoggingSpanExporter();
|
||||
private static final OpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder().build();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
|
|||
* All SDK management takes place here, away from the instrumentation code, which should only access
|
||||
* the OpenTelemetry APIs.
|
||||
*/
|
||||
public class ExampleConfiguration {
|
||||
public final class ExampleConfiguration {
|
||||
// Zipkin API Endpoints for uploading spans
|
||||
private static final String ENDPOINT_V2_SPANS = "/api/v2/spans";
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import io.opentelemetry.api.trace.Tracer;
|
|||
import io.opentelemetry.api.trace.TracerProvider;
|
||||
import io.opentelemetry.context.Scope;
|
||||
|
||||
public class ZipkinExample {
|
||||
public final class ZipkinExample {
|
||||
// The Tracer we'll use for the example
|
||||
private final Tracer tracer;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue