Skip to content

Commit 22547a6

Browse files
committed
Merge remote-tracking branch 'origin/main' into update-mock-collector-grafana-dashboards
2 parents 1d7f847 + ceaece5 commit 22547a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+51741
-206
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ jobs:
9090
strategy:
9191
matrix:
9292
container:
93-
- image: "ubuntu"
94-
version: "22.04"
9593
- image: "redhatenterprise"
9694
version: "9"
9795
- image: "alpine"

.github/workflows/release-branch.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ jobs:
8585
name: Update Release Draft
8686
runs-on: ubuntu-22.04
8787
needs: [vars]
88+
permissions:
89+
contents: write
8890
outputs:
8991
release_id: ${{ steps.vars.outputs.RELEASE_ID }}
9092
steps:
@@ -104,6 +106,7 @@ jobs:
104106
version: ${{ inputs.packageVersion }}
105107
with:
106108
script: |
109+
const ref = context.ref.split("/")[2]
107110
const {version} = process.env
108111
console.log(`The release version is v${version}`)
109112
@@ -181,6 +184,8 @@ jobs:
181184
name: Tag Release
182185
runs-on: ubuntu-22.04
183186
needs: [vars,release-draft]
187+
permissions:
188+
contents: write
184189
steps:
185190
- name: Checkout Repository
186191
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
@@ -205,7 +210,7 @@ jobs:
205210
needs: [vars,release-draft,tag-release]
206211
permissions:
207212
id-token: write
208-
contents: read
213+
contents: write
209214
steps:
210215
- name: Checkout Repository
211216
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
@@ -327,6 +332,8 @@ jobs:
327332
name: Merge release branch back into V3 branch
328333
runs-on: ubuntu-22.04
329334
needs: [vars,tag-release]
335+
permissions:
336+
pull-requests: write
330337
steps:
331338
- name: Checkout Repository
332339
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $(shell mkdir -p $(DIRS))
4949
VERSION ?= "v3.0.0"
5050
COMMIT = $(shell git rev-parse --short HEAD)
5151
DATE = $(shell date +%F_%H-%M-%S)
52-
LDFLAGS = "-w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"
52+
LDFLAGS = "-s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"
5353
DEBUG_LDFLAGS = "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)"
5454

5555
OSS_PACKAGES_REPO := "packages.nginx.org"
@@ -114,8 +114,9 @@ no-local-changes:
114114
git diff --quiet || { echo "Dependency changes detected. Please commit these before pushing." >&2; exit 1; }
115115

116116
build: ## Build agent executable
117+
@echo "🏗️ Building"
117118
mkdir -p $(BUILD_DIR)
118-
@GOARCH=$(OSARCH) $(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) -pgo=default.pgo -ldflags=$(LDFLAGS) $(PROJECT_DIR)/$(PROJECT_FILE)
119+
GOARCH=$(OSARCH) $(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) -pgo=default.pgo -ldflags=$(LDFLAGS) $(PROJECT_DIR)/$(PROJECT_FILE)
119120
@echo "📦 Build Done"
120121

121122
lint: ## Run linter
@@ -180,7 +181,7 @@ run: build ## Run code
180181

181182
dev: ## Run agent executable
182183
@echo "🚀 Running App"
183-
$(GORUN) -ldflags=$(LDFLAGS) $(PROJECT_DIR)/$(PROJECT_FILE)
184+
$(GORUN) -ldflags=$(DEBUG_LDFLAGS) $(PROJECT_DIR)/$(PROJECT_FILE)
184185

185186
race-condition-dev: ## Run agent executable with race condition detection
186187
@echo "🏎️ Running app with race condition detection enabled"

Makefile.packaging

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,3 @@ gpg-key: ## Generate GPG public key
213213
release: ## Publish tarball to the UPLOAD_URL
214214
echo "Publishing nginx-agent packages to ${UPLOAD_URL}"; \
215215
curl -XPOST --fail -F "file=@$(PACKAGES_DIR)/$(TARBALL_NAME)" -H "Token: ${TOKEN}" ${UPLOAD_URL}; \
216-
curl -XPOST --fail -F "file=@$(GPG_PUBLIC_KEY)" -H "Token: ${TOKEN}" ${UPLOAD_URL}; \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The following packages need to be installed:
2424
```
2525
git clone https://github.com/open-telemetry/opentelemetry-collector.git
2626
cd opentelemetry-collector
27-
git checkout v0.114.0
27+
git checkout v0.124.0
2828
cd cmd/mdatagen
2929
go install
3030
```

api/grpc/mpi/v1/command.pb.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/mpi/v1/command.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ message HostInfo {
6565
// The host identifier
6666
string host_id = 1 [(buf.validate.field).string.uuid = true];
6767
// The name of the host
68-
string hostname = 2 [(buf.validate.field).string.address = true];
68+
string hostname = 2;
6969
// Release information of the host
7070
ReleaseInfo release_info = 3;
7171
}
@@ -89,7 +89,7 @@ message ContainerInfo {
8989
// The identifier of the container
9090
string container_id = 1 [(buf.validate.field).string.uuid = true];
9191
// The name of the host
92-
string hostname = 2 [(buf.validate.field).string.address = true];
92+
string hostname = 2;
9393
// Release information of the container
9494
ReleaseInfo release_info = 3;
9595
}

default.pgo

-44.6 KB
Binary file not shown.

internal/collector/nginxossreceiver/internal/scraper/accesslog/nginx_log_scraper.go

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package accesslog
77

88
import (
99
"context"
10+
"errors"
1011
"fmt"
1112
"strconv"
1213
"sync"
@@ -42,7 +43,7 @@ type (
4243
logger *zap.Logger
4344
mb *metadata.MetricsBuilder
4445
rb *metadata.ResourceBuilder
45-
pipe *pipeline.DirectedPipeline
46+
pipes []*pipeline.DirectedPipeline
4647
wg *sync.WaitGroup
4748
cancel context.CancelFunc
4849
entries []*entry.Entry
@@ -103,20 +104,27 @@ func (nls *NginxLogScraper) ID() component.ID {
103104
return component.NewID(metadata.Type)
104105
}
105106

107+
// nolint: unparam
106108
func (nls *NginxLogScraper) Start(parentCtx context.Context, _ component.Host) error {
107109
nls.logger.Info("NGINX access log scraper started")
108110
ctx, cancel := context.WithCancel(parentCtx)
109111
nls.cancel = cancel
110112

111-
var err error
112-
nls.pipe, err = nls.initStanzaPipeline(nls.operators, nls.logger)
113-
if err != nil {
114-
return fmt.Errorf("init stanza pipeline: %w", err)
113+
for _, op := range nls.operators {
114+
nls.logger.Info("Initializing NGINX access log scraper pipeline", zap.Any("operator_id", op.ID()))
115+
pipe, err := nls.initStanzaPipeline([]operator.Config{op}, nls.logger)
116+
if err != nil {
117+
nls.logger.Error("Error initializing pipeline", zap.Any("operator_id", op.ID()), zap.Any("error", err))
118+
continue
119+
}
120+
nls.pipes = append(nls.pipes, pipe)
115121
}
116122

117-
startError := nls.pipe.Start(storage.NewNopClient())
118-
if startError != nil {
119-
return fmt.Errorf("stanza pipeline start: %w", startError)
123+
for _, pipe := range nls.pipes {
124+
startError := pipe.Start(storage.NewNopClient())
125+
if startError != nil {
126+
nls.logger.Error("Error starting pipeline", zap.Any("error", startError))
127+
}
120128
}
121129

122130
nls.wg.Add(1)
@@ -206,7 +214,14 @@ func (nls *NginxLogScraper) Shutdown(_ context.Context) error {
206214
}
207215
nls.wg.Wait()
208216

209-
return nls.pipe.Stop()
217+
var err error
218+
for _, pipe := range nls.pipes {
219+
if stopErr := pipe.Stop(); stopErr != nil {
220+
err = errors.Join(err, stopErr)
221+
}
222+
}
223+
224+
return err
210225
}
211226

212227
func (nls *NginxLogScraper) initStanzaPipeline(

internal/collector/nginxossreceiver/internal/scraper/accesslog/nginx_log_scraper_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,6 @@ func TestAccessLogScraper(t *testing.T) {
8282
pmetrictest.IgnoreResourceAttributeValue("instance.id")))
8383
}
8484

85-
func TestAccessLogScraperError(t *testing.T) {
86-
t.Run("include config missing", func(tt *testing.T) {
87-
logScraper := NewScraper(receivertest.NewNopSettings(component.Type{}), &config.Config{})
88-
err := logScraper.Start(context.Background(), componenttest.NewNopHost())
89-
require.Error(tt, err)
90-
assert.Contains(tt, err.Error(), "init stanza pipeline")
91-
})
92-
}
93-
9485
// Copies the contents of one file to another with the given delay. Used to simulate writing log entries to a log file.
9586
// Reason for nolint: we must use testify's assert instead of require,
9687
// for more info see https://github.com/stretchr/testify/issues/772#issuecomment-945166599

0 commit comments

Comments
 (0)