Skip to content

Commit a2c9566

Browse files
committed
Merge branch 'v3' into fix-otel-logging-container
2 parents 338f79f + 3dad265 commit a2c9566

File tree

19 files changed

+96
-80
lines changed

19 files changed

+96
-80
lines changed

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
}

internal/collector/nginxossreceiver/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ status:
77
beta: [metrics]
88
distributions: [contrib]
99
codeowners:
10-
active: [aphralG, dhurley, craigell, sean-breen, Rashmiti, CVanF5]
10+
active: [ aphralG, dhurley, craigell, sean-breen, CVanF5 ]
1111

1212
resource_attributes:
1313
instance.id:

internal/collector/nginxplusreceiver/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ status:
77
beta: [metrics]
88
distributions: [contrib]
99
codeowners:
10-
active: [aphralG, dhurley, craigell, sean-breen, Rashmiti, CVanF5]
10+
active: [ aphralG, dhurley, craigell, sean-breen, CVanF5 ]
1111

1212
resource_attributes:
1313
instance.id:

internal/collector/otel_collector_plugin.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ import (
2626
)
2727

2828
const (
29-
maxTimeToWaitForShutdown = 30 * time.Second
30-
filePermission = 0o600
29+
maxTimeToWaitForShutdown = 30 * time.Second
30+
defaultCollectionInterval = 1 * time.Minute
31+
filePermission = 0o600
3132
// To conform to the rfc3164 spec the timestamp in the logs need to be formatted correctly.
3233
// Here are some examples of what the timestamp conversions look like.
3334
// Notice how if the day begins with a zero that the zero is replaced with an empty space.
@@ -405,6 +406,7 @@ func (oc *Collector) checkForNewReceivers(nginxConfigContext *model.NginxConfigC
405406
Listen: nginxConfigContext.PlusAPI.Listen,
406407
Location: nginxConfigContext.PlusAPI.Location,
407408
},
409+
CollectionInterval: defaultCollectionInterval,
408410
},
409411
)
410412

@@ -438,7 +440,8 @@ func (oc *Collector) addNginxOssReceiver(nginxConfigContext *model.NginxConfigCo
438440
Listen: nginxConfigContext.StubStatus.Listen,
439441
Location: nginxConfigContext.StubStatus.Location,
440442
},
441-
AccessLogs: toConfigAccessLog(nginxConfigContext.AccessLogs),
443+
AccessLogs: toConfigAccessLog(nginxConfigContext.AccessLogs),
444+
CollectionInterval: defaultCollectionInterval,
442445
},
443446
)
444447

internal/collector/otel_collector_plugin_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ func TestCollector_ProcessNginxConfigUpdateTopic(t *testing.T) {
184184
Listen: "",
185185
Location: "",
186186
},
187+
CollectionInterval: defaultCollectionInterval,
187188
},
188189
},
189190
},
@@ -229,6 +230,7 @@ func TestCollector_ProcessNginxConfigUpdateTopic(t *testing.T) {
229230
LogFormat: "$$remote_addr - $$remote_user [$$time_local] \\\"$$request\\\"",
230231
},
231232
},
233+
CollectionInterval: defaultCollectionInterval,
232234
},
233235
},
234236
},

internal/collector/otelcol.tmpl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ receivers:
8181
url: "{{- .StubStatus.URL -}}"
8282
listen: "{{- .StubStatus.Listen -}}"
8383
location: "{{- .StubStatus.Location -}}"
84-
collection_interval: 10s
84+
{{- if .CollectionInterval }}
85+
collection_interval: {{ .CollectionInterval }}
86+
{{- end }}
8587
{{- if gt (len .AccessLogs) 0 }}
8688
access_logs:
8789
{{- range .AccessLogs }}
@@ -96,7 +98,9 @@ receivers:
9698
url: "{{- .PlusAPI.URL -}}"
9799
listen: "{{- .PlusAPI.Listen -}}"
98100
location: "{{- .PlusAPI.Location -}}"
99-
collection_interval: 10s
101+
{{- if .CollectionInterval }}
102+
collection_interval: {{ .CollectionInterval }}
103+
{{- end }}
100104
{{- end }}
101105
{{- range $index, $tcplogReceiver := .Receivers.TcplogReceivers }}
102106
tcplog/{{$index}}:

internal/collector/settings_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ func TestTemplateWrite(t *testing.T) {
9797
Location: "",
9898
Listen: "",
9999
},
100+
CollectionInterval: 30 * time.Second,
100101
AccessLogs: []config.AccessLog{
101102
{
102103
LogFormat: accessLogFormat,

internal/config/config_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
"testing"
1313
"time"
1414

15+
"github.com/nginx/agent/v3/pkg/config"
16+
1517
"github.com/nginx/agent/v3/test/helpers"
1618

1719
"github.com/stretchr/testify/require"
@@ -886,11 +888,13 @@ func createConfig() *Config {
886888
FilePath: "/var/log/nginx/access-custom.conf",
887889
},
888890
},
891+
CollectionInterval: 30 * time.Second,
889892
},
890893
},
891894
NginxPlusReceivers: []NginxPlusReceiver{
892895
{
893-
InstanceID: "cd7b8911-c2c5-4daf-b311-dbead151d939",
896+
InstanceID: "cd7b8911-c2c5-4daf-b311-dbead151d939",
897+
CollectionInterval: 30 * time.Second,
894898
},
895899
},
896900
HostMetrics: &HostMetrics{
@@ -970,5 +974,9 @@ func createConfig() *Config {
970974
"label2": "new-value",
971975
"label3": 123,
972976
},
977+
Features: []string{
978+
config.FeatureCertificates, config.FeatureFileWatcher, config.FeatureMetrics,
979+
config.FeatureAPIAction, config.FeatureLogsNap,
980+
},
973981
}
974982
}

0 commit comments

Comments
 (0)