Skip to content

Commit

Permalink
misc: reexpose static for public import
Browse files Browse the repository at this point in the history
Everything was moved to internal/ for the 1.0 release, but there are
some code dependencies which depend on static mode. Now that the 1.0
release is completed, the static mode code can be reexported.

Note that there is no plans at this time for this change to be reflected
in Alloy.
  • Loading branch information
rfratto committed Apr 10, 2024
1 parent b354efc commit d1e7aa6
Show file tree
Hide file tree
Showing 482 changed files with 622 additions and 622 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ lint: agentlint
# more without -race for packages that have known race detection issues.
test:
$(GO_ENV) go test $(GO_FLAGS) -race $(shell go list ./... | grep -v /integration-tests/)
$(GO_ENV) go test $(GO_FLAGS) ./internal/static/integrations/node_exporter ./internal/static/logs ./internal/static/operator ./internal/util/k8s ./internal/component/otelcol/processor/tail_sampling ./internal/component/loki/source/file ./internal/component/loki/source/docker
$(GO_ENV) go test $(GO_FLAGS) ./static/integrations/node_exporter ./static/logs ./static/operator ./internal/util/k8s ./internal/component/otelcol/processor/tail_sampling ./internal/component/loki/source/file ./internal/component/loki/source/docker

test-packages:
docker pull $(BUILD_IMAGE)
Expand Down Expand Up @@ -272,7 +272,7 @@ ifeq ($(USE_CONTAINER),1)
$(RERUN_IN_CONTAINER)
else
bash ./tools/generate-crds.bash
gen-crd-api-reference-docs -config tools/gen-crd-docs/config.json -api-dir "github.com/grafana/agent/internal/static/operator/apis/monitoring/" -out-file docs/sources/operator/api.md -template-dir tools/gen-crd-docs/template
gen-crd-api-reference-docs -config tools/gen-crd-docs/config.json -api-dir "github.com/grafana/agent/static/operator/apis/monitoring/" -out-file docs/sources/operator/api.md -template-dir tools/gen-crd-docs/template
endif

generate-drone:
Expand Down Expand Up @@ -304,7 +304,7 @@ generate-protos:
ifeq ($(USE_CONTAINER),1)
$(RERUN_IN_CONTAINER)
else
go generate ./internal/static/agentproto/
go generate ./static/agentproto/
endif

generate-ui:
Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent-flow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
_ "github.com/prometheus/prometheus/discovery/install"

// Register integrations
_ "github.com/grafana/agent/internal/static/integrations/install"
_ "github.com/grafana/agent/static/integrations/install"

// Embed a set of fallback X.509 trusted roots
// Allows the app to work correctly even when the OS does not provide a verifier or systems roots pool
Expand Down
4 changes: 2 additions & 2 deletions cmd/grafana-agent-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/agent/internal/build"
"github.com/grafana/agent/internal/static/operator"
"github.com/grafana/agent/internal/static/operator/logutil"
util_log "github.com/grafana/agent/internal/util/log"
"github.com/grafana/agent/static/operator"
"github.com/grafana/agent/static/operator/logutil"
controller "sigs.k8s.io/controller-runtime"

// Needed for clients.
Expand Down
14 changes: 7 additions & 7 deletions cmd/grafana-agent/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import (
"github.com/go-kit/log/level"
"github.com/gorilla/mux"
"github.com/grafana/agent/internal/agentseed"
"github.com/grafana/agent/internal/static/config"
"github.com/grafana/agent/internal/static/logs"
"github.com/grafana/agent/internal/static/metrics"
"github.com/grafana/agent/internal/static/metrics/instance"
"github.com/grafana/agent/internal/static/server"
"github.com/grafana/agent/internal/static/supportbundle"
"github.com/grafana/agent/internal/static/traces"
"github.com/grafana/agent/internal/usagestats"
"github.com/grafana/agent/static/config"
"github.com/grafana/agent/static/logs"
"github.com/grafana/agent/static/metrics"
"github.com/grafana/agent/static/metrics/instance"
"github.com/grafana/agent/static/server"
"github.com/grafana/agent/static/supportbundle"
"github.com/grafana/agent/static/traces"
"github.com/grafana/dskit/signals"
"github.com/oklog/run"
"github.com/prometheus/client_golang/prometheus"
Expand Down
6 changes: 3 additions & 3 deletions cmd/grafana-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/grafana/agent/internal/boringcrypto"
"github.com/grafana/agent/internal/build"
"github.com/grafana/agent/internal/flowmode"
"github.com/grafana/agent/internal/static/config"
"github.com/grafana/agent/internal/static/server"
util_log "github.com/grafana/agent/internal/util/log"
"github.com/grafana/agent/static/config"
"github.com/grafana/agent/static/server"

"github.com/prometheus/client_golang/prometheus"

Expand All @@ -20,7 +20,7 @@ import (
_ "github.com/prometheus/prometheus/discovery/install"

// Register integrations
_ "github.com/grafana/agent/internal/static/integrations/install"
_ "github.com/grafana/agent/static/integrations/install"

// Embed a set of fallback X.509 trusted roots
// Allows the app to work correctly even when the OS does not provide a verifier or systems roots pool
Expand Down
4 changes: 2 additions & 2 deletions cmd/grafana-agent/service_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"

"github.com/go-kit/log/level"
"github.com/grafana/agent/internal/static/config"
"github.com/grafana/agent/internal/static/server"
util_log "github.com/grafana/agent/internal/util/log"
"github.com/grafana/agent/static/config"
"github.com/grafana/agent/static/server"

"golang.org/x/sys/windows/svc"
)
Expand Down
12 changes: 6 additions & 6 deletions cmd/grafana-agentctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ import (
"syscall"

"github.com/grafana/agent/internal/build"
"github.com/grafana/agent/internal/static/agentctl/waltools"
"github.com/grafana/agent/internal/static/config"
"github.com/grafana/agent/internal/static/logs"
"github.com/grafana/agent/static/agentctl/waltools"
"github.com/grafana/agent/static/config"
"github.com/grafana/agent/static/logs"
"github.com/olekukonko/tablewriter"
"github.com/prometheus/client_golang/prometheus"

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/grafana/agent/internal/static/agentctl"
"github.com/grafana/agent/internal/static/client"
"github.com/grafana/agent/static/agentctl"
"github.com/grafana/agent/static/client"
"github.com/spf13/cobra"

// Register Prometheus SD components
_ "github.com/prometheus/prometheus/discovery/install"

// Register integrations
_ "github.com/grafana/agent/internal/static/integrations/install"
_ "github.com/grafana/agent/static/integrations/install"

// Needed for operator-detach
"k8s.io/apimachinery/pkg/fields"
Expand Down
6 changes: 3 additions & 3 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ include docs.mk
docs: check-cloudwatch-integration

check-cloudwatch-integration:
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.22.1-bullseye go run internal/static/integrations/cloudwatch_exporter/docs/doc.go check /docs/sources/static/configuration/integrations/cloudwatch-exporter-config.md
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.22.1-bullseye go run internal/static/integrations/cloudwatch_exporter/docs/doc.go check /docs/sources/flow/reference/components/prometheus.exporter.cloudwatch.md
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.22.1-bullseye go run static/integrations/cloudwatch_exporter/docs/doc.go check /docs/sources/static/configuration/integrations/cloudwatch-exporter-config.md
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.22.1-bullseye go run static/integrations/cloudwatch_exporter/docs/doc.go check /docs/sources/flow/reference/components/prometheus.exporter.cloudwatch.md

generate-cloudwatch-integration:
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.22.1-bullseye go run internal/static/integrations/cloudwatch_exporter/docs/doc.go generate
$(PODMAN) run -v $(shell git rev-parse --show-toplevel):/repo -v $(shell pwd):/docs -w /repo golang:1.22.1-bullseye go run static/integrations/cloudwatch_exporter/docs/doc.go generate

sources/assets/hierarchy.svg: sources/operator/hierarchy.dot
cat $< | $(PODMAN) run --rm -i nshine/dot dot -Tsvg > $@
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ The following blocks are supported inside the definition of

### filesystem block

The default values can vary by the operating system the agent runs on - refer to the [integration source](https://github.com/grafana/agent/blob/main/internal/static/integrations/node_exporter/config.go) for up-to-date values on each OS.
The default values can vary by the operating system the agent runs on - refer to the [integration source](https://github.com/grafana/agent/blob/main/static/integrations/node_exporter/config.go) for up-to-date values on each OS.

| Name | Type | Description | Default | Required |
| ---------------------- | ---------- | ------------------------------------------------------------------- | ----------------------------------------------- | -------- |
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/operator/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Deployment is a set of discovered resources relative to a GrafanaAgent. The tree
|`Metrics`<br/>_[[]MetricsDeployment](#monitoring.grafana.com/v1alpha1.MetricsDeployment)_| Metrics resources discovered by Agent. |
|`Logs`<br/>_[[]LogsDeployment](#monitoring.grafana.com/v1alpha1.LogsDeployment)_| Logs resources discovered by Agent. |
|`Integrations`<br/>_[[]IntegrationsDeployment](#monitoring.grafana.com/v1alpha1.IntegrationsDeployment)_| Integrations resources discovered by Agent. |
|`Secrets`<br/>_[github.com/grafana/agent/internal/static/operator/assets.SecretStore](https://pkg.go.dev/github.com/grafana/agent/internal/static/operator/assets#SecretStore)_| The full list of Secrets referenced by resources in the Deployment. |
|`Secrets`<br/>_[github.com/grafana/agent/static/operator/assets.SecretStore](https://pkg.go.dev/github.com/grafana/agent/static/operator/assets#SecretStore)_| The full list of Secrets referenced by resources in the Deployment. |
### GrafanaAgent <a name="monitoring.grafana.com/v1alpha1.GrafanaAgent"></a>
(Appears on:[Deployment](#monitoring.grafana.com/v1alpha1.Deployment))
GrafanaAgent defines a Grafana Agent deployment.
Expand Down Expand Up @@ -438,7 +438,7 @@ PipelineStageSpec defines an individual pipeline stage. Each stage type is mutua
|`labels`<br/>_map[string]string_| Labels is an action stage that takes data from the extracted map and modifies the label set that is sent to Loki with the log entry. The key is REQUIRED and represents the name for the label that will be created. Value is optional and will be the name from extracted data to use for the value of the label. If the value is not provided, it defaults to match the key. |
|`limit`<br/>_[LimitStageSpec](#monitoring.grafana.com/v1alpha1.LimitStageSpec)_| Limit is a rate-limiting stage that throttles logs based on several options. |
|`match`<br/>_[MatchStageSpec](#monitoring.grafana.com/v1alpha1.MatchStageSpec)_| Match is a filtering stage that conditionally applies a set of stages or drop entries when a log entry matches a configurable LogQL stream selector and filter expressions. |
|`metrics`<br/>_[map[string]github.com/grafana/agent/internal/static/operator/apis/monitoring/v1alpha1.MetricsStageSpec](#monitoring.grafana.com/v1alpha1.MetricsStageSpec)_| Metrics is an action stage that supports defining and updating metrics based on data from the extracted map. Created metrics are not pushed to Loki or Prometheus and are instead exposed via the /metrics endpoint of the Grafana Agent pod. The Grafana Agent Operator should be configured with a MetricsInstance that discovers the logging DaemonSet to collect metrics created by this stage. |
|`metrics`<br/>_[map[string]github.com/grafana/agent/static/operator/apis/monitoring/v1alpha1.MetricsStageSpec](#monitoring.grafana.com/v1alpha1.MetricsStageSpec)_| Metrics is an action stage that supports defining and updating metrics based on data from the extracted map. Created metrics are not pushed to Loki or Prometheus and are instead exposed via the /metrics endpoint of the Grafana Agent pod. The Grafana Agent Operator should be configured with a MetricsInstance that discovers the logging DaemonSet to collect metrics created by this stage. |
|`multiline`<br/>_[MultilineStageSpec](#monitoring.grafana.com/v1alpha1.MultilineStageSpec)_| Multiline stage merges multiple lines into a multiline block before passing it on to the next stage in the pipeline. |
|`output`<br/>_[OutputStageSpec](#monitoring.grafana.com/v1alpha1.OutputStageSpec)_| Output stage is an action stage that takes data from the extracted map and changes the log line that will be sent to Loki. |
|`pack`<br/>_[PackStageSpec](#monitoring.grafana.com/v1alpha1.PackStageSpec)_| Pack is a transform stage that lets you embed extracted values and labels into the log line by packing the log line and labels inside of a JSON object. |
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/static/api/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ defaults to `localhost:12345`.
The support bundle contains all information in plain text, so that it can be
inspected before sharing, to verify that no sensitive information has leaked.

In addition, you can inspect the [supportbundle package](https://github.com/grafana/agent/tree/main/internal/static/supportbundle)
In addition, you can inspect the [supportbundle package](https://github.com/grafana/agent/tree/main/static/supportbundle)
to verify the code that is being used to generate these bundles.

A support bundle contains the following data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,6 @@ Full reference of options:

SNMP module is the set of SNMP counters to be scraped together from the specific network device.

SNMP modules available can be found in the embedded snmp.yml file [here](https://github.com/grafana/agent/blob/main/internal/static/integrations/snmp_exporter/common/snmp.yml). If not specified, `if_mib` module is used.
SNMP modules available can be found in the embedded snmp.yml file [here](https://github.com/grafana/agent/blob/main/static/integrations/snmp_exporter/common/snmp.yml). If not specified, `if_mib` module is used.

If you need to use custom SNMP modules, you can [generate](https://github.com/prometheus/snmp_exporter#generating-configuration) your own snmp.yml file and specify it using `config_file` parameter.
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,6 @@ Full reference of options:

SNMP module is the set of SNMP counters to be scraped together from the specific network device.

SNMP modules available can be found in the embedded snmp.yml file [here](https://github.com/grafana/agent/blob/main/internal/static/integrations/snmp_exporter/common/snmp.yml). If not specified, `if_mib` module is used.
SNMP modules available can be found in the embedded snmp.yml file [here](https://github.com/grafana/agent/blob/main/static/integrations/snmp_exporter/common/snmp.yml). If not specified, `if_mib` module is used.

If you need to use custom SNMP modules, you can [generate](https://github.com/prometheus/snmp_exporter#generating-configuration) your own snmp.yml file and specify it using `config_file` parameter.
2 changes: 1 addition & 1 deletion internal/component/loki/source/file/legacy_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/grafana/agent/internal/component"
"github.com/grafana/agent/internal/component/common/loki"
"github.com/grafana/agent/internal/component/discovery"
"github.com/grafana/agent/internal/static/logs"
"github.com/grafana/agent/internal/util"
"github.com/grafana/agent/static/logs"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"
"go.uber.org/atomic"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/grafana/agent/internal/component/otelcol/internal/lazyconsumer"
"github.com/grafana/agent/internal/featuregate"
"github.com/grafana/agent/internal/flow/logging/level"
promsdconsumer "github.com/grafana/agent/internal/static/traces/promsdprocessor/consumer"
promsdconsumer "github.com/grafana/agent/static/traces/promsdprocessor/consumer"
"github.com/grafana/river"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/grafana/agent/internal/component/otelcol/processor/discovery"
"github.com/grafana/agent/internal/component/otelcol/processor/processortest"
"github.com/grafana/agent/internal/flow/componenttest"
promsdconsumer "github.com/grafana/agent/internal/static/traces/promsdprocessor/consumer"
"github.com/grafana/agent/internal/util"
promsdconsumer "github.com/grafana/agent/static/traces/promsdprocessor/consumer"
"github.com/grafana/river"
"github.com/stretchr/testify/require"
semconv "go.opentelemetry.io/collector/semconv/v1.5.0"
Expand Down
4 changes: 2 additions & 2 deletions internal/component/prometheus/exporter/apache/apache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"github.com/grafana/agent/internal/component"
"github.com/grafana/agent/internal/component/prometheus/exporter"
"github.com/grafana/agent/internal/featuregate"
"github.com/grafana/agent/internal/static/integrations"
"github.com/grafana/agent/internal/static/integrations/apache_http"
"github.com/grafana/agent/static/integrations"
"github.com/grafana/agent/static/integrations/apache_http"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions internal/component/prometheus/exporter/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"github.com/grafana/agent/internal/component"
"github.com/grafana/agent/internal/component/prometheus/exporter"
"github.com/grafana/agent/internal/featuregate"
"github.com/grafana/agent/internal/static/integrations"
"github.com/grafana/agent/internal/static/integrations/azure_exporter"
"github.com/grafana/agent/static/integrations"
"github.com/grafana/agent/static/integrations/azure_exporter"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions internal/component/prometheus/exporter/blackbox/blackbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/grafana/agent/internal/component/discovery"
"github.com/grafana/agent/internal/component/prometheus/exporter"
"github.com/grafana/agent/internal/featuregate"
"github.com/grafana/agent/internal/static/integrations"
"github.com/grafana/agent/internal/static/integrations/blackbox_exporter"
"github.com/grafana/agent/internal/util"
"github.com/grafana/agent/static/integrations"
"github.com/grafana/agent/static/integrations/blackbox_exporter"
"github.com/grafana/river/rivertypes"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/component/prometheus/exporter/cadvisor/cadvisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/grafana/agent/internal/component"
"github.com/grafana/agent/internal/component/prometheus/exporter"
"github.com/grafana/agent/internal/featuregate"
"github.com/grafana/agent/internal/static/integrations"
"github.com/grafana/agent/internal/static/integrations/cadvisor"
"github.com/grafana/agent/static/integrations"
"github.com/grafana/agent/static/integrations/cadvisor"
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/grafana/agent/internal/static/integrations/cadvisor"
"github.com/grafana/agent/static/integrations/cadvisor"
"github.com/grafana/river"
"github.com/stretchr/testify/require"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/grafana/agent/internal/component"
"github.com/grafana/agent/internal/component/prometheus/exporter"
"github.com/grafana/agent/internal/featuregate"
"github.com/grafana/agent/internal/static/integrations"
"github.com/grafana/agent/internal/static/integrations/cloudwatch_exporter"
"github.com/grafana/agent/static/integrations"
"github.com/grafana/agent/static/integrations/cloudwatch_exporter"
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/hex"
"time"

"github.com/grafana/agent/internal/static/integrations/cloudwatch_exporter"
"github.com/grafana/agent/static/integrations/cloudwatch_exporter"
"github.com/grafana/river"
yaceConf "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/config"
yaceModel "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model"
Expand Down
4 changes: 2 additions & 2 deletions internal/component/prometheus/exporter/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/grafana/agent/internal/component"
"github.com/grafana/agent/internal/component/prometheus/exporter"
"github.com/grafana/agent/internal/featuregate"
"github.com/grafana/agent/internal/static/integrations"
"github.com/grafana/agent/internal/static/integrations/consul_exporter"
"github.com/grafana/agent/static/integrations"
"github.com/grafana/agent/static/integrations/consul_exporter"
)

func init() {
Expand Down
4 changes: 2 additions & 2 deletions internal/component/prometheus/exporter/dnsmasq/dnsmasq.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"github.com/grafana/agent/internal/component"
"github.com/grafana/agent/internal/component/prometheus/exporter"
"github.com/grafana/agent/internal/featuregate"
"github.com/grafana/agent/internal/static/integrations"
"github.com/grafana/agent/internal/static/integrations/dnsmasq_exporter"
"github.com/grafana/agent/static/integrations"
"github.com/grafana/agent/static/integrations/dnsmasq_exporter"
)

func init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dnsmasq
import (
"testing"

"github.com/grafana/agent/internal/static/integrations/dnsmasq_exporter"
"github.com/grafana/agent/static/integrations/dnsmasq_exporter"
"github.com/grafana/river"
"github.com/stretchr/testify/assert"
)
Expand Down
Loading

0 comments on commit d1e7aa6

Please sign in to comment.