Class DatadogResourceManager

java.lang.Object
org.apache.beam.it.testcontainers.TestContainerResourceManager<MockServerContainer>
org.apache.beam.it.datadog.DatadogResourceManager
All Implemented Interfaces:
org.apache.beam.it.common.ResourceManager

public class DatadogResourceManager extends org.apache.beam.it.testcontainers.TestContainerResourceManager<MockServerContainer> implements org.apache.beam.it.common.ResourceManager
Client for managing Datadog resources.

The class supports one mock Datadog server instance.

The class is thread-safe.

Note: The MockServer TestContainer will only run on M1 Mac's if the Docker version is >= 4.16.0 and the "Use Rosetta for x86/amd64 emulation on Apple Silicon" setting is enabled.

  • Method Details

    • builder

      public static DatadogResourceManager.Builder builder(String testId)
    • getPort

      public int getPort()
      Returns the port to connect to the mock Datadog server.
    • getHttpEndpoint

      public String getHttpEndpoint()
      Returns the HTTP endpoint that this mock Datadog server is configured to listen on.
      Returns:
      the HTTP endpoint.
    • getApiEndpoint

      public String getApiEndpoint()
      Returns the API endpoint that this mock Datadog server is configured to receive events at.

      This will be the HTTP endpoint concatenated with '/api/v2/logs'.

      Returns:
      the API endpoint.
    • getApiKey

      public String getApiKey()
      Returns the Datadog API key used to connect to this mock Datadog server.
      Returns:
      the API key.
    • sendHttpEvent

      public boolean sendHttpEvent(DatadogLogEntry event)
      Sends the given HTTP event to the mock Datadog server.
      Parameters:
      event - The DatadogLogEntry to send to the API.
      Returns:
      True, if the request was successful.
    • sendHttpEvents

      public boolean sendHttpEvents(Collection<DatadogLogEntry> events)
      Sends the given HTTP events to the mock Datadog server.
      Parameters:
      events - The DatadogLogEntrys to send to the API.
      Returns:
      True, if the request was successful.
    • getEntries

      public List<DatadogLogEntry> getEntries()
      Return a list of all Datadog entries retrieved from the mock Datadog server.
      Returns:
      All Datadog entries on the server.