# Observability

Observability is key in distributed system. It helps to understand and track the performance of a system. GoAkt offers out of the box features that can help track, monitor and measure the performance of a GoAkt based system.

## **Metrics**

GoAkt comes bundled with the following metrics:

### **Actor System Metric**

The **`Metric`** method on the [actor system](https://github.com/Tochemey/goakt/blob/main/actor/actor_system.go#L74) will provide the following counters:

* Total Number of actors in the system at a given point time
* Total Number of deadletter
* The number of seconds since the actor system started

### **Actor Metric**

The **`Metric`** method on the [PID](https://github.com/Tochemey/goakt/blob/main/actor/pid.go#L226) will provide the following counters:

* Total Number of children at a given point in time
* Total Number of messages stashed at a given point in time
* Total Number of Restarts at a given point in time
* Last message received processing duration in milliseconds
* Total Number of deadletter
* The number of seconds since the actor started
* Total Number of Failures at a given point in time
* Total Number of Reinstate at given point in time.

## **Logging**

A simple logging interface to allow custom logger to be implemented instead of using the default logger.

## Instrumentation

GoAkt also via [OpenTelemetry](https://opentelemetry.io/docs/languages/go/) can export the above metrics that can be collected via an OpenTelemetry collector. To be able to export metrics one need to start the `ActorSystem` with the option **`WithMetrics`**.

> Remember to initialize the OpenTelemetry meter SDK before starting the actor system with the metrics option enabled


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tochemey.gitbook.io/goakt/features/observability.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
