From 276db0abff00486327eeb599aa20f39f0bf0233c Mon Sep 17 00:00:00 2001 From: Piotr <17101802+thampiotr@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:43:18 +0000 Subject: [PATCH 1/3] Fix wrong Y axis on new chart (#6254) * Fix wrong Y axis on new chart * use percentunit --- operations/agent-flow-mixin/dashboards/prometheus.libsonnet | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/operations/agent-flow-mixin/dashboards/prometheus.libsonnet b/operations/agent-flow-mixin/dashboards/prometheus.libsonnet index 6a374db315c9..21ae79f3b063 100644 --- a/operations/agent-flow-mixin/dashboards/prometheus.libsonnet +++ b/operations/agent-flow-mixin/dashboards/prometheus.libsonnet @@ -19,8 +19,8 @@ local scrapePanels(y_offset) = [ // Scrape success rate ( - panel.new(title='Scrape success rate', type='timeseries') + - panel.withUnit('percent') + + panel.new(title='Scrape success rate in $cluster', type='timeseries') + + panel.withUnit('percentunit') + panel.withDescription(||| Percentage of targets successfully scraped by prometheus.scrape components. @@ -47,7 +47,7 @@ local scrapePanels(y_offset) = [ // Scrape duration ( - panel.new(title='Scrape duration', type='timeseries') + + panel.new(title='Scrape duration in $cluster', type='timeseries') + panel.withUnit('s') + panel.withDescription(||| Duration of successful scrapes by prometheus.scrape components, From 2c4f3e1c793f211e08ac0796becbbb48e726ef56 Mon Sep 17 00:00:00 2001 From: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> Date: Mon, 29 Jan 2024 02:08:03 -0800 Subject: [PATCH 2/3] WIP: Clean up docs in new and refactored content (#6219) * General cleanup of spaces and structure * Fix canonical link * Clean up empty spaces and syntax * Convert HTML images containers to markdown * Clean up tables, refs, extra spaces, and config * Clean up tables, spacing, word use * Revert image links --- docs/sources/flow/get-started/_index.md | 2 +- .../flow/get-started/install/_index.md | 2 +- docs/sources/flow/get-started/install/chef.md | 18 +- .../flow/get-started/install/windows.md | 2 +- docs/sources/flow/reference/cli/convert.md | 10 +- .../flow/reference/compatibility/_index.md | 21 +- .../otelcol.processor.resourcedetection.md | 256 +++++++++--------- .../components/prometheus.exporter.agent.md | 8 +- .../components/prometheus.exporter.snmp.md | 3 +- .../components/prometheus.exporter.windows.md | 124 +++++---- .../flow/tasks/estimate-resource-usage.md | 12 +- .../flow/tasks/migrate/from-promtail.md | 4 +- .../first-components-and-stdlib/index.md | 38 +-- 13 files changed, 254 insertions(+), 246 deletions(-) diff --git a/docs/sources/flow/get-started/_index.md b/docs/sources/flow/get-started/_index.md index 80b48bfdaece..444b64f5afc5 100644 --- a/docs/sources/flow/get-started/_index.md +++ b/docs/sources/flow/get-started/_index.md @@ -20,6 +20,6 @@ weight: 50 # Get started with {{% param "PRODUCT_NAME" %}} This section covers topics that help you get started with {{< param "PRODUCT_NAME" >}}, -including installation, running the agent, overview of deployment topologies, and more. +including installation, running {{< param "PRODUCT_NAME" >}}, overview of deployment topologies, and more. {{< section >}} diff --git a/docs/sources/flow/get-started/install/_index.md b/docs/sources/flow/get-started/install/_index.md index dabb07857d74..b43983c5ea53 100644 --- a/docs/sources/flow/get-started/install/_index.md +++ b/docs/sources/flow/get-started/install/_index.md @@ -30,7 +30,7 @@ The following architectures are supported: - FreeBSD: AMD64 {{% admonition type="note" %}} -Installing {{< param "PRODUCT_NAME" >}} on other operating systems is possible, but is not recommended or supported. +Installing {{< param "PRODUCT_NAME" >}} on other operating systems is possible, but isn't recommended or supported. {{% /admonition %}} {{< section >}} diff --git a/docs/sources/flow/get-started/install/chef.md b/docs/sources/flow/get-started/install/chef.md index 495bf116019f..70d9441d22f0 100644 --- a/docs/sources/flow/get-started/install/chef.md +++ b/docs/sources/flow/get-started/install/chef.md @@ -15,7 +15,7 @@ You can use Chef to install and manage {{< param "PRODUCT_NAME" >}}. ## Before you begin - These steps assume you already have a working [Chef][] setup. -- You can add the following resources to any new or existing recipe you choose. +- You can add the following resources to any new or existing recipe. - These tasks install {{< param "PRODUCT_NAME" >}} from the package repositories. The tasks target Linux systems from the following families: - Debian (including Ubuntu) - RedHat Enterprise Linux @@ -27,6 +27,7 @@ You can use Chef to install and manage {{< param "PRODUCT_NAME" >}}. To add {{% param "PRODUCT_NAME" %}} to a host: 1. Add the following resources to your [Chef][] recipe to add the Grafana package repositories to your system: + ```ruby if platform_family?('debian', 'rhel', 'amazon', 'fedora') if platform_family?('debian') @@ -35,13 +36,13 @@ To add {{% param "PRODUCT_NAME" %}} to a host: mode '0644' action :create end - + file '/etc/apt/sources.list.d/grafana.list' do content "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com/ stable main" mode '0644' notifies :update, 'apt_update[update apt cache]', :immediately end - + apt_update 'update apt cache' do action :nothing end @@ -55,7 +56,7 @@ To add {{% param "PRODUCT_NAME" %}} to a host: action :create notifies :run, 'execute[add-rhel-key]', :immediately end - + execute 'add-rhel-key' do command "rpm --import https://rpm.grafana.com/gpg.key" action :nothing @@ -65,7 +66,9 @@ To add {{% param "PRODUCT_NAME" %}} to a host: fail "The #{node['platform_family']} platform is not supported." end ``` + 1. Add the following resources to install and enable the `grafana-agent-flow` service: + ```ruby package 'grafana-agent-flow' do action :install @@ -76,14 +79,14 @@ To add {{% param "PRODUCT_NAME" %}} to a host: service 'grafana-agent-flow' do service_name 'grafana-agent-flow' action [:enable, :start] - end + end ``` ## Configuration The `grafana-agent-flow` package installs a default configuration file that doesn't send telemetry anywhere. -The default configuration file location is `/etc/grafana-agent-flow.river`. You can replace this file with your own configuration, or create a new configuration file for the service to use. +The default configuration file location is `/etc/grafana-agent-flow.river`. You can replace this file with your own configuration or create a new configuration file for the service to use. ## Next steps @@ -92,7 +95,6 @@ The default configuration file location is `/etc/grafana-agent-flow.river`. You [Chef]: https://www.chef.io/products/chef-infrastructure-management/ {{% docs/reference %}} - [Configure]: "/docs/agent/ -> /docs/agent//flow/tasks/configure/configure-linux.md" [Configure]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/tasks/configure/configure-linux.md" -{{% /docs/reference %}} \ No newline at end of file +{{% /docs/reference %}} diff --git a/docs/sources/flow/get-started/install/windows.md b/docs/sources/flow/get-started/install/windows.md index 2be2fabc6019..a20ed3449792 100644 --- a/docs/sources/flow/get-started/install/windows.md +++ b/docs/sources/flow/get-started/install/windows.md @@ -52,7 +52,7 @@ To do a silent install of {{< param "PRODUCT_NAME" >}} on Windows, perform the f 1. Run the following command in PowerShell or Command Prompt: - ```shell + ```cmd /S ``` diff --git a/docs/sources/flow/reference/cli/convert.md b/docs/sources/flow/reference/cli/convert.md index a9a3810ec3ee..3b44d662e87a 100644 --- a/docs/sources/flow/reference/cli/convert.md +++ b/docs/sources/flow/reference/cli/convert.md @@ -21,13 +21,13 @@ The `convert` command converts a supported configuration format to {{< param "PR Usage: -* `AGENT_MODE=flow grafana-agent convert [FLAG ...] FILE_NAME` -* `grafana-agent-flow convert [FLAG ...] FILE_NAME` +* `AGENT_MODE=flow grafana-agent convert [ ...] ` +* `grafana-agent-flow convert [ ...] ` Replace the following: - * `FLAG`: One or more flags that define the input and output of the command. - * `FILE_NAME`: The {{< param "PRODUCT_ROOT_NAME" >}} configuration file. + * _``_: One or more flags that define the input and output of the command. + * _``_: The {{< param "PRODUCT_ROOT_NAME" >}} configuration file. If the `FILE_NAME` argument isn't provided or if the `FILE_NAME` argument is equal to `-`, `convert` converts the contents of standard input. Otherwise, @@ -70,7 +70,7 @@ where an output can still be generated. These can be bypassed using the ### Prometheus -Using the `--source-format=prometheus` will convert the source config from +Using the `--source-format=prometheus` will convert the source configuration from [Prometheus v2.45](https://prometheus.io/docs/prometheus/2.45/configuration/configuration/) to {{< param "PRODUCT_NAME" >}} configuration. diff --git a/docs/sources/flow/reference/compatibility/_index.md b/docs/sources/flow/reference/compatibility/_index.md index 44a9c5382a28..38751632780a 100644 --- a/docs/sources/flow/reference/compatibility/_index.md +++ b/docs/sources/flow/reference/compatibility/_index.md @@ -4,7 +4,7 @@ aliases: - /docs/grafana-cloud/monitor-infrastructure/agent/flow/reference/compatible-components/ - /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/reference/compatible-components/ - /docs/grafana-cloud/send-data/agent/flow/reference/compatible-components/ -canonical: https://grafana.com/docs/agent/latest/flow/reference/compatible-components/ +canonical: https://grafana.com/docs/agent/latest/flow/reference/compatibility/ description: Learn about which components are compatible with each other in Grafana Agent Flow title: Compatible components weight: 400 @@ -12,22 +12,18 @@ weight: 400 # Compatible components -This section provides an overview of _some_ of the possible connections between -compatible components in Grafana Agent Flow. +This section provides an overview of _some_ of the possible connections between compatible components in {{< param "PRODUCT_NAME" >}}. -For each common data type, we provide a list of compatible components -that can export or consume it. +For each common data type, we provide a list of compatible components that can export or consume it. {{% admonition type="note" %}} - The type of export may not be the only requirement for chaining components together. The value of an attribute may matter as well as its type. -Please refer to each component's documentation for more details on what values are acceptable. +Refer to each component's documentation for more details on what values are acceptable. For example: * A Prometheus component may always expect an `"__address__"` label inside a list of targets. * A `string` argument may only accept certain values like "traceID" or "spanID". - {{% /admonition %}} ## Targets @@ -155,7 +151,7 @@ The following components, grouped by namespace, _consume_ Targets. ## Prometheus `MetricsReceiver` -The Prometheus metrics are sent between components using `MetricsReceiver`s. +The Prometheus metrics are sent between components using `MetricsReceiver`s. `MetricsReceiver`s are [capsules]({{< relref "../../concepts/config-language/expressions/types_and_values/#capsules" >}}) that are exported by components that can receive Prometheus metrics. Components that can consume Prometheus metrics can be passed the `MetricsReceiver` as an argument. Use the @@ -181,7 +177,6 @@ The following components, grouped by namespace, _export_ Prometheus `MetricsRece ### Prometheus `MetricsReceiver` Consumers The following components, grouped by namespace, _consume_ Prometheus `MetricsReceiver`. - @@ -200,8 +195,6 @@ The following components, grouped by namespace, _consume_ Prometheus `MetricsRec - - ## Loki `LogsReceiver` `LogsReceiver` is a [capsule]({{< relref "../../concepts/config-language/expressions/types_and_values/#capsules" >}}) @@ -265,7 +258,6 @@ The following components, grouped by namespace, _consume_ Loki `LogsReceiver`. - ## OpenTelemetry `otelcol.Consumer` The OpenTelemetry data is sent between components using `otelcol.Consumer`s. @@ -343,8 +335,6 @@ The following components, grouped by namespace, _consume_ OpenTelemetry `otelcol - - ## Pyroscope `ProfilesReceiver` The Pyroscope profiles are sent between components using `ProfilesReceiver`s. @@ -378,4 +368,3 @@ The following components, grouped by namespace, _consume_ Pyroscope `ProfilesRec {{< /collapse >}} - diff --git a/docs/sources/flow/reference/components/otelcol.processor.resourcedetection.md b/docs/sources/flow/reference/components/otelcol.processor.resourcedetection.md index 204372aa8d6e..4c727fa6e788 100644 --- a/docs/sources/flow/reference/components/otelcol.processor.resourcedetection.md +++ b/docs/sources/flow/reference/components/otelcol.processor.resourcedetection.md @@ -21,7 +21,7 @@ overrides the resource values in the telemetry data with this information. {{% admonition type="note" %}} `otelcol.processor.resourcedetection` is a wrapper over the upstream -OpenTelemetry Collector Contrib `resourcedetection` processor. If necessary, +OpenTelemetry Collector Contrib `resourcedetection` processor. If necessary, bug reports or feature requests are redirected to the upstream repository. {{% /admonition %}} @@ -68,16 +68,16 @@ Name | Type | Description * `kubernetes_node` `env` is the only detector that is not configured through a River block. -The `env` detector reads resource information from the `OTEL_RESOURCE_ATTRIBUTES` environment variable. -This variable must be in the format `=,=,...`, +The `env` detector reads resource information from the `OTEL_RESOURCE_ATTRIBUTES` environment variable. +This variable must be in the format `=,=,...`, the details of which are currently pending confirmation in the OpenTelemetry specification. If a detector other than `env` is needed, you can customize it with the relevant River block. For example, you can customize the `ec2` detector with the [ec2][] block. If you omit the [ec2][] block, the defaults specified in the [ec2][] block documentation are used. -If multiple detectors are inserting the same attribute name, the first detector to insert wins. -For example, if you had `detectors = ["eks", "ec2"]` then `cloud.platform` will be `aws_eks` instead of `ec2`. +If multiple detectors are inserting the same attribute name, the first detector to insert wins. +For example, if you had `detectors = ["eks", "ec2"]` then `cloud.platform` will be `aws_eks` instead of `ec2`. The following order is recommended for AWS: 1. [lambda][] @@ -140,17 +140,17 @@ Attribute | Type | Description ----------- |----------------| --------------------------------------------------------------------------- |-------------| -------- `tags` | `list(string)` | A list of regular expressions to match against tag keys of an EC2 instance. | `[]` | no -If you are using a proxy server on your EC2 instance, it's important that you exempt requests for instance metadata as described in the [AWS cli user guide][]. +If you are using a proxy server on your EC2 instance, it's important that you exempt requests for instance metadata as described in the [AWS cli user guide][]. Failing to do so can result in proxied or missing instance data. -If the instance is part of AWS ParallelCluster and the detector is failing to connect to the metadata server, +If the instance is part of AWS ParallelCluster and the detector is failing to connect to the metadata server, check the iptable and make sure the chain `PARALLELCLUSTER_IMDS` contains a rule that allows the {{< param "PRODUCT_ROOT_NAME" >}} user to access `169.254.169.254/32`. [AWS SDK for Go]: https://docs.aws.amazon.com/sdk-for-go/api/aws/ec2metadata/ [EC2 instance metadata API]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html [AWS cli user guide]: https://github.com/awsdocs/aws-cli-user-guide/blob/a2393582590b64bd2a1d9978af15b350e1f9eb8e/doc_source/cli-configure-proxy.md#using-a-proxy-on-amazon-ec2-instances -`tags` can be used to gather tags for the EC2 instance which {{< param "PRODUCT_ROOT_NAME" >}} is running on. +`tags` can be used to gather tags for the EC2 instance which {{< param "PRODUCT_ROOT_NAME" >}} is running on. To fetch EC2 tags, the IAM role assigned to the EC2 instance must have a policy that includes the `ec2:DescribeTags` permission. The `ec2` block supports the following blocks: @@ -183,9 +183,9 @@ The `ecs` block queries the Task Metadata Endpoint (TMDE) to record information The `ecs` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#ecs--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +-------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#ecs--resource_attributes) | Configures which resource attributes to add. | no #### ecs > resource_attributes @@ -214,9 +214,9 @@ The `eks` block adds resource attributes for Amazon EKS. The `eks` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#eks--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +-------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#eks--resource_attributes) | Configures which resource attributes to add. | no #### eks > resource_attributes @@ -239,9 +239,9 @@ The `elasticbeanstalk` block reads the AWS X-Ray configuration file available on The `elasticbeanstalk` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#elasticbeanstalk--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +--------------------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#elasticbeanstalk--resource_attributes) | Configures which resource attributes to add. | no #### elasticbeanstalk > resource_attributes @@ -267,9 +267,9 @@ The `lambda` block uses the AWS Lambda [runtime environment variables][lambda-en The `lambda` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#lambda--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +----------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#lambda--resource_attributes) | Configures which resource attributes to add. | no #### lambda > resource_attributes @@ -315,26 +315,26 @@ The `azure` block queries the [Azure Instance Metadata Service][] to retrieve va The `azure` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#azure--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +---------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#azure--resource_attributes) | Configures which resource attributes to add. | no #### azure > resource_attributes The `resource_attributes` block supports the following blocks: -Block | Description | Required ----------------------------------------- | --------------------------------------------------------------------------------------------------- | -------- -[azure.resourcegroup.name][res-attr-cfg] | Toggles the `azure.resourcegroup.name` resource attribute.
Sets `enabled` to `true` by default. | no -[azure.vm.name][res-attr-cfg] | Toggles the `azure.vm.name` resource attribute.
Sets `enabled` to `true` by default. | no -[azure.vm.scaleset.name][res-attr-cfg] | Toggles the `azure.vm.scaleset.name` resource attribute.
Sets `enabled` to `true` by default. | no -[azure.vm.size][res-attr-cfg] | Toggles the `azure.vm.size` resource attribute.
Sets `enabled` to `true` by default. | no -[cloud.account.id][res-attr-cfg] | Toggles the `cloud.account.id` resource attribute.
Sets `enabled` to `true` by default. | no -[cloud.platform][res-attr-cfg] | Toggles the `cloud.platform` resource attribute.
Sets `enabled` to `true` by default. | no -[cloud.provider][res-attr-cfg] | Toggles the `cloud.provider` resource attribute.
Sets `enabled` to `true` by default. | no -[cloud.region][res-attr-cfg] | Toggles the `cloud.region` resource attribute.
Sets `enabled` to `true` by default. | no -[host.id][res-attr-cfg] | Toggles the `host.id` resource attribute.
Sets `enabled` to `true` by default. | no -[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no +Block | Description | Required +-----------------------------------------|------------------------------------------------------------------------------------------------------|--------- +[azure.resourcegroup.name][res-attr-cfg] | Toggles the `azure.resourcegroup.name` resource attribute.
Sets `enabled` to `true` by default. | no +[azure.vm.name][res-attr-cfg] | Toggles the `azure.vm.name` resource attribute.
Sets `enabled` to `true` by default. | no +[azure.vm.scaleset.name][res-attr-cfg] | Toggles the `azure.vm.scaleset.name` resource attribute.
Sets `enabled` to `true` by default. | no +[azure.vm.size][res-attr-cfg] | Toggles the `azure.vm.size` resource attribute.
Sets `enabled` to `true` by default. | no +[cloud.account.id][res-attr-cfg] | Toggles the `cloud.account.id` resource attribute.
Sets `enabled` to `true` by default. | no +[cloud.platform][res-attr-cfg] | Toggles the `cloud.platform` resource attribute.
Sets `enabled` to `true` by default. | no +[cloud.provider][res-attr-cfg] | Toggles the `cloud.provider` resource attribute.
Sets `enabled` to `true` by default. | no +[cloud.region][res-attr-cfg] | Toggles the `cloud.region` resource attribute.
Sets `enabled` to `true` by default. | no +[host.id][res-attr-cfg] | Toggles the `host.id` resource attribute.
Sets `enabled` to `true` by default. | no +[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no Example values: * `cloud.provider`: `"azure"` @@ -346,9 +346,9 @@ The `aks` block adds resource attributes related to Azure AKS. The `aks` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#aks--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +-------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#aks--resource_attributes) | Configures which resource attributes to add. | no #### aks > resource_attributes @@ -369,13 +369,13 @@ The `consul` block queries a Consul agent and reads its configuration endpoint t The `consul` block supports the following attributes: -Attribute | Type | Description | Default | Required ------------- |--------------- | --------------------------------------------------------------------------- |-------------| -------- -`address` | `string` | The address of the Consul server | `""` | no -`datacenter` | `string` | Datacenter to use. If not provided, the default agent datacenter is used. | `""` | no -`token` | `secret` | A per-request ACL token which overrides the Consul agent's default (empty) token. | `""` | no -`namespace` | `string` | The name of the namespace to send along for the request. | `""` | no -`meta` | `list(string)` | Allowlist of [Consul Metadata][] keys to use as resource attributes. | `[]` | no +Attribute | Type | Description | Default | Required +-------------|----------------|-----------------------------------------------------------------------------------|---------|--------- +`address` | `string` | The address of the Consul server | `""` | no +`datacenter` | `string` | Datacenter to use. If not provided, the default agent datacenter is used. | `""` | no +`token` | `secret` | A per-request ACL token which overrides the Consul agent's default (empty) token. | `""` | no +`namespace` | `string` | The name of the namespace to send along for the request. | `""` | no +`meta` | `list(string)` | Allowlist of [Consul Metadata][] keys to use as resource attributes. | `[]` | no `token` is only required if [Consul's ACL System][] is enabled. @@ -384,19 +384,19 @@ Attribute | Type | Description The `consul` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#consul--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +----------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#consul--resource_attributes) | Configures which resource attributes to add. | no #### consul > resource_attributes The `resource_attributes` block supports the following blocks: -Block | Description | Required ---------------------------------------- | --------------------------------------------------------------------------------------------------- | -------- -[cloud.region][res-attr-cfg] | Toggles the `cloud.region` resource attribute.
Sets `enabled` to `true` by default. | no -[host.id][res-attr-cfg] | Toggles the `host.id` resource attribute.
Sets `enabled` to `true` by default. | no -[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no +Block | Description | Required +-----------------------------|------------------------------------------------------------------------------------------|--------- +[cloud.region][res-attr-cfg] | Toggles the `cloud.region` resource attribute.
Sets `enabled` to `true` by default. | no +[host.id][res-attr-cfg] | Toggles the `host.id` resource attribute.
Sets `enabled` to `true` by default. | no +[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no ### docker @@ -407,23 +407,23 @@ Docker detection does not work on MacOS. The `docker` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#docker--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +----------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#docker--resource_attributes) | Configures which resource attributes to add. | no #### docker > resource_attributes The `resource_attributes` block supports the following blocks: -Block | Description | Required ---------------------------------------- | --------------------------------------------------------------------------------------------------- | -------- -[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no -[os.type][res-attr-cfg] | Toggles the `os.type` resource attribute.
Sets `enabled` to `true` by default. | no +Block | Description | Required +--------------------------|---------------------------------------------------------------------------------------|--------- +[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no +[os.type][res-attr-cfg] | Toggles the `os.type` resource attribute.
Sets `enabled` to `true` by default. | no ### gcp The `gcp` block detects resource attributes using the [Google Cloud Client Libraries for Go][], which reads resource information from the [GCP metadata server][]. -The detector also uses environment variables to identify which GCP platform the application is running on, and assigns appropriate resource attributes for that platform. +The detector also uses environment variables to identify which GCP platform the application is running on, and assigns appropriate resource attributes for that platform. Use the `gcp` detector regardless of the GCP platform {{< param "PRODUCT_ROOT_NAME" >}} is running on. @@ -432,33 +432,33 @@ Use the `gcp` detector regardless of the GCP platform {{< param "PRODUCT_ROOT_NA The `gcp` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#gcp--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +-------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#gcp--resource_attributes) | Configures which resource attributes to add. | no #### gcp > resource_attributes The `resource_attributes` block supports the following blocks: -Block | Description | Required ---------------------------------------- | --------------------------------------------------------------------------------------------------- | -------- -[cloud.account.id][res-attr-cfg] | Toggles the `cloud.account.id` resource attribute.
Sets `enabled` to `true` by default. | no -[cloud.availability_zone][res-attr-cfg] | Toggles the `cloud.availability_zone` resource attribute.
Sets `enabled` to `true` by default. | no -[cloud.platform][res-attr-cfg] | Toggles the `cloud.platform` resource attribute.
Sets `enabled` to `true` by default. | no -[cloud.provider][res-attr-cfg] | Toggles the `cloud.provider` resource attribute.
Sets `enabled` to `true` by default. | no -[cloud.region][res-attr-cfg] | Toggles the `cloud.region` resource attribute.
Sets `enabled` to `true` by default. | no -[faas.id][res-attr-cfg] | Toggles the `faas.id` resource attribute.
Sets `enabled` to `true` by default. | no -[faas.instance][res-attr-cfg] | Toggles the `faas.instance` resource attribute.
Sets `enabled` to `true` by default. | no -[faas.name][res-attr-cfg] | Toggles the `faas.name` resource attribute.
Sets `enabled` to `true` by default. | no -[faas.version][res-attr-cfg] | Toggles the `faas.version` resource attribute.
Sets `enabled` to `true` by default. | no -[gcp.cloud_run.job.execution][res-attr-cfg] | Toggles the `gcp.cloud_run.job.execution` resource attribute.
Sets `enabled` to `true` by default. | no -[gcp.cloud_run.job.task_index][res-attr-cfg] | Toggles the `gcp.cloud_run.job.task_index` resource attribute.
Sets `enabled` to `true` by default. | no -[gcp.gce.instance.hostname][res-attr-cfg] | Toggles the `gcp.gce.instance.hostname` resource attribute.
Sets `enabled` to `false` by default. | no -[gcp.gce.instance.name][res-attr-cfg] | Toggles the `gcp.gce.instance.name` resource attribute.
Sets `enabled` to `false` by default. | no -[host.id][res-attr-cfg] | Toggles the `host.id` resource attribute.
Sets `enabled` to `true` by default. | no -[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no -[host.type][res-attr-cfg] | Toggles the `host.type` resource attribute.
Sets `enabled` to `true` by default. | no -[k8s.cluster.name][res-attr-cfg] | Toggles the `k8s.cluster.name` resource attribute.
Sets `enabled` to `true` by default. | no +Block | Description | Required +---------------------------------------------|----------------------------------------------------------------------------------------------------------|--------- +[cloud.account.id][res-attr-cfg] | Toggles the `cloud.account.id` resource attribute.
Sets `enabled` to `true` by default. | no +[cloud.availability_zone][res-attr-cfg] | Toggles the `cloud.availability_zone` resource attribute.
Sets `enabled` to `true` by default. | no +[cloud.platform][res-attr-cfg] | Toggles the `cloud.platform` resource attribute.
Sets `enabled` to `true` by default. | no +[cloud.provider][res-attr-cfg] | Toggles the `cloud.provider` resource attribute.
Sets `enabled` to `true` by default. | no +[cloud.region][res-attr-cfg] | Toggles the `cloud.region` resource attribute.
Sets `enabled` to `true` by default. | no +[faas.id][res-attr-cfg] | Toggles the `faas.id` resource attribute.
Sets `enabled` to `true` by default. | no +[faas.instance][res-attr-cfg] | Toggles the `faas.instance` resource attribute.
Sets `enabled` to `true` by default. | no +[faas.name][res-attr-cfg] | Toggles the `faas.name` resource attribute.
Sets `enabled` to `true` by default. | no +[faas.version][res-attr-cfg] | Toggles the `faas.version` resource attribute.
Sets `enabled` to `true` by default. | no +[gcp.cloud_run.job.execution][res-attr-cfg] | Toggles the `gcp.cloud_run.job.execution` resource attribute.
Sets `enabled` to `true` by default. | no +[gcp.cloud_run.job.task_index][res-attr-cfg] | Toggles the `gcp.cloud_run.job.task_index` resource attribute.
Sets `enabled` to `true` by default. | no +[gcp.gce.instance.hostname][res-attr-cfg] | Toggles the `gcp.gce.instance.hostname` resource attribute.
Sets `enabled` to `false` by default. | no +[gcp.gce.instance.name][res-attr-cfg] | Toggles the `gcp.gce.instance.name` resource attribute.
Sets `enabled` to `false` by default. | no +[host.id][res-attr-cfg] | Toggles the `host.id` resource attribute.
Sets `enabled` to `true` by default. | no +[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no +[host.type][res-attr-cfg] | Toggles the `host.type` resource attribute.
Sets `enabled` to `true` by default. | no +[k8s.cluster.name][res-attr-cfg] | Toggles the `k8s.cluster.name` resource attribute.
Sets `enabled` to `true` by default. | no #### Google Compute Engine (GCE) metadata @@ -484,8 +484,8 @@ Block | Description * `host.id`: instance id * `host.name`: instance name; only when workload identity is disabled -One known issue happens when GKE workload identity is enabled. The GCE metadata endpoints won't be available, -and the GKE resource detector won't be able to determine `host.name`. +One known issue happens when GKE workload identity is enabled. The GCE metadata endpoints won't be available, +and the GKE resource detector won't be able to determine `host.name`. If this happens, you can set `host.name` from one of the following resources: - Get the `node.name` through the [downward API][] with the `env` detector. - Get the Kubernetes node name from the Kubernetes API (with `k8s.io/client-go`). @@ -540,24 +540,24 @@ The `heroku` block adds resource attributes derived from [Heroku dyno metadata][ The `heroku` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#heroku--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +----------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#heroku--resource_attributes) | Configures which resource attributes to add. | no #### heroku > resource_attributes The `resource_attributes` block supports the following blocks: -Block | Description | Required ---------------------------------------- | --------------------------------------------------------------------------------------------------- | -------- -[cloud.provider][res-attr-cfg] | Toggles the `cloud.provider` resource attribute.
Sets `enabled` to `true` by default. | no -[heroku.app.id][res-attr-cfg] | Toggles the `heroku.app.id` resource attribute.
Sets `enabled` to `true` by default. | no -[heroku.dyno.id][res-attr-cfg] | Toggles the `heroku.dyno.id` resource attribute.
Sets `enabled` to `true` by default. | no -[heroku.release.commit][res-attr-cfg] | Toggles the `heroku.release.commit` resource attribute.
Sets `enabled` to `true` by default. | no -[heroku.release.creation_timestamp][res-attr-cfg] | Toggles the `heroku.release.creation_timestamp` resource attribute.
Sets `enabled` to `true` by default. | no -[service.instance.id][res-attr-cfg] | Toggles the `service.instance.id` resource attribute.
Sets `enabled` to `true` by default. | no -[service.name][res-attr-cfg] | Toggles the `service.name` resource attribute.
Sets `enabled` to `true` by default. | no -[service.version][res-attr-cfg] | Toggles the `service.version` resource attribute.
Sets `enabled` to `true` by default. | no +Block | Description | Required +--------------------------------------------------|---------------------------------------------------------------------------------------------------------------|--------- +[cloud.provider][res-attr-cfg] | Toggles the `cloud.provider` resource attribute.
Sets `enabled` to `true` by default. | no +[heroku.app.id][res-attr-cfg] | Toggles the `heroku.app.id` resource attribute.
Sets `enabled` to `true` by default. | no +[heroku.dyno.id][res-attr-cfg] | Toggles the `heroku.dyno.id` resource attribute.
Sets `enabled` to `true` by default. | no +[heroku.release.commit][res-attr-cfg] | Toggles the `heroku.release.commit` resource attribute.
Sets `enabled` to `true` by default. | no +[heroku.release.creation_timestamp][res-attr-cfg] | Toggles the `heroku.release.creation_timestamp` resource attribute.
Sets `enabled` to `true` by default. | no +[service.instance.id][res-attr-cfg] | Toggles the `service.instance.id` resource attribute.
Sets `enabled` to `true` by default. | no +[service.name][res-attr-cfg] | Toggles the `service.name` resource attribute.
Sets `enabled` to `true` by default. | no +[service.version][res-attr-cfg] | Toggles the `service.version` resource attribute.
Sets `enabled` to `true` by default. | no When [Heroku dyno metadata][] is active, Heroku applications publish information through environment variables. We map these environment variables to resource attributes as follows: @@ -594,12 +594,12 @@ Attribute | Type | Description `hostname_sources` | `list(string)` | A priority list of sources from which the hostname will be fetched. | `["dns", "os"]` | no The valid options for `hostname_sources` are: -* `"dns"`: Uses multiple sources to get the fully qualified domain name. -Firstly, it looks up the host name in the local machine's `hosts` file. If that fails, it looks up the CNAME. -Lastly, if that fails, it does a reverse DNS query. Note: this hostname source may produce unreliable results on Windows. +* `"dns"`: Uses multiple sources to get the fully qualified domain name. +Firstly, it looks up the host name in the local machine's `hosts` file. If that fails, it looks up the CNAME. +Lastly, if that fails, it does a reverse DNS query. Note: this hostname source may produce unreliable results on Windows. To produce a FQDN, Windows hosts might have better results using the "lookup" hostname source, which is mentioned below. * `"os"`: Provides the hostname provided by the local machine's kernel. -* `"cname"`: Provides the canonical name, as provided by `net.LookupCNAME` in the Go standard library. +* `"cname"`: Provides the canonical name, as provided by `net.LookupCNAME` in the Go standard library. Note: this hostname source may produce unreliable results on Windows. * `"lookup"`: Does a reverse DNS lookup of the current host's IP address. @@ -607,27 +607,27 @@ In case of an error in fetching a hostname from a source, the next source from t The `system` block supports the following blocks: -Block | Description | Required ----------------------------------------------- | ------------------------------------------------- | -------- -[resource_attributes](#system--resource_attributes) | Configures which resource attributes to add. | no +Block | Description | Required +----------------------------------------------------|----------------------------------------------|--------- +[resource_attributes](#system--resource_attributes) | Configures which resource attributes to add. | no #### system > resource_attributes The `resource_attributes` block supports the following blocks: -Block | Description | Required ---------------------------------------- | --------------------------------------------------------------------------------------------------- | -------- -[host.arch][res-attr-cfg] | Toggles the `host.arch` resource attribute.
Sets `enabled` to `false` by default. | no -[host.cpu.cache.l2.size][res-attr-cfg] | Toggles the `host.cpu.cache.l2.size` resource attribute.
Sets `enabled` to `false` by default. | no +Block | Description | Required +---------------------------------------|-----------------------------------------------------------------------------------------------------|--------- +[host.arch][res-attr-cfg] | Toggles the `host.arch` resource attribute.
Sets `enabled` to `false` by default. | no +[host.cpu.cache.l2.size][res-attr-cfg] | Toggles the `host.cpu.cache.l2.size` resource attribute.
Sets `enabled` to `false` by default. | no [host.cpu.family][res-attr-cfg] | Toggles the `host.cpu.family` resource attribute.
Sets `enabled` to `false` by default. | no -[host.cpu.model.id][res-attr-cfg] | Toggles the `host.cpu.model.id` resource attribute.
Sets `enabled` to `false` by default. | no -[host.cpu.model.name][res-attr-cfg] | Toggles the `host.cpu.model.name` resource attribute.
Sets `enabled` to `false` by default. | no -[host.cpu.stepping][res-attr-cfg] | Toggles the `host.cpu.stepping` resource attribute.
Sets `enabled` to `false` by default. | no -[host.cpu.vendor.id][res-attr-cfg] | Toggles the `host.cpu.vendor.id` resource attribute.
Sets `enabled` to `false` by default. | no -[host.id][res-attr-cfg] | Toggles the `host.id` resource attribute.
Sets `enabled` to `false` by default. | no -[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no -[os.description][res-attr-cfg] | Toggles the `os.description` resource attribute.
Sets `enabled` to `false` by default. | no -[os.type][res-attr-cfg] | Toggles the `os.type` resource attribute.
Sets `enabled` to `true` by default. | no +[host.cpu.model.id][res-attr-cfg] | Toggles the `host.cpu.model.id` resource attribute.
Sets `enabled` to `false` by default. | no +[host.cpu.model.name][res-attr-cfg] | Toggles the `host.cpu.model.name` resource attribute.
Sets `enabled` to `false` by default. | no +[host.cpu.stepping][res-attr-cfg] | Toggles the `host.cpu.stepping` resource attribute.
Sets `enabled` to `false` by default. | no +[host.cpu.vendor.id][res-attr-cfg] | Toggles the `host.cpu.vendor.id` resource attribute.
Sets `enabled` to `false` by default. | no +[host.id][res-attr-cfg] | Toggles the `host.id` resource attribute.
Sets `enabled` to `false` by default. | no +[host.name][res-attr-cfg] | Toggles the `host.name` resource attribute.
Sets `enabled` to `true` by default. | no +[os.description][res-attr-cfg] | Toggles the `os.description` resource attribute.
Sets `enabled` to `false` by default. | no +[os.type][res-attr-cfg] | Toggles the `os.type` resource attribute.
Sets `enabled` to `true` by default. | no ### openshift @@ -652,9 +652,9 @@ rules: verbs: ["get", "watch", "list"] ``` -By default, the API address is determined from the environment variables `KUBERNETES_SERVICE_HOST`, -`KUBERNETES_SERVICE_PORT` and the service token is read from `/var/run/secrets/kubernetes.io/serviceaccount/token`. -If TLS is not explicitly disabled and no `ca_file` is configured, `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt` is used. +By default, the API address is determined from the environment variables `KUBERNETES_SERVICE_HOST`, +`KUBERNETES_SERVICE_PORT` and the service token is read from `/var/run/secrets/kubernetes.io/serviceaccount/token`. +If TLS is not explicitly disabled and no `ca_file` is configured, `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt` is used. The determination of the API address, `ca_file`, and the service token is skipped if they are set in the configuration. The `openshift` block supports the following blocks: @@ -708,7 +708,7 @@ rules: `auth_type` can be set to one of the following: * `none`: no authentication. -* `serviceAccount`: use the standard service account token provided to the agent pod. +* `serviceAccount`: use the standard service account token provided to the {{< param "PRODUCT_ROOT_NAME" >}} pod. * `kubeConfig`: use credentials from `~/.kube/config`. The `kubernetes_node` block supports the following blocks: @@ -731,9 +731,9 @@ Block | Description ### Resource attribute config This block describes how to configure resource attributes such as `k8s.node.name` and `azure.vm.name`. -Every block is configured using the same set of attributes. +Every block is configured using the same set of attributes. Only the default values for those attributes might differ across resource attributes. -For example, some resource attributes have `enabled` set to `true` by default, whereas others do not. +For example, some resource attributes have `enabled` set to `true` by default, whereas others don't. The following attributes are supported: @@ -770,7 +770,7 @@ configuration. ## Debug information -`otelcol.processor.resourcedetection` does not expose any component-specific debug +`otelcol.processor.resourcedetection` doesn't expose any component-specific debug information. ## Examples @@ -778,7 +778,7 @@ information. ### env detector If you set up a `OTEL_RESOURCE_ATTRIBUTES` environment variable with value of `TestKey=TestValue`, -then all logs, metrics, and traces will have a resource attribute with a key `TestKey` and value of `TestValue`. +then all logs, metrics, and traces have a resource attribute with a key `TestKey` and value of `TestValue`. ```river otelcol.processor.resourcedetection "default" { @@ -795,7 +795,7 @@ otelcol.processor.resourcedetection "default" { ### env and ec2 There is no need to put in an `ec2 {}` River block. -The `ec2` defaults will be applied automatically, as specified in [ec2][]. +The `ec2` defaults are applied automatically, as specified in [ec2][]. ```river otelcol.processor.resourcedetection "default" { @@ -812,7 +812,7 @@ otelcol.processor.resourcedetection "default" { ### ec2 with default resource attributes There is no need to put in a `ec2 {}` River block. -The `ec2` defaults will be applied automatically, as specified in [ec2][]. +The `ec2` defaults are applied automatically, as specified in [ec2][]. ```river otelcol.processor.resourcedetection "default" { @@ -859,7 +859,7 @@ otelcol.processor.resourcedetection "default" { This example uses the default `node_from_env_var` option of `K8S_NODE_NAME`. There is no need to put in a `kubernetes_node {}` River block. -The `kubernetes_node` defaults will be applied automatically, as specified in [kubernetes_node][]. +The `kubernetes_node` defaults are applied automatically, as specified in [kubernetes_node][]. ```river otelcol.processor.resourcedetection "default" { diff --git a/docs/sources/flow/reference/components/prometheus.exporter.agent.md b/docs/sources/flow/reference/components/prometheus.exporter.agent.md index cb2dd5cda361..511be5217334 100644 --- a/docs/sources/flow/reference/components/prometheus.exporter.agent.md +++ b/docs/sources/flow/reference/components/prometheus.exporter.agent.md @@ -8,7 +8,8 @@ title: prometheus.exporter.agent --- # prometheus.exporter.agent -The `prometheus.exporter.agent` component collects and exposes metrics about the agent itself. + +The `prometheus.exporter.agent` component collects and exposes metrics about {{< param "PRODUCT_NAME" >}} itself. ## Usage @@ -18,6 +19,7 @@ prometheus.exporter.agent "agent" { ``` ## Arguments + `prometheus.exporter.agent` accepts no arguments. ## Exported fields @@ -31,12 +33,12 @@ an invalid configuration. ## Debug information -`prometheus.exporter.agent` does not expose any component-specific +`prometheus.exporter.agent` doesn't expose any component-specific debug information. ## Debug metrics -`prometheus.exporter.agent` does not expose any component-specific +`prometheus.exporter.agent` doesn't expose any component-specific debug metrics. ## Example diff --git a/docs/sources/flow/reference/components/prometheus.exporter.snmp.md b/docs/sources/flow/reference/components/prometheus.exporter.snmp.md index 1e69da7fb941..85b3d6a895bd 100644 --- a/docs/sources/flow/reference/components/prometheus.exporter.snmp.md +++ b/docs/sources/flow/reference/components/prometheus.exporter.snmp.md @@ -40,7 +40,8 @@ Omitted fields take their default values. | `config_file` | `string` | SNMP configuration file defining custom modules. | | no | | `config` | `string` or `secret` | SNMP configuration as inline string. | | no | -The `config_file` argument points to a YAML file defining which snmp_exporter modules to use. See [snmp_exporter](https://github.com/prometheus/snmp_exporter#generating-configuration) for details on how to generate a config file. +The `config_file` argument points to a YAML file defining which snmp_exporter modules to use. +Refer to [snmp_exporter](https://github.com/prometheus/snmp_exporter#generating-configuration) for details on how to generate a configuration file. The `config` argument must be a YAML document as string defining which SNMP modules and auths to use. `config` is typically loaded by using the exports of another component. For example, diff --git a/docs/sources/flow/reference/components/prometheus.exporter.windows.md b/docs/sources/flow/reference/components/prometheus.exporter.windows.md index 8042b5458d1c..fc16fed3230d 100644 --- a/docs/sources/flow/reference/components/prometheus.exporter.windows.md +++ b/docs/sources/flow/reference/components/prometheus.exporter.windows.md @@ -14,12 +14,13 @@ The `prometheus.exporter.windows` component embeds [windows_exporter](https://github.com/prometheus-community/windows_exporter) which exposes a wide variety of hardware and OS metrics for Windows-based systems. -The `windows_exporter` itself comprises various _collectors_, which can be -enabled and disabled at will. For more information on collectors, refer to the -[`collectors-list`](#collectors-list) section. +The `windows_exporter` itself comprises various _collectors_, which you can enable and disable as needed. +For more information on collectors, refer to the [`collectors-list`](#collectors-list) section. -**Note** The black and white list config options are available for backwards compatibility but are deprecated. The include -and exclude config options are preferred going forward. +{{% admonition type="note" %}} +The black and white list configuration options are available for backwards compatibility but are deprecated. +The include and exclude configuration options are preferred going forward. +{{% /admonition %}} ## Usage @@ -29,17 +30,18 @@ prometheus.exporter.windows "LABEL" { ``` ## Arguments + The following arguments can be used to configure the exporter's behavior. All arguments are optional. Omitted fields take their default values. -| Name | Type | Description | Default | Required | -|----------------------|------------------|-------------------------------------------|---------|----------| -| `enabled_collectors` | `list(string)` | List of collectors to enable. | `["cpu","cs","logical_disk","net","os","service","system"]` | no | -| `timeout` | `duration` | Configure timeout for collecting metrics. | `4m` | no | +| Name | Type | Description | Default | Required | +|----------------------|----------------|-------------------------------------------|-------------------------------------------------------------|----------| +| `enabled_collectors` | `list(string)` | List of collectors to enable. | `["cpu","cs","logical_disk","net","os","service","system"]` | no | +| `timeout` | `duration` | Configure timeout for collecting metrics. | `4m` | no | -`enabled_collectors` defines a hand-picked list of enabled-by-default -collectors. If set, anything not provided in that list is disabled by -default. See the [Collectors list](#collectors-list) for the default set. +`enabled_collectors` defines a hand-picked list of enabled-by-default collectors. +If set, anything not provided in that list is disabled by default. +Refer to the [Collectors list](#collectors-list) for the default set. ## Blocks @@ -75,15 +77,17 @@ text_file | [text_file][] | Configures the text_file collector. | [text_file]: #textfile-block ### dfsr block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- + +Name | Type | Description | Default | Required +-----------------|----------------|------------------------------------------------------|------------------------------------|--------- `source_enabled` | `list(string)` | Comma-separated list of DFSR Perflib sources to use. | `["connection","folder","volume"]` | no ### exchange block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- -`enabled_list` | `string` | Comma-separated list of collectors to use. | `""` | no + +Name | Type | Description | Default | Required +---------------|----------|--------------------------------------------|---------|--------- +`enabled_list` | `string` | Comma-separated list of collectors to use. | `""` | no The collectors specified by `enabled_list` can include the following: @@ -101,86 +105,96 @@ For example, `enabled_list` may be set to `"AvailabilityService,OutlookWebAccess ### iis block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- -`app_exclude` | `string` | Regular expression of applications to ignore. | `""` | no -`app_include` | `string` | Regular expression of applications to report on. | `".*"` | no -`site_exclude` | `string` | Regular expression of sites to ignore. | `""` | no -`site_include` | `string` | Regular expression of sites to report on. | `".*"` | no + +Name | Type | Description | Default | Required +---------------|----------|--------------------------------------------------|---------|--------- +`app_exclude` | `string` | Regular expression of applications to ignore. | `""` | no +`app_include` | `string` | Regular expression of applications to report on. | `".*"` | no +`site_exclude` | `string` | Regular expression of sites to ignore. | `""` | no +`site_include` | `string` | Regular expression of sites to report on. | `".*"` | no ### logical_disk block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- -`exclude` | `string` | Regular expression of volumes to exclude. | `""` | no -`include` | `string` | Regular expression of volumes to include. | `".+"` | no + +Name | Type | Description | Default | Required +----------|----------|-------------------------------------------|---------|--------- +`exclude` | `string` | Regular expression of volumes to exclude. | `""` | no +`include` | `string` | Regular expression of volumes to include. | `".+"` | no Volume names must match the regular expression specified by `include` and must _not_ match the regular expression specified by `exclude` to be included. ### msmq block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- -`where_clause` | `string` | WQL 'where' clause to use in WMI metrics query. | `""` | no + +Name | Type | Description | Default | Required +---------------|----------|-------------------------------------------------|---------|--------- +`where_clause` | `string` | WQL 'where' clause to use in WMI metrics query. | `""` | no Specifying `enabled_classes` is useful to limit the response to the MSMQs you specify, reducing the size of the response. ### mssql block + Name | Type | Description | Default | Required ---- |----------| ----------- | ------- | -------- `enabled_classes` | `list(string)` | Comma-separated list of MSSQL WMI classes to use. | `["accessmethods", "availreplica", "bufman", "databases", "dbreplica", "genstats", "locks", "memmgr", "sqlstats", "sqlerrorstransactions"]` | no ### network block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- -`exclude` | `string` | Regular expression of NIC:s to exclude. | `""` | no -`include` | `string` | Regular expression of NIC:s to include. | `".*"` | no + +Name | Type | Description | Default | Required +----------|----------|-----------------------------------------|---------|--------- +`exclude` | `string` | Regular expression of NIC:s to exclude. | `""` | no +`include` | `string` | Regular expression of NIC:s to include. | `".*"` | no NIC names must match the regular expression specified by `include` and must _not_ match the regular expression specified by `exclude` to be included. ### process block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- -`exclude` | `string` | Regular expression of processes to exclude. | `""` | no -`include` | `string` | Regular expression of processes to include. | `".*"` | no + +Name | Type | Description | Default | Required +----------|----------|---------------------------------------------|---------|--------- +`exclude` | `string` | Regular expression of processes to exclude. | `""` | no +`include` | `string` | Regular expression of processes to include. | `".*"` | no Processes must match the regular expression specified by `include` and must _not_ match the regular expression specified by `exclude` to be included. ### scheduled_task block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- -`exclude` | `string` | Regexp of tasks to exclude. | `""` | no -`include` | `string` | Regexp of tasks to include. | `".+"` | no + +Name | Type | Description | Default | Required +----------|----------|-----------------------------|---------|--------- +`exclude` | `string` | Regexp of tasks to exclude. | `""` | no +`include` | `string` | Regexp of tasks to include. | `".+"` | no For a server name to be included, it must match the regular expression specified by `include` and must _not_ match the regular expression specified by `exclude`. ### service block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- -`use_api` | `string` | Use API calls to collect service data instead of WMI. | `false` | no -`where_clause` | `string` | WQL 'where' clause to use in WMI metrics query. | `""` | no + +Name | Type | Description | Default | Required +---------------|----------|-------------------------------------------------------|---------|--------- +`use_api` | `string` | Use API calls to collect service data instead of WMI. | `false` | no +`where_clause` | `string` | WQL 'where' clause to use in WMI metrics query. | `""` | no The `where_clause` argument can be used to limit the response to the services you specify, reducing the size of the response. If `use_api` is enabled, 'where_clause' won't be effective. ### smtp block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- -`exclude` | `string` | Regexp of virtual servers to ignore. | | no -`include` | `string` | Regexp of virtual servers to include. | `".+"` | no + +Name | Type | Description | Default | Required +----------|----------|---------------------------------------|---------|--------- +`exclude` | `string` | Regexp of virtual servers to ignore. | | no +`include` | `string` | Regexp of virtual servers to include. | `".+"` | no For a server name to be included, it must match the regular expression specified by `include` and must _not_ match the regular expression specified by `exclude`. ### text_file block -Name | Type | Description | Default | Required ----- |----------| ----------- | ------- | -------- + +Name | Type | Description | Default | Required +----------------------|----------|----------------------------------------------------|-------------------------------------------------------|--------- `text_file_directory` | `string` | The directory containing the files to be ingested. | `C:\Program Files\Grafana Agent Flow\textfile_inputs` | no When `text_file_directory` is set, only files with the extension `.prom` inside the specified directory are read. Each `.prom` file found must end with an empty line feed to work properly. @@ -270,11 +284,11 @@ Name | Description | Enabled by default [vmware_blast](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.vmware_blast.md) | VMware Blast session metrics | [vmware](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.vmware.md) | Performance counters installed by the Vmware Guest agent | -See the linked documentation on each collector for more information on reported metrics, configuration settings and usage examples. +Refer to the linked documentation on each collector for more information on reported metrics, configuration settings and usage examples. {{% admonition type="caution" %}} -Certain collectors will cause {{< param "PRODUCT_ROOT_NAME" >}} to crash if those collectors are used and the required infrastructure is not installed. -These include but are not limited to mscluster_*, vmware, nps, dns, msmq, teradici_pcoip, ad, hyperv, and scheduled_task. +Certain collectors will cause {{< param "PRODUCT_ROOT_NAME" >}} to crash if those collectors are used and the required infrastructure isn't installed. +These include but aren't limited to mscluster_*, vmware, nps, dns, msmq, teradici_pcoip, ad, hyperv, and scheduled_task. {{% /admonition %}} ## Example diff --git a/docs/sources/flow/tasks/estimate-resource-usage.md b/docs/sources/flow/tasks/estimate-resource-usage.md index e7b066d9e8ee..d57b55a8f5a1 100644 --- a/docs/sources/flow/tasks/estimate-resource-usage.md +++ b/docs/sources/flow/tasks/estimate-resource-usage.md @@ -4,7 +4,7 @@ aliases: - /docs/grafana-cloud/agent/flow/tasks/estimate-resource-usage/ - /docs/grafana-cloud/monitor-infrastructure/agent/flow/tasks/estimate-resource-usage/ - /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/tasks/estimate-resource-usage/ - - /docs/grafana-cloud/send-data/agent/flow/tasks/estimate-resource-usage/ + - /docs/grafana-cloud/send-data/agent/flow/tasks/estimate-resource-usage/ # Previous page aliases for backwards compatibility: - /docs/agent/flow/monitoring/resource-usage/ - /docs/grafana-cloud/agent/flow/monitoring/resource-usage/ @@ -13,7 +13,7 @@ aliases: - /docs/grafana-cloud/send-data/agent/flow/monitoring/resource-usage/ - ../monitoring/resource-usage/ # /docs/agent/latest/flow/monitoring/resource-usage/ canonical: https://grafana.com/docs/agent/latest/flow/monitoring/resource-usage/ -description: Estimate expected Agent resource usage +description: Estimate expected Grafana Agent resource usage headless: true title: Estimate resource usage menuTitle: Estimate resource usage @@ -22,13 +22,13 @@ weight: 190 # Estimate {{% param "PRODUCT_NAME" %}} resource usage -This page provides guidance for expected resource usage of -{{% param "PRODUCT_NAME" %}} for each telemetry type, based on operational +This page provides guidance for expected resource usage of +{{% param "PRODUCT_NAME" %}} for each telemetry type, based on operational experience of some of the {{% param "PRODUCT_NAME" %}} maintainers. {{% admonition type="note" %}} -The resource usage depends on the workload, hardware and the configuration used. +The resource usage depends on the workload, hardware, and the configuration used. The information on this page is a good starting point for most users, but your actual usage may be different. @@ -39,7 +39,7 @@ actual usage may be different. The Prometheus metrics resource usage depends mainly on the number of active series that need to be scraped and the scrape interval. -As a rule of thumb, **per each 1 million active series** and with the default +As a rule of thumb, **per each 1 million active series** and with the default scrape interval, you can expect to use approximately: * 0.4 CPU cores diff --git a/docs/sources/flow/tasks/migrate/from-promtail.md b/docs/sources/flow/tasks/migrate/from-promtail.md index 182dec857c3b..2e7533bdafd0 100644 --- a/docs/sources/flow/tasks/migrate/from-promtail.md +++ b/docs/sources/flow/tasks/migrate/from-promtail.md @@ -213,7 +213,7 @@ After the configuration is converted, review the {{< param "PRODUCT_NAME" >}} co The following list is specific to the convert command and not {{< param "PRODUCT_NAME" >}}: * Check if you are using any extra command line arguments with Promtail that aren't present in your configuration file. For example, `-max-line-size`. -* Check if you are setting any environment variables, whether [expanded in the config file][] itself or consumed directly by Promtail, such as `JAEGER_AGENT_HOST`. +* Check if you are setting any environment variables, whether [expanded in the configuration file][] itself or consumed directly by Promtail, such as `JAEGER_AGENT_HOST`. * In {{< param "PRODUCT_NAME" >}}, the positions file is saved at a different location. Refer to the [loki.source.file][] documentation for more details. Check if you have any existing setup, for example, a Kubernetes Persistent Volume, that you must update to use the new positions file path. @@ -224,7 +224,7 @@ The following list is specific to the convert command and not {{< param "PRODUCT [Promtail]: https://www.grafana.com/docs/loki//clients/promtail/ [debugging]: #debugging -[expanded in the config file]: https://www.grafana.com/docs/loki//clients/promtail/configuration/#use-environment-variables-in-the-configuration +[expanded in the configuration file]: https://www.grafana.com/docs/loki//clients/promtail/configuration/#use-environment-variables-in-the-configuration {{% docs/reference %}} [local.file_match]: "/docs/agent/ -> /docs/agent//flow/reference/components/local.file_match.md" diff --git a/docs/sources/flow/tutorials/flow-by-example/first-components-and-stdlib/index.md b/docs/sources/flow/tutorials/flow-by-example/first-components-and-stdlib/index.md index 6b13394ad0f0..465caab75d03 100644 --- a/docs/sources/flow/tutorials/flow-by-example/first-components-and-stdlib/index.md +++ b/docs/sources/flow/tutorials/flow-by-example/first-components-and-stdlib/index.md @@ -5,7 +5,7 @@ aliases: - /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/tutorials/flow-by-example/first-components-and-stdlib/ - /docs/grafana-cloud/send-data/agent/flow/tutorials/first-components-and-stdlib/ canonical: https://grafana.com/docs/agent/latest/flow/tutorials/flow-by-example/first-components-and-stdlib/ -description: Learn about the basics of River and the Flow configuration language +description: Learn about the basics of River and the configuration language title: First components and introducing the standard library weight: 20 --- @@ -16,7 +16,7 @@ This tutorial covers the basics of the River language and the standard library. ## River basics -[Configuration language]: https://grafana.com/docs/agent//flow/config-language/ +[Configuration language]: https://grafana.com/docs/agent//flow/concepts/config-language/ [Configuration language concepts]: https://grafana.com/docs/agent//flow/concepts/configuration_language/ [Standard library documentation]: https://grafana.com/docs/agent//flow/reference/stdlib/ @@ -66,7 +66,7 @@ Comments in River are prefixed with `//` and are single-line only. For example: [Components]: https://grafana.com/docs/agent//flow/concepts/components/ [Component controller]: https://grafana.com/docs/agent//flow/concepts/component_controller/ -[Components configuration language]: https://grafana.com/docs/agent//flow/config-language/components/ +[Components configuration language]: https://grafana.com/docs/agent//flow/concepts/config-language/components/ [env]: https://grafana.com/docs/agent//flow/reference/stdlib/env/ **Recommended reading** @@ -99,7 +99,7 @@ prometheus.remote_write "local_prom" { {{% admonition type="note" %}} [Component reference]: https://grafana.com/docs/agent//flow/reference/components/ -A list of all available components can be found in the [Component reference][]. Each component has a link to its documentation, which contains a description of what the component does, its arguments, its exports, and Example(s). +A list of all available components can be found in the [Component reference][]. Each component has a link to its documentation, which contains a description of what the component does, its arguments, its exports, and examples. {{% /admonition %}} This pipeline has two components: `local.file` and `prometheus.remote_write`. The `local.file` component is configured with a single argument, `path`, which is set by calling the [env][] standard library function to retrieve the value of the `HOME` environment variable and concatenating it with the string `"file.txt"`. The `local.file` component has a single export, `content`, which contains the contents of the file. @@ -116,7 +116,7 @@ The `local.file` component's label is set to `"example"`, so the fully qualified This example pipeline still doesn't do anything, so let's add some more components to it. -## Shipping our first metrics +## Shipping your first metrics [prometheus.exporter.unix]: https://grafana.com/docs/agent//flow/reference/components/prometheus.exporter.unix/ [prometheus.scrape]: https://grafana.com/docs/agent//flow/reference/components/prometheus.scrape/ @@ -128,10 +128,10 @@ This example pipeline still doesn't do anything, so let's add some more componen - Optional: [prometheus.scrape][] - Optional: [prometheus.remote_write][] -Let's make a simple pipeline with a `prometheus.exporter.unix` component, a `prometheus.scrape` component to scrape it, and a `prometheus.remote_write` component to send the scraped metrics to Prometheus. +Make a simple pipeline with a `prometheus.exporter.unix` component, a `prometheus.scrape` component to scrape it, and a `prometheus.remote_write` component to send the scraped metrics to Prometheus. ```river -prometheus.exporter.unix "localhost" { +prometheus.exporter.unix "localhost" { // This component exposes a lot of metrics by default, so we will keep all of the default arguments. } @@ -152,7 +152,7 @@ prometheus.remote_write "local_prom" { } ``` -Run the agent with: +Run {{< param "PRODUCT_NAME" >}} with: ```bash /path/to/agent run config.river @@ -166,13 +166,13 @@ Navigate to [http://localhost:3000/explore](http://localhost:3000/explore) in yo ## Visualizing the relationship between components -Let's look at an example pipeline: +The following diagram is an example pipeline:

Flow of example pipeline with a prometheus.scrape, prometheus.exporter.unix, and prometheus.remote_write components

-The above configuration defines three components: +The preceding configuration defines three components: - `prometheus.scrape` - A component that scrapes metrics from components that export targets. - `prometheus.exporter.unix` - A component that exports metrics from the host, built around [node_exporter](https://github.com/prometheus/node_exporter). @@ -180,7 +180,7 @@ The above configuration defines three components: The `prometheus.scrape` component references the `prometheus.exporter.unix` component's targets export, which is a list of scrape targets. The `prometheus.scrape` component then forwards the scraped metrics to the `prometheus.remote_write` component. -One rule is that components cannot form a cycle. This means that a component cannot reference itself directly or indirectly. This is to prevent infinite loops from forming in the pipeline. +One rule is that components can't form a cycle. This means that a component can't reference itself directly or indirectly. This is to prevent infinite loops from forming in the pipeline. ## Exercise for the reader @@ -190,13 +190,13 @@ One rule is that components cannot form a cycle. This means that a component can - Optional: [prometheus.exporter.redis][] -Let's start a container running Redis and configure the agent to scrape metrics from it. +Let's start a container running Redis and configure {{< param "PRODUCT_NAME" >}} to scrape metrics from it. ```bash docker container run -d --name flow-redis -p 6379:6379 --rm redis ``` -Try modifying the above pipeline to scrape metrics from the Redis exporter. You can refer to the [prometheus.exporter.redis][] component documentation for more information on how to configure it. +Try modifying the pipeline to scrape metrics from the Redis exporter. You can refer to the [prometheus.exporter.redis][] component documentation for more information on how to configure it. To give a visual hint, you want to create a pipeline that looks like this: @@ -210,13 +210,13 @@ To give a visual hint, you want to create a pipeline that looks like this: You may find the [concat][] standard library function useful. {{% /admonition %}} -You can run the agent with the new config file by running: +You can run {{< param "PRODUCT_NAME" >}} with the new configuration file by running: ```bash /path/to/agent run config.river ``` -Navigate to [http://localhost:3000/explore](http://localhost:3000/explore) in your browser. After the first scrape, you should be able to query for `redis` metrics as well as `node` metrics! +Navigate to [http://localhost:3000/explore](http://localhost:3000/explore) in your browser. After the first scrape, you should be able to query for `redis` metrics as well as `node` metrics. To shut down the Redis container, run: @@ -228,7 +228,7 @@ If you get stuck, you can always view a solution here: {{< collapse title="Solution" >}} ```river -// Configure your first components, learn about the standard library, and learn how to run the Agent! +// Configure your first components, learn about the standard library, and learn how to run Grafana Agent // prometheus.exporter.redis collects information about Redis and exposes // targets for other components to use @@ -267,8 +267,8 @@ prometheus.remote_write "local_prom" { ## Finishing up and next steps -You might have noticed that running the agent with the above configurations created a directory called `data-agent` in the directory you ran the agent from. This directory is where components can store data, such as the `prometheus.exporter.unix` component storing its WAL (Write Ahead Log). If you look in the directory, do you notice anything interesting? The directory for each component is the fully-qualified name! +You might have noticed that running {{< param "PRODUCT_NAME" >}} with the configurations created a directory called `data-agent` in the directory you ran {{< param "PRODUCT_NAME" >}} from. This directory is where components can store data, such as the `prometheus.exporter.unix` component storing its WAL (Write Ahead Log). If you look in the directory, do you notice anything interesting? The directory for each component is the fully qualified name. -If you'd like to store the data elsewhere, you can specify a different directory by supplying the `--storage.path` flag to the agent's run command, for example, `/path/to/agent run config.river --storage.path /etc/grafana-agent`. Generally, you will want to use a persistent directory for this, as some components may use the data stored in this directory to perform their function. +If you'd like to store the data elsewhere, you can specify a different directory by supplying the `--storage.path` flag to {{< param "PRODUCT_ROOT_NAME" >}}'s run command, for example, `/path/to/agent run config.river --storage.path /etc/grafana-agent`. Generally, you can use a persistent directory for this, as some components may use the data stored in this directory to perform their function. -In the next tutorial, we will look at how to configure the agent to collect logs from a file and send them to Loki. We will also look at using different components to process metrics and logs before sending them. +In the next tutorial, you will look at how to configure {{< param "PRODUCT_NAME" >}} to collect logs from a file and send them to Loki. You will also look at using different components to process metrics and logs before sending them. From 007070d62ffb3aa69a753ee9e666f7f7057641de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90=E1=BB=97=20Tr=E1=BB=8Dng=20H=E1=BA=A3i?= <41283691+hainenber@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:09:56 +0700 Subject: [PATCH 3/3] feat(mimir/ruler/k8s): configurable path prefix for Mimir's Prometheus API endpoint (#6168) * feat(mimir/ruler/k8s): configurable path prefix for Mimir's Prometheus API endpoint --------- Signed-off-by: hainenber Co-authored-by: Paulin Todev Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- CHANGELOG.md | 3 + component/mimir/rules/kubernetes/rules.go | 9 +-- component/mimir/rules/kubernetes/types.go | 2 + .../components/mimir.rules.kubernetes.md | 32 +++++---- pkg/mimir/client/client.go | 23 +++--- pkg/mimir/client/client_test.go | 7 ++ pkg/mimir/client/rules_test.go | 72 +++++++++++-------- 7 files changed, 91 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb554b99a3e5..4afe6f062000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,9 @@ Main (unreleased) - Increased clustering alert periods to 10 minutes to improve the signal-to-noise ratio in Grafana Agent Mixin. (@thampiotr) + +- `mimir.rules.kubernetes` has a new `prometheus_http_prefix` argument to configure + the HTTP endpoint on which to connect to Mimir's API. (@hainenber) ### Bugfixes diff --git a/component/mimir/rules/kubernetes/rules.go b/component/mimir/rules/kubernetes/rules.go index 016a888d9104..14765a865095 100644 --- a/component/mimir/rules/kubernetes/rules.go +++ b/component/mimir/rules/kubernetes/rules.go @@ -261,10 +261,11 @@ func (c *Component) init() error { httpClient := c.args.HTTPClientConfig.Convert() c.mimirClient, err = mimirClient.New(c.log, mimirClient.Config{ - ID: c.args.TenantID, - Address: c.args.Address, - UseLegacyRoutes: c.args.UseLegacyRoutes, - HTTPClientConfig: *httpClient, + ID: c.args.TenantID, + Address: c.args.Address, + UseLegacyRoutes: c.args.UseLegacyRoutes, + PrometheusHTTPPrefix: c.args.PrometheusHTTPPrefix, + HTTPClientConfig: *httpClient, }, c.metrics.mimirClientTiming) if err != nil { return err diff --git a/component/mimir/rules/kubernetes/types.go b/component/mimir/rules/kubernetes/types.go index d8e2445e5bf2..390a4f6a4124 100644 --- a/component/mimir/rules/kubernetes/types.go +++ b/component/mimir/rules/kubernetes/types.go @@ -11,6 +11,7 @@ type Arguments struct { Address string `river:"address,attr"` TenantID string `river:"tenant_id,attr,optional"` UseLegacyRoutes bool `river:"use_legacy_routes,attr,optional"` + PrometheusHTTPPrefix string `river:"prometheus_http_prefix,attr,optional"` HTTPClientConfig config.HTTPClientConfig `river:",squash"` SyncInterval time.Duration `river:"sync_interval,attr,optional"` MimirNameSpacePrefix string `river:"mimir_namespace_prefix,attr,optional"` @@ -23,6 +24,7 @@ var DefaultArguments = Arguments{ SyncInterval: 30 * time.Second, MimirNameSpacePrefix: "agent", HTTPClientConfig: config.DefaultHTTPClientConfig, + PrometheusHTTPPrefix: "/prometheus", } // SetToDefault implements river.Defaulter. diff --git a/docs/sources/flow/reference/components/mimir.rules.kubernetes.md b/docs/sources/flow/reference/components/mimir.rules.kubernetes.md index d5ba0e340255..fd5639a03bf4 100644 --- a/docs/sources/flow/reference/components/mimir.rules.kubernetes.md +++ b/docs/sources/flow/reference/components/mimir.rules.kubernetes.md @@ -47,18 +47,19 @@ mimir.rules.kubernetes "LABEL" { `mimir.rules.kubernetes` supports the following arguments: -Name | Type | Description | Default | Required --------------------------|------------|---------------------------------------------------------------------------------|---------|--------- -`address` | `string` | URL of the Mimir ruler. | | yes -`tenant_id` | `string` | Mimir tenant ID. | | no -`use_legacy_routes` | `bool` | Whether to use deprecated ruler API endpoints. | false | no -`sync_interval` | `duration` | Amount of time between reconciliations with Mimir. | "30s" | no -`mimir_namespace_prefix` | `string` | Prefix used to differentiate multiple {{< param "PRODUCT_NAME" >}} deployments. | "agent" | no -`bearer_token` | `secret` | Bearer token to authenticate with. | | no -`bearer_token_file` | `string` | File containing a bearer token to authenticate with. | | no -`proxy_url` | `string` | HTTP proxy to proxy requests through. | | no -`follow_redirects` | `bool` | Whether redirects returned by the server should be followed. | `true` | no -`enable_http2` | `bool` | Whether HTTP2 is supported for requests. | `true` | no +| Name | Type | Description | Default | Required | +| ------------------------ | ---------- | ------------------------------------------------------------------------------- | ------------- | -------- | +| `address` | `string` | URL of the Mimir ruler. | | yes | +| `tenant_id` | `string` | Mimir tenant ID. | | no | +| `use_legacy_routes` | `bool` | Whether to use [deprecated][gem-2_2] ruler API endpoints. | false | no | +| `prometheus_http_prefix` | `string` | Path prefix for [Mimir's Prometheus endpoint][gem-path-prefix]. | `/prometheus` | no | +| `sync_interval` | `duration` | Amount of time between reconciliations with Mimir. | "30s" | no | +| `mimir_namespace_prefix` | `string` | Prefix used to differentiate multiple {{< param "PRODUCT_NAME" >}} deployments. | "agent" | no | +| `bearer_token` | `secret` | Bearer token to authenticate with. | | no | +| `bearer_token_file` | `string` | File containing a bearer token to authenticate with. | | no | +| `proxy_url` | `string` | HTTP proxy to proxy requests through. | | no | +| `follow_redirects` | `bool` | Whether redirects returned by the server should be followed. | `true` | no | +| `enable_http2` | `bool` | Whether HTTP2 is supported for requests. | `true` | no | At most one of the following can be provided: - [`bearer_token` argument](#arguments). @@ -81,6 +82,13 @@ The `mimir_namespace_prefix` argument can be used to separate the rules managed by multiple {{< param "PRODUCT_NAME" >}} deployments across your infrastructure. It should be set to a unique value for each deployment. +If `use_legacy_routes` is set to `true`, `mimir.rules.kubernetes` contacts Mimir on a `/api/v1/rules` endpoint. + +If `prometheus_http_prefix` is set to `/mimir`, `mimir.rules.kubernetes` contacts Mimir on a `/mimir/config/v1/rules` endpoint. +This is useful if you configure Mimir to use a different [prefix][gem-path-prefix] for its Prometheus endpoints than the default one. + +`prometheus_http_prefix` is ignored if `use_legacy_routes` is set to `true`. + ## Blocks The following blocks are supported inside the definition of diff --git a/pkg/mimir/client/client.go b/pkg/mimir/client/client.go index 9145e7b56e41..b6ed18068857 100644 --- a/pkg/mimir/client/client.go +++ b/pkg/mimir/client/client.go @@ -20,22 +20,18 @@ import ( "github.com/prometheus/prometheus/model/rulefmt" ) -const ( - rulerAPIPath = "/prometheus/config/v1/rules" - legacyAPIPath = "/api/v1/rules" -) - var ( - ErrNoConfig = errors.New("No config exists for this user") + ErrNoConfig = errors.New("no config exists for this user") ErrResourceNotFound = errors.New("requested resource not found") ) // Config is used to configure a MimirClient. type Config struct { - ID string - Address string - UseLegacyRoutes bool - HTTPClientConfig config.HTTPClientConfig + ID string + Address string + UseLegacyRoutes bool + HTTPClientConfig config.HTTPClientConfig + PrometheusHTTPPrefix string } type Interface interface { @@ -65,9 +61,12 @@ func New(logger log.Logger, cfg Config, timingHistogram *prometheus.HistogramVec return nil, err } - path := rulerAPIPath + path, err := url.JoinPath(cfg.PrometheusHTTPPrefix, "/config/v1/rules") + if err != nil { + return nil, err + } if cfg.UseLegacyRoutes { - path = legacyAPIPath + path = "/api/v1/rules" } collector := instrument.NewHistogramCollector(timingHistogram) diff --git a/pkg/mimir/client/client_test.go b/pkg/mimir/client/client_test.go index 5ef8a373519b..262e9918a9bf 100644 --- a/pkg/mimir/client/client_test.go +++ b/pkg/mimir/client/client_test.go @@ -79,6 +79,13 @@ func TestBuildURL(t *testing.T) { url: "http://mimir.local/apathto", resultURL: "http://mimir.local/apathto/prometheus/config/v1/rules/last-char-slash%2F", }, + { + name: "builds the correct URL with a customized prometheus_http_prefix", + path: "/mimir/config/v1/rules", + method: http.MethodPost, + url: "http://mimir.local/", + resultURL: "http://mimir.local/mimir/config/v1/rules", + }, } for _, tt := range tc { diff --git a/pkg/mimir/client/rules_test.go b/pkg/mimir/client/rules_test.go index e2ab18a17839..a4ccdde6e509 100644 --- a/pkg/mimir/client/rules_test.go +++ b/pkg/mimir/client/rules_test.go @@ -22,49 +22,63 @@ func TestMimirClient_X(t *testing.T) { })) defer ts.Close() - client, err := New(log.NewNopLogger(), Config{ - Address: ts.URL, - }, prometheus.NewHistogramVec(prometheus.HistogramOpts{}, instrument.HistogramCollectorBuckets)) - require.NoError(t, err) - for _, tc := range []struct { - test string - namespace string - name string - expURLPath string + test string + namespace string + name string + prometheusHTTPPrefix string + expURLPath string }{ { - test: "regular-characters", - namespace: "my-namespace", - name: "my-name", - expURLPath: "/prometheus/config/v1/rules/my-namespace/my-name", + test: "regular-characters", + namespace: "my-namespace", + name: "my-name", + expURLPath: "/prometheus/config/v1/rules/my-namespace/my-name", + prometheusHTTPPrefix: "/prometheus", + }, + { + test: "special-characters-spaces", + namespace: "My: Namespace", + name: "My: Name", + prometheusHTTPPrefix: "/prometheus", + expURLPath: "/prometheus/config/v1/rules/My:%20Namespace/My:%20Name", }, { - test: "special-characters-spaces", - namespace: "My: Namespace", - name: "My: Name", - expURLPath: "/prometheus/config/v1/rules/My:%20Namespace/My:%20Name", + test: "special-characters-slashes", + namespace: "My/Namespace", + name: "My/Name", + prometheusHTTPPrefix: "/prometheus", + expURLPath: "/prometheus/config/v1/rules/My%2FNamespace/My%2FName", }, { - test: "special-characters-slashes", - namespace: "My/Namespace", - name: "My/Name", - expURLPath: "/prometheus/config/v1/rules/My%2FNamespace/My%2FName", + test: "special-characters-slash-first", + namespace: "My/Namespace", + name: "/first-char-slash", + prometheusHTTPPrefix: "/prometheus", + expURLPath: "/prometheus/config/v1/rules/My%2FNamespace/%2Ffirst-char-slash", }, { - test: "special-characters-slash-first", - namespace: "My/Namespace", - name: "/first-char-slash", - expURLPath: "/prometheus/config/v1/rules/My%2FNamespace/%2Ffirst-char-slash", + test: "special-characters-slash-last", + namespace: "My/Namespace", + name: "last-char-slash/", + prometheusHTTPPrefix: "/prometheus", + expURLPath: "/prometheus/config/v1/rules/My%2FNamespace/last-char-slash%2F", }, { - test: "special-characters-slash-last", - namespace: "My/Namespace", - name: "last-char-slash/", - expURLPath: "/prometheus/config/v1/rules/My%2FNamespace/last-char-slash%2F", + test: "regular-characters-with-customized-prometheus-http-prefix", + namespace: "My/Namespace", + name: "last-char-slash/", + prometheusHTTPPrefix: "/mimir", + expURLPath: "/mimir/config/v1/rules/My%2FNamespace/last-char-slash%2F", }, } { t.Run(tc.test, func(t *testing.T) { + client, err := New(log.NewNopLogger(), Config{ + Address: ts.URL, + PrometheusHTTPPrefix: tc.prometheusHTTPPrefix, + }, prometheus.NewHistogramVec(prometheus.HistogramOpts{}, instrument.HistogramCollectorBuckets)) + require.NoError(t, err) + ctx := context.Background() require.NoError(t, client.DeleteRuleGroup(ctx, tc.namespace, tc.name))