Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
Open source

argument block

argument is an optional configuration block used to specify parameterized input to a custom component. argument blocks must be given a label which determines the name of the argument.

The argument block may only be specified inside the definition of a declare block.


In classic modules, the argument block is valid as a top-level block in a classic module. Classic modules are deprecated and scheduled to be removed in the release after v0.40.


argument "ARGUMENT_NAME" {}



For clarity, “argument” in this section refers to arguments which can be given to the argument block. “Module argument” refers to the argument being defined for a module, determined by the label of the argument block.

The following arguments are supported:

commentstringDescription for the argument.falseno
defaultanyDefault value for the argument.nullno
optionalboolWhether the argument may be omitted.falseno

By default, all module arguments are required. The optional argument can be used to mark the module argument as optional. When optional is true, the initial value for the module argument is specified by default.

Exported fields

The following fields are exported and can be referenced by other components:

valueanyThe current value of the argument.

If you use a custom component, you are responsible for determining the values for arguments. Other expressions within a custom component may use argument.ARGUMENT_NAME.value to retrieve the value you provide.


This example creates a custom component that self-collects process metrics and forwards them to an argument specified by the user of the custom component:

declare "self_collect" {
  argument "metrics_output" {
    optional = false
    comment  = "Where to send collected metrics."

  prometheus.scrape "selfmonitor" {
    targets = [{
      __address__ = "",

    forward_to = [argument.metrics_output.value]