Skip to content

Commit

Permalink
refactor(internal): rename non-intuitive internal/alloy to more com…
Browse files Browse the repository at this point in the history
…prehensive `internal/runtime` (#867)

Signed-off-by: hainenber <[email protected]>
  • Loading branch information
hainenber authored May 15, 2024
1 parent dbf86c2 commit 4b1eb1b
Show file tree
Hide file tree
Showing 301 changed files with 343 additions and 349 deletions.
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,6 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gosnmp/gosnmp v1.36.0 h1:1Si+MImHcKIqFc3/kJEs2LOULP1nlFKlzPFyrMOk5Qk=
github.com/gosnmp/gosnmp v1.36.0/go.mod h1:iLcZxN2MxKhH0jPQDVMZaSNypw1ykqVi27O79koQj6w=
github.com/gosnmp/gosnmp v1.37.0 h1:/Tf8D3b9wrnNuf/SfbvO+44mPrjVphBhRtcGg22V07Y=
github.com/gosnmp/gosnmp v1.37.0/go.mod h1:GDH9vNqpsD7f2HvZhKs5dlqSEcAS6s6Qp099oZRCR+M=
github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
Expand Down Expand Up @@ -1982,10 +1980,6 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/prometheus/snmp_exporter v0.24.1 h1:AihTbJHurMo8bjtjJde8U+4gMEvpvYvT21Xbd4SzJgY=
github.com/prometheus/snmp_exporter v0.24.1/go.mod h1:j6uIGkdR0DXvKn7HJtSkeDj//UY0sWmdd6XhvdBjln0=
github.com/prometheus/snmp_exporter v0.25.1-0.20240501011921-5f907e691aa5 h1:eDoGVogLF6DRe1s7NpQI6oz8atI3eM2Q58JmHiKOkRM=
github.com/prometheus/snmp_exporter v0.25.1-0.20240501011921-5f907e691aa5/go.mod h1:zOJjSLA//ET2bH76vYBdftmKEg1LiqfNesyZy+nMHvc=
github.com/prometheus/snmp_exporter v0.26.0 h1:7THSh/mAIMmHkiVhmsrAwiH1XNGiFelhPCKBe8PXg8U=
github.com/prometheus/snmp_exporter v0.26.0/go.mod h1:GJEhIONojqxbjn3eyCykWeGVXQJg9pdYSX2scFLpEA0=
github.com/prometheus/statsd_exporter v0.22.8 h1:Qo2D9ZzaQG+id9i5NYNGmbf1aa/KxKbB9aKfMS+Yib0=
Expand Down
2 changes: 1 addition & 1 deletion internal/alloycli/cluster_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/grafana/alloy/internal/service/cluster"
"github.com/grafana/ckit/advertise"
"github.com/hashicorp/go-discover"
Expand Down
24 changes: 12 additions & 12 deletions internal/alloycli/cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ import (
"github.com/KimMachineGun/automemlimit/memlimit"
"github.com/fatih/color"
"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy"
"github.com/grafana/alloy/internal/alloy/logging"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/alloy/tracing"
"github.com/grafana/alloy/internal/alloyseed"
"github.com/grafana/alloy/internal/boringcrypto"
"github.com/grafana/alloy/internal/component"
"github.com/grafana/alloy/internal/converter"
convert_diag "github.com/grafana/alloy/internal/converter/diag"
"github.com/grafana/alloy/internal/featuregate"
alloy_runtime "github.com/grafana/alloy/internal/runtime"
"github.com/grafana/alloy/internal/runtime/logging"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/grafana/alloy/internal/runtime/tracing"
"github.com/grafana/alloy/internal/service"
httpservice "github.com/grafana/alloy/internal/service/http"
"github.com/grafana/alloy/internal/service/labelstore"
Expand Down Expand Up @@ -227,7 +227,7 @@ func (fr *alloyRun) Run(configPath string) error {
// To work around this, we lazily create variables for the functions the HTTP
// service needs and set them after the Alloy controller exists.
var (
reload func() (*alloy.Source, error)
reload func() (*alloy_runtime.Source, error)
ready func() bool
)

Expand Down Expand Up @@ -257,7 +257,7 @@ func (fr *alloyRun) Run(configPath string) error {
Gatherer: prometheus.DefaultGatherer,

ReadyFunc: func() bool { return ready() },
ReloadFunc: func() (*alloy.Source, error) { return reload() },
ReloadFunc: func() (*alloy_runtime.Source, error) { return reload() },

HTTPListenAddr: fr.httpListenAddr,
MemoryListenAddr: fr.inMemoryAddr,
Expand All @@ -284,7 +284,7 @@ func (fr *alloyRun) Run(configPath string) error {
labelService := labelstore.New(l, reg)
alloyseed.Init(fr.storagePath, l)

f := alloy.New(alloy.Options{
f := alloy_runtime.New(alloy_runtime.Options{
Logger: l,
Tracer: t,
DataPath: fr.storagePath,
Expand All @@ -301,7 +301,7 @@ func (fr *alloyRun) Run(configPath string) error {
})

ready = f.Ready
reload = func() (*alloy.Source, error) {
reload = func() (*alloy_runtime.Source, error) {
alloySource, err := loadAlloySource(configPath, fr.configFormat, fr.configBypassConversionErrors, fr.configExtraArgs)
defer instrumentation.InstrumentSHA256(alloySource.SHA256())
defer instrumentation.InstrumentLoad(err == nil)
Expand Down Expand Up @@ -390,7 +390,7 @@ func (fr *alloyRun) Run(configPath string) error {
}

// getEnabledComponentsFunc returns a function that gets the current enabled components
func getEnabledComponentsFunc(f *alloy.Alloy) func() map[string]interface{} {
func getEnabledComponentsFunc(f *alloy_runtime.Runtime) func() map[string]interface{} {
return func() map[string]interface{} {
components := component.GetAllComponents(f, component.InfoOptions{})
componentNames := map[string]struct{}{}
Expand All @@ -404,7 +404,7 @@ func getEnabledComponentsFunc(f *alloy.Alloy) func() map[string]interface{} {
}
}

func loadAlloySource(path string, converterSourceFormat string, converterBypassErrors bool, configExtraArgs string) (*alloy.Source, error) {
func loadAlloySource(path string, converterSourceFormat string, converterBypassErrors bool, configExtraArgs string) (*alloy_runtime.Source, error) {
fi, err := os.Stat(path)
if err != nil {
return nil, err
Expand Down Expand Up @@ -436,7 +436,7 @@ func loadAlloySource(path string, converterSourceFormat string, converterBypassE
return nil, err
}

return alloy.ParseSources(sources)
return alloy_runtime.ParseSources(sources)
}

bb, err := os.ReadFile(path)
Expand All @@ -460,7 +460,7 @@ func loadAlloySource(path string, converterSourceFormat string, converterBypassE

instrumentation.InstrumentConfig(bb)

return alloy.ParseSource(path, bb)
return alloy_runtime.ParseSource(path, bb)
}

func interruptContext() (context.Context, context.CancelFunc) {
Expand Down
2 changes: 1 addition & 1 deletion internal/alloycli/resources_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/shirou/gopsutil/v3/net"
"github.com/shirou/gopsutil/v3/process"
Expand Down
2 changes: 1 addition & 1 deletion internal/alloyseed/alloyseed.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/go-kit/log"
"github.com/google/uuid"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/common/version"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/alloy-service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"testing"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/componenttest"
"github.com/grafana/alloy/internal/runtime/componenttest"
"github.com/grafana/alloy/internal/util"
"github.com/phayes/freeport"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/beyla/ebpf/beyla_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
"sync"
"time"

"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/component"
"github.com/grafana/alloy/internal/component/discovery"
"github.com/grafana/alloy/internal/component/otelcol"
"github.com/grafana/alloy/internal/featuregate"
"github.com/grafana/alloy/internal/runtime/logging/level"
http_service "github.com/grafana/alloy/internal/service/http"
"github.com/grafana/beyla/pkg/beyla"
"github.com/grafana/beyla/pkg/components"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/beyla/ebpf/beyla_placeholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package beyla
import (
"context"

"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/component"
"github.com/grafana/alloy/internal/featuregate"
"github.com/grafana/alloy/internal/runtime/logging/level"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/kubernetes/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package kubernetes

import (
"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"reflect"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
commoncfg "github.com/grafana/alloy/internal/component/common/config"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/grafana/alloy/internal/useragent"
promconfig "github.com/prometheus/common/config"
"k8s.io/client-go/rest"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/loki/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/grafana/alloy/internal/useragent"
"github.com/grafana/dskit/backoff"
"github.com/prometheus/client_golang/prometheus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/component/common/loki/wal"
"github.com/grafana/alloy/internal/runtime/logging/level"
)

type MarkerHandler interface {
Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/loki/client/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"sync"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/component/common/loki/client/internal"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/client_golang/prometheus"

"github.com/grafana/alloy/internal/component/common/loki"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/loki/positions/positions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
yaml "gopkg.in/yaml.v2"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/loki/wal/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/prometheus/tsdb/wlog"

Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/loki/wal/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/component/common/loki/wal/internal"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/prometheus/tsdb/record"
"github.com/prometheus/prometheus/tsdb/wlog"

Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/loki/wal/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/tsdb/record"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/loki/wal/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/tsdb/chunks"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/loki/wal/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/common/net/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/go-kit/log"
"github.com/gorilla/mux"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
dskit "github.com/grafana/dskit/server"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
consul "github.com/hashicorp/consul/api"
conntrack "github.com/mwitkow/go-conntrack"
"github.com/prometheus/client_golang/prometheus"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/process/process_stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ package process
import (
"context"

"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/component"
"github.com/grafana/alloy/internal/component/discovery"
"github.com/grafana/alloy/internal/featuregate"
"github.com/grafana/alloy/internal/runtime/logging/level"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/relabel/relabel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"testing"
"time"

"github.com/grafana/alloy/internal/alloy/componenttest"
alloy_relabel "github.com/grafana/alloy/internal/component/common/relabel"
"github.com/grafana/alloy/internal/component/discovery"
"github.com/grafana/alloy/internal/component/discovery/relabel"
"github.com/grafana/alloy/internal/runtime/componenttest"
"github.com/grafana/alloy/syntax"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/component/faro/receiver/exporters.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (

"github.com/go-kit/log"
"github.com/go-logfmt/logfmt"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/component/common/loki"
"github.com/grafana/alloy/internal/component/faro/receiver/internal/payload"
"github.com/grafana/alloy/internal/component/otelcol"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/grafana/loki/pkg/logproto"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/faro/receiver/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"time"

"github.com/go-kit/log"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/component/faro/receiver/internal/payload"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/rs/cors"
"go.opentelemetry.io/collector/client"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/faro/receiver/receiver.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-sourcemap/sourcemap"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/component"
"github.com/grafana/alloy/internal/featuregate"
"github.com/grafana/alloy/internal/runtime/logging/level"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion internal/component/faro/receiver/receiver_otelcol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
"testing"
"time"

"github.com/grafana/alloy/internal/alloy/componenttest"
"github.com/grafana/alloy/internal/component/otelcol"
"github.com/grafana/alloy/internal/component/otelcol/auth"
"github.com/grafana/alloy/internal/component/otelcol/auth/headers"
otlphttp "github.com/grafana/alloy/internal/component/otelcol/exporter/otlphttp"
"github.com/grafana/alloy/internal/runtime/componenttest"
"github.com/grafana/alloy/internal/util"
"github.com/phayes/freeport"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/faro/receiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"testing"
"time"

"github.com/grafana/alloy/internal/alloy/componenttest"
"github.com/grafana/alloy/internal/component/common/loki"
"github.com/grafana/alloy/internal/component/otelcol"
"github.com/grafana/alloy/internal/runtime/componenttest"
"github.com/grafana/alloy/internal/util"
"github.com/grafana/loki/pkg/logproto"
"github.com/phayes/freeport"
Expand Down
2 changes: 1 addition & 1 deletion internal/component/faro/receiver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/go-kit/log"
"github.com/gorilla/mux"
"github.com/grafana/alloy/internal/alloy/logging/level"
"github.com/grafana/alloy/internal/runtime/logging/level"
"github.com/grafana/dskit/instrument"
"github.com/grafana/dskit/middleware"
"github.com/prometheus/client_golang/prometheus"
Expand Down
Loading

0 comments on commit 4b1eb1b

Please sign in to comment.