Skip to content

Commit 12b1454

Browse files
committed
Dir creation in collector startup
1 parent 01ca6bb commit 12b1454

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

internal/collector/pgbouncer.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ func EnablePgBouncerLogging(ctx context.Context,
5454

5555
// Keep track of what log records and files have been processed.
5656
// Use a subdirectory of the logs directory to stay within the same failure domain.
57-
// TODO(log-rotation): Create this directory during Collector startup.
5857
//
5958
// https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/-/extension/storage/filestorage#readme
6059
outConfig.Extensions["file_storage/pgbouncer_logs"] = map[string]any{
6160
"directory": directory + "/receiver",
62-
"create_directory": true,
61+
"create_directory": false,
6362
"fsync": true,
6463
}
6564

internal/collector/pgbouncer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exporters:
3535
verbosity: detailed
3636
extensions:
3737
file_storage/pgbouncer_logs:
38-
create_directory: true
38+
create_directory: false
3939
directory: /tmp/receiver
4040
fsync: true
4141
processors:
@@ -124,7 +124,7 @@ exporters:
124124
project: google-project-name
125125
extensions:
126126
file_storage/pgbouncer_logs:
127-
create_directory: true
127+
create_directory: false
128128
directory: /tmp/receiver
129129
fsync: true
130130
processors:

internal/controller/postgrescluster/instance.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,10 @@ func (r *Reconciler) reconcileInstance(
12191219
}
12201220

12211221
// For now, we are not using logrotate to rotate postgres or patroni logs
1222+
// but we are using it for pgbackrest logs in the postgres pod
12221223
collector.AddToPod(ctx, cluster.Spec.Instrumentation, cluster.Spec.ImagePullPolicy, instanceConfigMap, &instance.Spec.Template.Spec,
1223-
[]corev1.VolumeMount{postgres.DataVolumeMount()}, pgPassword, []string{}, false)
1224+
[]corev1.VolumeMount{postgres.DataVolumeMount()}, pgPassword,
1225+
[]string{naming.PGBackRestPGDataLogPath}, true)
12241226
}
12251227

12261228
// Add postgres-exporter to the instance Pod spec

internal/pgbouncer/reconcile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func Pod(
192192

193193
if feature.Enabled(ctx, feature.OpenTelemetryLogs) || feature.Enabled(ctx, feature.OpenTelemetryMetrics) {
194194
collector.AddToPod(ctx, inCluster.Spec.Instrumentation, inCluster.Spec.ImagePullPolicy, inConfigMap,
195-
outPod, []corev1.VolumeMount{configVolumeMount}, string(inSecret.Data["pgbouncer-password"]), []string{},
195+
outPod, []corev1.VolumeMount{configVolumeMount}, string(inSecret.Data["pgbouncer-password"]), []string{naming.PGBouncerLogPath},
196196
true)
197197
}
198198
}

0 commit comments

Comments
 (0)