#Mounting Dagger Engine’s Datadog Socket in Temp Container

1 messages · Page 1 of 1 (latest)

primal meteor
#

Hi everyone,

Intro
I’m currently developing a Dagger module using the Python SDK to send notifications to Datadog.

dagger call send-event \
  --title "Test Event" \
  --msg "This is a test" \
  --tags "env:test","team:dev" \
  --alerte_type "info"

Context:

  • Running in a Kubernetes environment.
  • Datadog agent and Dagger engine are running in the cluster.
  • I want to send events via the agent’s UDS socket.
  • I’ve mounted the Datadog socket in the dagger-engine container.

Code Example

@function
async def send_event(
    self,
    title: str,
    msg: str,
    alerte_type: str,
    tags: list[str],
):
    """Send an event to Datadog"""

    client = DogStatsd(
        statsd_socket_path: "/var/run/datadog/dsd.socket",
    )

    try:
        client.event(
            title=title,
            message=msg,
            alert_type=alerte_type,
            tags=tags,
        )
    except Exception as e:
        logger.error(f"Erreur lors de l'envoi : {e}")

Problem:
The Python code runs in a temporary container (spawned by Dagger), not in the dagger-engine container. Therefore, it cannot access the mounted Datadog socket.

Question:
Is there a way to share or mount the dagger-engine container’s socket into the temporary container where the Python module runs?

Thanks in advance! 🙏

glacial granite
#

Hey @primal meteor!!

It is not possible to mount sockets from the engine into the containers of the dagger calls. Most of the properties available in the container have to be provided by the client. This allows us to provide an experience that has the least surprises. As long as the client has the right context, the dagger call will work the same for all clients.

Is it possible to use datadog's API instead of the socket?

royal gate
#

@glacial granite but you can pass the socket as argument to the function from the CLI no?

#

dagger call send event --socket=/var/run/datadog/dtd.sock

glacial granite
#

If the socket is in the client you can. What I understood from the environment explained is that the datadog socket is available in kubernetes in the same node as the dagger engine, not the client

royal gate
#

oooh. by client you mean the pod running the Dagger CLI I guess

#

Simplest solution would be to mount the socket in the client container then