Skip to content

Commit a1de993

Browse files
committed
Merge branch 'main' into add-max-access-log-files
2 parents b02fd81 + 6d95d70 commit a1de993

File tree

72 files changed

+2151
-953
lines changed

Some content is hidden

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

72 files changed

+2151
-953
lines changed

.github/workflows/assertion.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ on:
3939
ARTIFACTORY_URL:
4040
required: true
4141

42+
permissions:
43+
contents: read
44+
4245
jobs:
4346
build-assertion-document:
4447
name: Create Assertion Document

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
8282
with:
8383
version: v2.4.0
84+
skip-cache: true
8485

8586
vulnerability-scan:
8687
name: Vulnerability Scan
@@ -657,7 +658,7 @@ jobs:
657658
path: build
658659

659660
- name: Set up Docker Build
660-
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
661+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
661662

662663
- name: Set env
663664
run: echo "GO_VERSION=$(cat go.mod | grep toolchain | sed 's/toolchain //; s/go//')" >> $GITHUB_ENV

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
- name: "Dependency Review"
2828
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2
2929
with:
30-
config-file: "nginxinc/k8s-common/dependency-review-config.yml@main"
30+
config-file: "nginx/k8s-common/dependency-review-config.yml@main"

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ jobs:
5555

5656
# Upload the results to GitHub's code scanning dashboard.
5757
- name: "Upload to code-scanning"
58-
uses: github/codeql-action/upload-sarif@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8
58+
uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
5959
with:
6060
sarif_file: results.sarif

.github/workflows/vulncheck.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
required: false
1515
default: 'main'
1616

17+
permissions:
18+
contents: read
19+
1720
jobs:
1821
vulncheck:
1922
name: Vulnerability Check
@@ -25,7 +28,7 @@ jobs:
2528
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
2629
with:
2730
fetch-depth: 0
28-
ref: ${{ inputs.targetBranch || 'main' }}
31+
ref: ${{ inputs.target-branch || 'main' }}
2932

3033
- name: Check Go version
3134
id: get-go-version

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ whitesource/
77
.vscode/
88
.idea/
99
*.log
10+
!**/testdata/*.log
1011
*.test
1112
*.orig
1213
sdk/certs/**

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ $(RPM_PACKAGE):
110110
include Makefile.tools
111111
include Makefile.containers
112112
include Makefile.packaging
113+
include Makefile.weaver
113114

114115
.PHONY: help clean no-local-changes build lint format unit-test integration-test run dev run-mock-management-grpc-server generate generate-mocks local-apk-package local-deb-package local-rpm-package
115116
help: ## Show help message
@@ -282,7 +283,7 @@ stop-mock-otel-collector-without-nap: ## Stop running mock management plane OTel
282283
@echo "Stopping mock management plane OTel collector without NAP"
283284
AGENT_IMAGE_WITH_NGINX_PLUS=nginx_plus_$(IMAGE_TAG):latest AGENT_IMAGE_WITH_NGINX_OSS=nginx_oss_$(IMAGE_TAG):latest $(CONTAINER_COMPOSE) -f ./test/mock/collector/docker-compose.yaml down
284285

285-
generate: ## Generate golang code
286+
generate: nginx-metadata-gen nginxplus-metadata-gen ## Generate golang code
286287
@echo "🗄️ Generating proto files"
287288
@cd api/grpc && $(GORUN) $(BUF) generate
288289
@echo "🗃️ Generating go files"

Makefile.weaver

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
2+
# https://github.com/open-telemetry/weaver #
3+
# These images are for invoking weaver #
4+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
5+
6+
# From where to resolve the containers (e.g. "otel/weaver").
7+
CONTAINER_REPOSITORY=docker.io
8+
9+
# Per container overrides for the repository resolution.
10+
WEAVER_CONTAINER_REPOSITORY=$(CONTAINER_REPOSITORY)
11+
SEMCONVGEN_CONTAINER_REPOSITORY=$(CONTAINER_REPOSITORY)
12+
OPA_CONTAINER_REPOSITORY=$(CONTAINER_REPOSITORY)
13+
14+
CHECK_TARGETS=install-tools markdownlint
15+
16+
# Versioned, non-qualified references to containers used in this Makefile.
17+
# These are parsed from dependencies.Dockerfile so dependabot will autoupdate
18+
# the versions of docker files we use.
19+
VERSIONED_WEAVER_CONTAINER_NO_REPO=$(shell cat dependencies.Dockerfile | awk '$$4=="weaver" {print $$2}')
20+
VERSIONED_SEMCONVGEN_CONTAINER_NO_REPO=$(shell cat dependencies.Dockerfile | awk '$$4=="semconvgen" {print $$2}')
21+
VERSIONED_OPA_CONTAINER_NO_REPO=$(shell cat dependencies.Dockerfile | awk '$$4=="opa" {print $$2}')
22+
23+
# Fully qualified references to containers used in this Makefile. These
24+
# include the container repository, so that the build will work with tools
25+
# like "podman" with a default "/etc/containers/registries.conf", where
26+
# a default respository of "docker.io" is not assumed. This is intended to
27+
# eliminate errors from podman such as:
28+
#
29+
# Error: short-name "otel/weaver:v1.2.3" did not resolve to an alias
30+
# and no unqualified-search registries are defined in "/etc/containers/registries.conf"
31+
WEAVER_CONTAINER=$(WEAVER_CONTAINER_REPOSITORY)/$(VERSIONED_WEAVER_CONTAINER_NO_REPO)
32+
SEMCONVGEN_CONTAINER=$(SEMCONVGEN_CONTAINER_REPOSITORY)/$(VERSIONED_SEMCONVGEN_CONTAINER_NO_REPO)
33+
OPA_CONTAINER=$(OPA_CONTAINER_REPOSITORY)/$(VERSIONED_OPA_CONTAINER_NO_REPO)
34+
35+
# Determine if "docker" is actually podman
36+
DOCKER_VERSION_OUTPUT := $(shell docker --version 2>&1)
37+
DOCKER_IS_PODMAN := $(shell echo $(DOCKER_VERSION_OUTPUT) | grep -c podman)
38+
39+
ifeq ($(DOCKER_IS_PODMAN),0)
40+
DOCKER_COMMAND := docker
41+
else
42+
DOCKER_COMMAND := podman
43+
endif
44+
45+
# Debug printing
46+
ifdef DEBUG
47+
$(info Docker version output: $(DOCKER_VERSION_OUTPUT))
48+
$(info Is Docker actually Podman? $(DOCKER_IS_PODMAN))
49+
$(info Using command: $(DOCKER_COMMAND))
50+
endif
51+
52+
DOCKER_RUN=$(DOCKER_COMMAND) run
53+
DOCKER_USER=$(shell id -u):$(shell id -g)
54+
DOCKER_USER_IS_HOST_USER_ARG=-u $(DOCKER_USER)
55+
ifeq ($(DOCKER_COMMAND),podman)
56+
# On podman, additional arguments are needed to make "-u" work
57+
# correctly with the host user ID and host group ID.
58+
#
59+
# Error: OCI runtime error: crun: setgroups: Invalid argument
60+
DOCKER_USER_IS_HOST_USER_ARG=--userns=keep-id -u $(DOCKER_USER)
61+
endif
62+
63+
# Generate attribute registry metadata for mdatagen.
64+
# Example uses:
65+
# make nginxplus-metadata-gen
66+
# make nginx-metadata-gen
67+
.PHONY: %-metadata-gen
68+
%-metadata-gen:
69+
$(DOCKER_RUN) --rm \
70+
$(DOCKER_USER_IS_HOST_USER_ARG) \
71+
--mount 'type=bind,source=$(PWD)/templates,target=/home/weaver/templates,readonly' \
72+
--mount 'type=bind,source=$(PWD)/catalog/$*,target=/home/weaver/source/,readonly' \
73+
--mount 'type=bind,source=$(PWD)/internal/collector,target=/home/weaver/target' \
74+
$(WEAVER_CONTAINER) registry generate \
75+
--registry=/home/weaver/source \
76+
--templates=/home/weaver/templates \
77+
metadata \
78+
/home/weaver/target/$*receiver
79+
cat $(PWD)/internal/collector/$*receiver/*_metadata.yaml > $(PWD)/internal/collector/$*receiver/metadata.yaml
80+
rm $(PWD)/internal/collector/$*receiver/*_metadata.yaml
81+
@echo "🗃️ Generating go files"
82+
@$(GOGEN) $(PWD)/internal/collector/$*receiver/...

catalog/nginx/metrics.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/v0.9.2/schemas/semconv.schema.json
2+
groups:
3+
# nginx.http.* metrics
4+
- id: metric.nginx.http.connections
5+
type: metric
6+
unit: "connections"
7+
metric_name: nginx.http.connections
8+
stability: experimental
9+
brief: "The total number of connections, since NGINX was last started or reloaded."
10+
instrument: counter
11+
note: |
12+
Source: HTTP GET `/status`
13+
attributes:
14+
- ref: nginx.connections.outcome
15+
requirement_level: required
16+
17+
- id: metric.nginx.http.connection.count
18+
type: metric
19+
unit: "connections"
20+
metric_name: nginx.http.connection.count
21+
stability: experimental
22+
brief: "The current number of connections."
23+
instrument: gauge
24+
note: |
25+
Source: HTTP GET `/status`
26+
attributes:
27+
- ref: nginx.connections.outcome
28+
requirement_level: required
29+
30+
- id: metric.nginx.http.requests
31+
type: metric
32+
unit: "requests"
33+
metric_name: nginx.http.requests
34+
stability: experimental
35+
brief: "The total number of client requests received, since NGINX was last started or reloaded."
36+
instrument: counter
37+
note: |
38+
Source: HTTP GET `/status`
39+
attributes: []
40+
41+
- id: metric.nginx.http.request.count
42+
type: metric
43+
unit: "requests"
44+
metric_name: nginx.http.request.count
45+
stability: experimental
46+
brief: "The total number of client requests received, since the last collection interval."
47+
instrument: gauge
48+
note: |
49+
Source: HTTP API `/status`
50+
attributes: []
51+
52+
- id: metric.nginx.http.response.count
53+
type: metric
54+
unit: "responses"
55+
metric_name: nginx.http.response.count
56+
stability: experimental
57+
brief: "The total number of HTTP responses since the last collection interval, grouped by status code range."
58+
instrument: gauge
59+
note: |
60+
Source: Logs `access.log`
61+
attributes:
62+
- ref: nginx.status_range
63+
requirement_level: required

catalog/nginx/registry.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/v0.9.2/schemas/semconv.schema.json
2+
groups:
3+
# General NGINX OSS attributes
4+
- id: registry.nginx
5+
type: attribute_group
6+
stability: experimental
7+
display_name: General NGINX OSS Attributes
8+
brief: "Describes NGINX attributes"
9+
attributes:
10+
- id: nginx.status_range
11+
type: string
12+
stability: development
13+
brief: "A status code range or bucket for a HTTP response's status code."
14+
examples: ["1xx","2xx","3xx","4xx","5xx"]
15+
- id: nginx.connections.outcome
16+
type: string
17+
stability: development
18+
brief: "The outcome of a connection"
19+
examples: ["ACCEPTED","ACTIVE","HANDLED","READING","WRITING","WAITING"]

0 commit comments

Comments
 (0)