Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename github.com/grafana/agent module to github.com/grafana/alloy #71

Merged
merged 4 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ include tools/make/*.mk
ALLOY_IMAGE ?= grafana/alloy:latest
ALLOY_BINARY ?= build/alloy
SERVICE_BINARY ?= build/alloy-service
AGENTLINT_BINARY ?= build/agentlint
ALLOYLINT_BINARY ?= build/alloylint
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
GOARM ?= $(shell go env GOARM)
Expand All @@ -102,7 +102,7 @@ GO_ENV := GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) CGO_ENABLED=$(CGO_ENABLED
VERSION ?= $(shell bash ./tools/image-tag)
GIT_REVISION := $(shell git rev-parse --short HEAD)
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
VPREFIX := github.com/grafana/agent/internal/build
VPREFIX := github.com/grafana/alloy/internal/build
GO_LDFLAGS := -X $(VPREFIX).Branch=$(GIT_BRANCH) \
-X $(VPREFIX).Version=$(VERSION) \
-X $(VPREFIX).Revision=$(GIT_REVISION) \
Expand All @@ -126,9 +126,9 @@ endif
#

.PHONY: lint
lint: agentlint
lint: alloylint
find . -name go.mod -execdir golangci-lint run -v --timeout=10m \;
$(AGENTLINT_BINARY) ./...
$(ALLOYLINT_BINARY) ./...

.PHONY: test
# We have to run test twice: once for all packages with -race and then once
Expand Down Expand Up @@ -169,11 +169,11 @@ else
$(GO_ENV) go build $(GO_FLAGS) -o $(SERVICE_BINARY) ./cmd/alloy-service
endif

agentlint:
alloylint:
ifeq ($(USE_CONTAINER),1)
$(RERUN_IN_CONTAINER)
else
cd ./internal/cmd/agentlint && $(GO_ENV) go build $(GO_FLAGS) -o ../../../$(AGENTLINT_BINARY) .
cd ./internal/cmd/alloylint && $(GO_ENV) go build $(GO_FLAGS) -o ../../../$(ALLOYLINT_BINARY) .
endif

#
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ To engage with the Alloy community:

* Attend the monthly [community call][community-call].

[discussions]: https://github.com/grafana/agent/discussions
[discussions]: https://github.com/grafana/alloy/discussions
[issue]: https://github.com/grafana/alloy/issues/new
[community-call]: https://docs.google.com/document/d/1TqaZD1JPfNadZ4V81OCBPCG_TksDYGlNlGdMnTWUSpo

Expand Down
4 changes: 2 additions & 2 deletions cmd/alloy-service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"testing"

"github.com/go-kit/log"
"github.com/grafana/agent/internal/flow/componenttest"
"github.com/grafana/agent/internal/util"
"github.com/grafana/alloy/internal/flow/componenttest"
"github.com/grafana/alloy/internal/util"
"github.com/phayes/freeport"
"github.com/stretchr/testify/require"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/alloy/main.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package main

import (
"github.com/grafana/agent/internal/build"
"github.com/grafana/agent/internal/flowmode"
"github.com/grafana/alloy/internal/build"
"github.com/grafana/alloy/internal/flowmode"
"github.com/prometheus/client_golang/prometheus"

// Register Prometheus SD components
_ "github.com/grafana/loki/clients/pkg/promtail/discovery/consulagent"
_ "github.com/prometheus/prometheus/discovery/install"

// Register integrations
_ "github.com/grafana/agent/internal/static/integrations/install"
_ "github.com/grafana/alloy/internal/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
10 changes: 5 additions & 5 deletions docs/developer/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ To build Grafana Agent from source code, please install the following tools:

You can directly use the go tool to download and install the agent binary into your GOPATH:

$ GO111MODULE=on go install github.com/grafana/agent/cmd/alloy
$ GO111MODULE=on go install github.com/grafana/alloy/cmd/alloy
$ alloy run your_config.river

An example of the above configuration file can be found [here][example-config].
Expand All @@ -71,7 +71,7 @@ You can also clone the repository yourself and build using `make agent`:

$ mkdir -p $GOPATH/src/github.com/grafana
$ cd $GOPATH/src/github.com/grafana
$ git clone https://github.com/grafana/agent.git
$ git clone https://github.com/grafana/alloy.git
$ cd agent
$ make agent
$ ./build/alloy run your_config.river
Expand Down Expand Up @@ -197,13 +197,13 @@ acceptable, and remove the `replace` directive as soon as possible.
If upstream is unresponsive, consider choosing a different dependency or making
a hard fork (i.e., creating a new Go module with the same source).

[new-issue]: https://github.com/grafana/agent/issues/new
[new-issue]: https://github.com/grafana/alloy/issues/new
[RFC]: ../rfcs/0001-designing-in-the-open.md
[code-review-comments]: https://code.google.com/p/go-wiki/wiki/CodeReviewComments
[best-practices]: https://peter.bourgon.org/go-in-production/#formatting-and-style
[uber-style-guide]: https://github.com/uber-go/guide/blob/master/style.md
[CLA]: https://cla-assistant.io/grafana/agent
[good-first-issue]: https://github.com/grafana/agent/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22
[CLA]: https://cla-assistant.io/grafana/alloy
[good-first-issue]: https://github.com/grafana/alloy/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22
[community-slack]: https://slack.grafana.com/
[example-config]: ../../cmd/alloy/example-config.river
[go-modules]: https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more
2 changes: 1 addition & 1 deletion docs/developer/release/3-update-version-in-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The project must be updated to reference the upcoming release tag whenever a new

## Steps

1. Create a branch from `main` for [grafana/agent](https://github.com/grafana/agent).
1. Create a branch from `main` for [grafana/alloy](https://github.com/grafana/alloy).

2. Update the `CHANGELOG.md`:

Expand Down
10 changes: 5 additions & 5 deletions docs/developer/release/6-publish-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is how to publish the release in GitHub.

## Before you begin

1. You should see a new draft release created [here](https://github.com/grafana/agent/releases). If not go back to [Tag Release](./4-tag-release.md).
1. You should see a new draft release created [here](https://github.com/grafana/alloy/releases). If not go back to [Tag Release](./4-tag-release.md).

## Steps

Expand All @@ -14,9 +14,9 @@ This is how to publish the release in GitHub.

3. Add a footer to the `Notable Changes` section:

`For a full list of changes, please refer to the [CHANGELOG](https://github.com/grafana/agent/blob/RELEASE_VERSION/CHANGELOG.md)!`
Do not substitute the value for `CHANGELOG`.
`For a full list of changes, please refer to the [CHANGELOG](https://github.com/grafana/alloy/blob/RELEASE_VERSION/CHANGELOG.md)!`

Do not substitute the value for `CHANGELOG`.

4. At the bottom of the release page, perform the following:
- Tick the check box to "add a discussion" under the category for "announcements".
Expand All @@ -26,4 +26,4 @@ This is how to publish the release in GitHub.
5. Optionally, have other team members review the release draft if you wish
to feel more comfortable with it.

6. Publish the release!
6. Publish the release!
2 changes: 1 addition & 1 deletion docs/developer/release/8-update-helm-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Our Helm charts require some version updates as well.

3. Open a PR, following the pattern in PR [#2233](https://github.com/grafana/helm-charts/pull/2233).

4. Create a branch from `main` for [grafana/agent](https://github.com/grafana/agent).
4. Create a branch from `main` for [grafana/alloy](https://github.com/grafana/alloy).

5. Update the helm chart code in `$agentRepo/operations/helm`:

Expand Down
10 changes: 5 additions & 5 deletions docs/developer/release/9-announce-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ You made it! This is the last step for any release.

```
:grafana-agent: Grafana Agent RELEASE_VERSION is now available! :grafana-agent:
Release: https://github.com/grafana/agent/releases/tag/RELEASE_VERSION
Full changelog: https://github.com/grafana/agent/blob/RELEASE_VERSION/CHANGELOG.md
Release: https://github.com/grafana/alloy/releases/tag/RELEASE_VERSION
Full changelog: https://github.com/grafana/alloy/blob/RELEASE_VERSION/CHANGELOG.md
We'll be publishing STABLE_RELEASE_VERSION on STABLE_RELEASE_DATE if we haven't heard about any major issues.
```

- Example Stable Release or Patch Release message:

```
:grafana-agent: Grafana Agent RELEASE_VERSION is now available! :grafana-agent:
Release: https://github.com/grafana/agent/releases/tag/RELEASE_VERSION
Full changelog: https://github.com/grafana/agent/blob/RELEASE_VERSION/CHANGELOG.md
```
Release: https://github.com/grafana/alloy/releases/tag/RELEASE_VERSION
Full changelog: https://github.com/grafana/alloy/blob/RELEASE_VERSION/CHANGELOG.md
```
2 changes: 1 addition & 1 deletion docs/developer/release/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Releasing

This document describes the process of creating a release for the
`grafana/agent` repo. A release includes release assets for everything inside
`grafana/alloy` repo. A release includes release assets for everything inside
the repository, including Grafana Agent and Grafana Agent Operator.

The processes described here are for v0.24.0 and above.
Expand Down
2 changes: 1 addition & 1 deletion docs/rfcs/0000-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

* Date: YYYY-MM-DD
* Author: Full Name (@github_username)
* PR: [grafana/agent#XXXX](https://github.com/grafana/agent/pull/XXXX)
* PR: [grafana/agent#XXXX](https://github.com/grafana/alloy/pull/XXXX)
6 changes: 3 additions & 3 deletions docs/rfcs/0001-designing-in-the-open.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Public proposals may take one of two forms:
### Issues

Issues are the quickest path towards proposing a change. Issue proposals must
be opened at the [grafana/agent issues page](https://github.com/grafana/agent/issues).
be opened at the [issues page](https://github.com/grafana/alloy/issues).

There are no strict set of rules for issue-based proposals, but authors are
recommended to prefix the issue title with `Proposal:` so it may be found more
Expand Down Expand Up @@ -155,5 +155,5 @@ A few existing public proposal processes have been examined for inspiration:
All of these processes are similar, but in the end, the current objective is to
start collecting proposals publicly rather than to be prescriptive yet.

[rough consensus]: https://github.com/grafana/agent/blob/main/GOVERNANCE.md#technical-decisions
[governance]: https://github.com/grafana/agent/blob/main/GOVERNANCE.md#team-members
[rough consensus]: https://github.com/grafana/alloy/blob/main/GOVERNANCE.md#technical-decisions
[governance]: https://github.com/grafana/alloy/blob/main/GOVERNANCE.md#team-members
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ from `prometheus.exporter.github`:
```river
prometheus.exporter.github "example" {
api_token_file = "/etc/github-api-token"
repositories = ["grafana/agent"]
repositories = ["grafana/alloy"]
}

// Configure a prometheus.scrape component to collect github metrics.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,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/alloy/blob/main/internal/static/integrations/node_exporter/config.go) for up-to-date values on each OS.

| Name | Type | Description | Default | Required |
| ---------------------- | ---------- | ------------------------------------------------------------------- | ----------------------------------------------- | -------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/tutorials/assets/runt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tuto
mkdir -p ./grafana/dashboards
curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/grafana/dashboards/template.jsonnet -o ./grafana/dashboards/template.jsonnet
curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/grafana/dashboards/agent.json -o ./grafana/dashboards/agent.json
docker pull grafana/agent:main
docker pull grafana/agent:main
CONFIG_FILE=$1 docker-compose -f ./docker-compose.yaml up
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/grafana/agent
module github.com/grafana/alloy

go 1.22.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package agentseed
package alloyseed

import (
"encoding/json"
Expand All @@ -11,21 +11,29 @@ import (

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

// AgentSeed identifies a unique agent
type AgentSeed struct {
// Seed identifies a unique agent.
type Seed struct {
UID string `json:"UID"`
CreatedAt time.Time `json:"created_at"`
Version string `json:"version"`
}

const HeaderName = "X-Agent-Id"
const filename = "agent_seed.json"
const (
// Both LegacyHeaderName and HeaderName should be used to identify the Alloy
// instance in the headers of requests. LegacyHeaderName is used for
// backwards compatibility.

var savedSeed *AgentSeed
LegacyHeaderName = "X-Agent-Id" // LegacyHeaderName represents the header name used prior to the Alloy release.
HeaderName = "X-Alloy-Id" // HeaderName represents the ID header to use for Alloy.
)

const filename = "alloy_seed.json"

var savedSeed *Seed
var once sync.Once

// Init should be called by an app entrypoint as soon as it can to configure where the unique seed will be stored.
Expand All @@ -43,7 +51,7 @@ func Init(dir string, l log.Logger) {

func loadOrGenerate(dir string, l log.Logger) {
var err error
var seed *AgentSeed
var seed *Seed
// list of paths in preference order.
// we will always write to the first path
paths := []string{}
Expand Down Expand Up @@ -76,18 +84,18 @@ func loadOrGenerate(dir string, l log.Logger) {
}
}

func generateNew() *AgentSeed {
return &AgentSeed{
func generateNew() *Seed {
return &Seed{
UID: uuid.NewString(),
Version: version.Version,
CreatedAt: time.Now(),
}
}

// Get will return a unique agent seed for this agent.
// Get returns a unique seed for this Alloy instance.
// It will always return a valid seed, even if previous attempts to
// load or save the seed file have failed
func Get() *AgentSeed {
func Get() *Seed {
// Init should have been called before this. If not, call it now with defaults.
once.Do(func() {
loadOrGenerate("", log.NewNopLogger())
Expand All @@ -100,14 +108,14 @@ func Get() *AgentSeed {
return generateNew()
}

// readSeedFile reads the agent seed file
func readSeedFile(path string, logger log.Logger) (*AgentSeed, error) {
// readSeedFile reads the Alloy seed file
func readSeedFile(path string, logger log.Logger) (*Seed, error) {
data, err := os.ReadFile(path)
if err != nil {
level.Error(logger).Log("msg", "Reading seed file", "err", err)
return nil, err
}
seed := &AgentSeed{}
seed := &Seed{}
err = json.Unmarshal(data, seed)
if err != nil {
level.Error(logger).Log("msg", "Decoding seed file", "err", err)
Expand All @@ -134,8 +142,8 @@ func fileExists(path string) bool {
return !errors.Is(err, os.ErrNotExist)
}

// writeSeedFile writes the agent seed file
func writeSeedFile(seed *AgentSeed, path string, logger log.Logger) {
// writeSeedFile writes the Alloy seed file
func writeSeedFile(seed *Seed, path string, logger log.Logger) {
data, err := json.Marshal(*seed)
if err != nil {
level.Error(logger).Log("msg", "Encoding seed file", "err", err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package agentseed
package alloyseed

import (
"os"
Expand Down
7 changes: 0 additions & 7 deletions internal/cmd/agentlint/go.mod

This file was deleted.

6 changes: 0 additions & 6 deletions internal/cmd/agentlint/go.sum

This file was deleted.

16 changes: 0 additions & 16 deletions internal/cmd/agentlint/main.go

This file was deleted.

Loading
Loading