---
title: "Trace a component reference | Grafana Labs"
description: "Following an export from one component to the argument that uses it"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

Section 4 · Reading Alloy configuration

Following an export from one component to the argument that uses it

Estimated time: 2 min

## Trace a component reference

References are how components connect, so reading one is a core skill. The following example shows how one component’s export supplies another component’s argument. You don’t need to run it.

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
local.file "example" {
  filename = sys.env("HOME") + "/file.txt"
}

prometheus.remote_write "local_prom" {
  endpoint {
    url = "http://localhost:9090/api/v1/write"

    basic_auth {
      username = "admin"
      password = local.file.example.content
    }
  }
}
```

This example has two components. You already met `local.file`, which reads a file and exports its contents. `prometheus.remote_write` sends metrics to a Prometheus-compatible endpoint. Inside it, `endpoint` and `basic_auth` are nested argument blocks that group related settings.

## Read the source component

Start with the `local.file "example"` block. You already know the name and label. What’s new here is the `filename` expression: `sys.env("HOME") + "/file.txt"` builds the path at runtime.

As before, this component type also provides a `content` export. That export isn’t written in the block. Other components reference it.

## Find and read the reference

Now find where that export is used. The `password` argument inside `basic_auth` is set to `local.file.example.content`. Read that expression from left to right:

- `local.file` identifies the component type.
- `example` identifies the labeled instance.
- `content` identifies the export.

The component type and label together, `local.file.example`, are the component’s fully qualified name.

The reference means Alloy evaluates `local.file.example` first, then supplies its `content` export as the `password` argument. This single reference creates a dependency: `prometheus.remote_write.local_prom` depends on `local.file.example`.
