Class DatadogSites

java.lang.Object
codes.grow.packages.datadogapm.DatadogSites

public final class DatadogSites extends Object
Datadog sites and the query API base URL (API.md section 0). Same site handling as the datadog-logs package; this copy is kept in sync by hand (no cross-repository runtime dependency).
  • Field Details

    • DEFAULT_SITE

      public static final String DEFAULT_SITE
      Default Datadog site (US1).
      See Also:
    • DATADOG_SITES

      public static final List<String> DATADOG_SITES
      The Datadog sites of the official OpenAPI spec (servers enum). Other host names are accepted too (the spec's "any Datadog deployment" server), but never a scheme, port or path.
  • Method Details

    • normalizeSite

      public static String normalizeSite(String site)
      Lower-cases and trims a site name.
      Parameters:
      site - site name
      Returns:
      the normalized name ("" for null)
    • isDatadogSite

      public static boolean isDatadogSite(String site)
      Whether site is one of DATADOG_SITES.
      Parameters:
      site - site name
      Returns:
      true for a known site
    • validateSite

      public static String validateSite(String site)
      Validates a site name and returns it normalized.
      Parameters:
      site - site name such as datadoghq.eu
      Returns:
      the normalized site
      Throws:
      ConfigException - for a value with a scheme, port, path or other non-host characters (for example https://app.datadoghq.com)
    • apiUrlForSite

      public static String apiUrlForSite(String site)
      Returns the API base URL of a site: https://api.<site>.
      
       DatadogSites.apiUrlForSite("datadoghq.eu"); // "https://api.datadoghq.eu"
       
      Parameters:
      site - site name; null or blank means DEFAULT_SITE
      Returns:
      the API base URL
      Throws:
      ConfigException - for an invalid site