Skip to content

Commit 1db1e33

Browse files
authored
1 parent 94ffaae commit 1db1e33

File tree

3 files changed

+155
-0
lines changed

3 files changed

+155
-0
lines changed

docs/resources/settings.md

+15
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ The settings are global object.
8282
- `log_level` (String) Log level
8383
- `logo_url` (String) A URL pointing to your logo. Defaults to Pomerium's Logo.
8484
- `metrics_address` (String) Metrics address
85+
- `otel_attribute_value_length_limit` (Number) OpenTelemetry attribute value length limit
86+
- `otel_bsp_max_export_batch_size` (Number) OpenTelemetry BSP max export batch size
87+
- `otel_bsp_schedule_delay` (String) OpenTelemetry BSP schedule delay
88+
- `otel_exporter_otlp_endpoint` (String) OpenTelemetry OTLP exporter endpoint
89+
- `otel_exporter_otlp_headers` (Set of String) OpenTelemetry OTLP exporter headers
90+
- `otel_exporter_otlp_protocol` (String) OpenTelemetry OTLP exporter protocol
91+
- `otel_exporter_otlp_timeout` (String) OpenTelemetry OTLP exporter timeout
92+
- `otel_exporter_otlp_traces_endpoint` (String) OpenTelemetry OTLP traces endpoint
93+
- `otel_exporter_otlp_traces_headers` (Set of String) OpenTelemetry OTLP traces headers
94+
- `otel_exporter_otlp_traces_protocol` (String) OpenTelemetry OTLP traces protocol
95+
- `otel_exporter_otlp_traces_timeout` (String) OpenTelemetry OTLP traces timeout
96+
- `otel_log_level` (String) OpenTelemetry log level
97+
- `otel_resource_attributes` (Set of String) OpenTelemetry resource attributes
98+
- `otel_traces_exporter` (String) OpenTelemetry traces exporter type
99+
- `otel_traces_sampler_arg` (Number) OpenTelemetry traces sampler argument
85100
- `pass_identity_headers` (Boolean) If applied, passes X-Pomerium-Jwt-Assertion header and JWT Claims Headers to all upstream applications.
86101
- `primary_color` (String) A hex code that determines the primary color for the Enterprise Console and Route Error Details pages.
87102
- `proxy_log_level` (String) Proxy log level

internal/provider/settings_model.go

+59
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,21 @@ type SettingsModel struct {
8484
TimeoutIdle timetypes.GoDuration `tfsdk:"timeout_idle"`
8585
TimeoutRead timetypes.GoDuration `tfsdk:"timeout_read"`
8686
TimeoutWrite timetypes.GoDuration `tfsdk:"timeout_write"`
87+
OtelTracesExporter types.String `tfsdk:"otel_traces_exporter"`
88+
OtelTracesSamplerArg types.Float64 `tfsdk:"otel_traces_sampler_arg"`
89+
OtelResourceAttributes types.Set `tfsdk:"otel_resource_attributes"`
90+
OtelLogLevel types.String `tfsdk:"otel_log_level"`
91+
OtelAttributeValueLengthLimit types.Int64 `tfsdk:"otel_attribute_value_length_limit"`
92+
OtelExporterOtlpEndpoint types.String `tfsdk:"otel_exporter_otlp_endpoint"`
93+
OtelExporterOtlpTracesEndpoint types.String `tfsdk:"otel_exporter_otlp_traces_endpoint"`
94+
OtelExporterOtlpProtocol types.String `tfsdk:"otel_exporter_otlp_protocol"`
95+
OtelExporterOtlpTracesProtocol types.String `tfsdk:"otel_exporter_otlp_traces_protocol"`
96+
OtelExporterOtlpHeaders types.Set `tfsdk:"otel_exporter_otlp_headers"`
97+
OtelExporterOtlpTracesHeaders types.Set `tfsdk:"otel_exporter_otlp_traces_headers"`
98+
OtelExporterOtlpTimeout timetypes.GoDuration `tfsdk:"otel_exporter_otlp_timeout"`
99+
OtelExporterOtlpTracesTimeout timetypes.GoDuration `tfsdk:"otel_exporter_otlp_traces_timeout"`
100+
OtelBspScheduleDelay timetypes.GoDuration `tfsdk:"otel_bsp_schedule_delay"`
101+
OtelBspMaxExportBatchSize types.Int64 `tfsdk:"otel_bsp_max_export_batch_size"`
87102
}
88103

89104
func ConvertSettingsToPB(
@@ -160,6 +175,28 @@ func ConvertSettingsToPB(
160175
ToDuration(&pbSettings.TimeoutWrite, src.TimeoutWrite, &diagnostics)
161176
JWTGroupsFilterToPB(ctx, &pbSettings.JwtGroupsFilter, src.JWTGroupsFilter, &diagnostics)
162177

178+
pbSettings.OtelTracesExporter = src.OtelTracesExporter.ValueStringPointer()
179+
pbSettings.OtelTracesSamplerArg = src.OtelTracesSamplerArg.ValueFloat64Pointer()
180+
ToStringSliceFromSet(ctx, &pbSettings.OtelResourceAttributes, src.OtelResourceAttributes, &diagnostics)
181+
pbSettings.OtelLogLevel = src.OtelLogLevel.ValueStringPointer()
182+
if !src.OtelAttributeValueLengthLimit.IsNull() {
183+
v := int32(src.OtelAttributeValueLengthLimit.ValueInt64())
184+
pbSettings.OtelAttributeValueLengthLimit = &v
185+
}
186+
pbSettings.OtelExporterOtlpEndpoint = src.OtelExporterOtlpEndpoint.ValueStringPointer()
187+
pbSettings.OtelExporterOtlpTracesEndpoint = src.OtelExporterOtlpTracesEndpoint.ValueStringPointer()
188+
pbSettings.OtelExporterOtlpProtocol = src.OtelExporterOtlpProtocol.ValueStringPointer()
189+
pbSettings.OtelExporterOtlpTracesProtocol = src.OtelExporterOtlpTracesProtocol.ValueStringPointer()
190+
ToStringSliceFromSet(ctx, &pbSettings.OtelExporterOtlpHeaders, src.OtelExporterOtlpHeaders, &diagnostics)
191+
ToStringSliceFromSet(ctx, &pbSettings.OtelExporterOtlpTracesHeaders, src.OtelExporterOtlpTracesHeaders, &diagnostics)
192+
ToDuration(&pbSettings.OtelExporterOtlpTimeout, src.OtelExporterOtlpTimeout, &diagnostics)
193+
ToDuration(&pbSettings.OtelExporterOtlpTracesTimeout, src.OtelExporterOtlpTracesTimeout, &diagnostics)
194+
ToDuration(&pbSettings.OtelBspScheduleDelay, src.OtelBspScheduleDelay, &diagnostics)
195+
if !src.OtelBspMaxExportBatchSize.IsNull() {
196+
v := int32(src.OtelBspMaxExportBatchSize.ValueInt64())
197+
pbSettings.OtelBspMaxExportBatchSize = &v
198+
}
199+
163200
return pbSettings, diagnostics
164201
}
165202

@@ -235,5 +272,27 @@ func ConvertSettingsFromPB(
235272
IdentityProviderSettingsFromPB(dst, src, &diagnostics)
236273
JWTGroupsFilterFromPB(&dst.JWTGroupsFilter, src.JwtGroupsFilter)
237274

275+
dst.OtelTracesExporter = types.StringPointerValue(src.OtelTracesExporter)
276+
if src.OtelTracesSamplerArg != nil {
277+
dst.OtelTracesSamplerArg = types.Float64Value(*src.OtelTracesSamplerArg)
278+
}
279+
dst.OtelResourceAttributes = FromStringSliceToSet(src.OtelResourceAttributes)
280+
dst.OtelLogLevel = types.StringPointerValue(src.OtelLogLevel)
281+
if src.OtelAttributeValueLengthLimit != nil {
282+
dst.OtelAttributeValueLengthLimit = types.Int64Value(int64(*src.OtelAttributeValueLengthLimit))
283+
}
284+
dst.OtelExporterOtlpEndpoint = types.StringPointerValue(src.OtelExporterOtlpEndpoint)
285+
dst.OtelExporterOtlpTracesEndpoint = types.StringPointerValue(src.OtelExporterOtlpTracesEndpoint)
286+
dst.OtelExporterOtlpProtocol = types.StringPointerValue(src.OtelExporterOtlpProtocol)
287+
dst.OtelExporterOtlpTracesProtocol = types.StringPointerValue(src.OtelExporterOtlpTracesProtocol)
288+
dst.OtelExporterOtlpHeaders = FromStringSliceToSet(src.OtelExporterOtlpHeaders)
289+
dst.OtelExporterOtlpTracesHeaders = FromStringSliceToSet(src.OtelExporterOtlpTracesHeaders)
290+
dst.OtelExporterOtlpTimeout = FromDuration(src.OtelExporterOtlpTimeout)
291+
dst.OtelExporterOtlpTracesTimeout = FromDuration(src.OtelExporterOtlpTracesTimeout)
292+
dst.OtelBspScheduleDelay = FromDuration(src.OtelBspScheduleDelay)
293+
if src.OtelBspMaxExportBatchSize != nil {
294+
dst.OtelBspMaxExportBatchSize = types.Int64Value(int64(*src.OtelBspMaxExportBatchSize))
295+
}
296+
238297
return diagnostics
239298
}

internal/provider/settings_schema.go

+81
Original file line numberDiff line numberDiff line change
@@ -462,5 +462,86 @@ var SettingsResourceSchema = schema.Schema{
462462
Optional: true,
463463
ElementType: types.StringType,
464464
},
465+
"otel_traces_exporter": schema.StringAttribute{
466+
Optional: true,
467+
Computed: true,
468+
Description: "OpenTelemetry traces exporter type",
469+
},
470+
"otel_traces_sampler_arg": schema.Float64Attribute{
471+
Optional: true,
472+
Computed: true,
473+
Description: "OpenTelemetry traces sampler argument",
474+
},
475+
"otel_resource_attributes": schema.SetAttribute{
476+
Optional: true,
477+
Computed: true,
478+
ElementType: types.StringType,
479+
Description: "OpenTelemetry resource attributes",
480+
},
481+
"otel_log_level": schema.StringAttribute{
482+
Optional: true,
483+
Computed: true,
484+
Description: "OpenTelemetry log level",
485+
},
486+
"otel_attribute_value_length_limit": schema.Int64Attribute{
487+
Optional: true,
488+
Computed: true,
489+
Description: "OpenTelemetry attribute value length limit",
490+
},
491+
"otel_exporter_otlp_endpoint": schema.StringAttribute{
492+
Optional: true,
493+
Computed: true,
494+
Description: "OpenTelemetry OTLP exporter endpoint",
495+
},
496+
"otel_exporter_otlp_traces_endpoint": schema.StringAttribute{
497+
Optional: true,
498+
Computed: true,
499+
Description: "OpenTelemetry OTLP traces endpoint",
500+
},
501+
"otel_exporter_otlp_protocol": schema.StringAttribute{
502+
Optional: true,
503+
Computed: true,
504+
Description: "OpenTelemetry OTLP exporter protocol",
505+
},
506+
"otel_exporter_otlp_traces_protocol": schema.StringAttribute{
507+
Optional: true,
508+
Computed: true,
509+
Description: "OpenTelemetry OTLP traces protocol",
510+
},
511+
"otel_exporter_otlp_headers": schema.SetAttribute{
512+
Optional: true,
513+
Computed: true,
514+
ElementType: types.StringType,
515+
Description: "OpenTelemetry OTLP exporter headers",
516+
},
517+
"otel_exporter_otlp_traces_headers": schema.SetAttribute{
518+
Optional: true,
519+
Computed: true,
520+
ElementType: types.StringType,
521+
Description: "OpenTelemetry OTLP traces headers",
522+
},
523+
"otel_exporter_otlp_timeout": schema.StringAttribute{
524+
Optional: true,
525+
Computed: true,
526+
Description: "OpenTelemetry OTLP exporter timeout",
527+
CustomType: timetypes.GoDurationType{},
528+
},
529+
"otel_exporter_otlp_traces_timeout": schema.StringAttribute{
530+
Optional: true,
531+
Computed: true,
532+
Description: "OpenTelemetry OTLP traces timeout",
533+
CustomType: timetypes.GoDurationType{},
534+
},
535+
"otel_bsp_schedule_delay": schema.StringAttribute{
536+
Optional: true,
537+
Computed: true,
538+
Description: "OpenTelemetry BSP schedule delay",
539+
CustomType: timetypes.GoDurationType{},
540+
},
541+
"otel_bsp_max_export_batch_size": schema.Int64Attribute{
542+
Optional: true,
543+
Computed: true,
544+
Description: "OpenTelemetry BSP max export batch size",
545+
},
465546
},
466547
}

0 commit comments

Comments
 (0)