DemoPropertySource.java 1.1 KB

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright The OpenTelemetry Authors
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. package com.example.javaagent;
  6. import com.google.auto.service.AutoService;
  7. import io.opentelemetry.javaagent.extension.config.ConfigPropertySource;
  8. import java.util.HashMap;
  9. import java.util.Map;
  10. /**
  11. * {@link ConfigPropertySource} is an SPI provided by OpenTelemetry Java instrumentation agent. By
  12. * implementing it custom distributions can supply their own default configuration. The
  13. * configuration priority, from highest to lowest is: system properties -> environment variables ->
  14. * configuration file -> PropertySource SPI -> hard-coded defaults
  15. */
  16. @AutoService(ConfigPropertySource.class)
  17. public class DemoPropertySource implements ConfigPropertySource {
  18. @Override
  19. public Map<String, String> getProperties() {
  20. Map<String, String> properties = new HashMap<>();
  21. properties.put("otel.exporter.otlp.endpoint", "http://backend:8080");
  22. properties.put("otel.exporter.otlp.insecure", "true");
  23. properties.put("otel.config.max.attrs", "16");
  24. return properties;
  25. }
  26. }