> For the complete documentation index, see [llms.txt](https://docs.inspector.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inspector.dev/concepts/custom-segments.md).

# Custom Segments

Monitor custom code blocks inside your application.

Inspector automatically creates a basic timeline to see what happen inside your application. It will report many type of statements by default.&#x20;

Segments give you the opportunity to "monitor" specific code bloks that you consider relevant for your app to create a more complete picture of what's happening on any execution cycle.

### What are segments?

Segments represents tasks performed during an execution cycle, like:

* Http call to external services (webhooks, integration, etc.)
* Functions that deal with files (pdf, excel, images)
* Data manipulation processes (import/export, data aggregation, etc.)

Below you can see an example of how custom segments will appear in the timeline:

![A new segment in the timeline](https://2873457055-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LQ51SrLj6qvIRejC1XD%2F-LuWftDEBTwuMd7Hu5-D%2F-LuWgbN9J5ftiM5TDO2T%2Fcodeblock-timeline.png?alt=media\&token=1a5bd2d6-f538-4d09-aa5b-6272b0d4ed01)

You can learn how to add custom segments from the code examples below:

{% content-ref url="/pages/-McFYez8BNvP8qjYxvXw" %}
[Custom Segments](/guides/raw-php/custom-segments.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.inspector.dev/concepts/custom-segments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
