Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_api_management_diagnostic, azurerm_api_management_api_diagnostic - support new property metrics #28503

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ func resourceApiManagementApiDiagnostic() *pluginsdk.Resource {
ValidateFunc: logger.ValidateLoggerID,
},

"metrics_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
},

"sampling_percentage": {
Type: pluginsdk.TypeFloat,
Optional: true,
Expand Down Expand Up @@ -199,6 +205,7 @@ func resourceApiManagementApiDiagnosticCreateUpdate(d *pluginsdk.ResourceData, m
parameters := apidiagnostic.DiagnosticContract{
Properties: &apidiagnostic.DiagnosticContractProperties{
LoggerId: d.Get("api_management_logger_id").(string),
Metrics: pointer.To(d.Get("metrics_enabled").(bool)),
},
}

Expand Down Expand Up @@ -332,6 +339,7 @@ func resourceApiManagementApiDiagnosticRead(d *pluginsdk.ResourceData, meta inte
format = string(pointer.From(props.OperationNameFormat))
}
d.Set("operation_name_format", format)
d.Set("metrics_enabled", pointer.From(props.Metrics))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ resource "azurerm_api_management_api_diagnostic" "test" {
http_correlation_protocol = "W3C"
verbosity = "verbose"
operation_name_format = "Name"
metrics_enabled = true

backend_request {
body_bytes = 1
Expand Down Expand Up @@ -362,6 +363,7 @@ resource "azurerm_api_management_api_diagnostic" "test" {
http_correlation_protocol = "W3C"
verbosity = "verbose"
operation_name_format = "Url"
metrics_enabled = false
}
`, r.template(data))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ func resourceApiManagementDiagnostic() *pluginsdk.Resource {
ValidateFunc: logger.ValidateLoggerID,
},

"metrics_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
},

"sampling_percentage": {
Type: pluginsdk.TypeFloat,
Optional: true,
Expand Down Expand Up @@ -158,6 +164,7 @@ func resourceApiManagementDiagnosticCreateUpdate(d *pluginsdk.ResourceData, meta
parameters := diagnostic.DiagnosticContract{
Properties: &diagnostic.DiagnosticContractProperties{
LoggerId: d.Get("api_management_logger_id").(string),
Metrics: pointer.To(d.Get("metrics_enabled").(bool)),
},
}

Expand Down Expand Up @@ -280,6 +287,7 @@ func resourceApiManagementDiagnosticRead(d *pluginsdk.ResourceData, meta interfa
format = string(pointer.From(props.OperationNameFormat))
}
d.Set("operation_name_format", format)
d.Set("metrics_enabled", pointer.From(props.Metrics))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ resource "azurerm_api_management_diagnostic" "test" {
log_client_ip = false
http_correlation_protocol = "Legacy"
verbosity = "error"
metrics_enabled = false

frontend_request {
body_bytes = 100
Expand Down Expand Up @@ -310,6 +311,7 @@ resource "azurerm_api_management_diagnostic" "test" {
http_correlation_protocol = "Legacy"
verbosity = "error"
operation_name_format = "Url"
metrics_enabled = true
}
`, r.template(data))
}
2 changes: 2 additions & 0 deletions website/docs/r/api_management_api_diagnostic.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ The following arguments are supported:

* `log_client_ip` - (Optional) Log client IP address.

* `metrics_enabled` - (Optional) Whether to enable emitting custom metrics by the emit-metric policy. Defaults to `false`.

* `sampling_percentage` - (Optional) Sampling (%). For high traffic APIs, please read this [documentation](https://docs.microsoft.com/azure/api-management/api-management-howto-app-insights#performance-implications-and-log-sampling) to understand performance implications and log sampling. Valid values are between `0.0` and `100.0`.

* `verbosity` - (Optional) Logging verbosity. Possible values are `verbose`, `information` or `error`.
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/api_management_diagnostic.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ The following arguments are supported:

* `log_client_ip` - (Optional) Log client IP address.

* `metrics_enabled` - (Optional) Whether to enable emitting custom metrics by the emit-metric policy. Defaults to `false`.

* `sampling_percentage` - (Optional) Sampling (%). For high traffic APIs, please read this [documentation](https://docs.microsoft.com/azure/api-management/api-management-howto-app-insights#performance-implications-and-log-sampling) to understand performance implications and log sampling. Valid values are between `0.0` and `100.0`.

* `verbosity` - (Optional) Logging verbosity. Possible values are `verbose`, `information` or `error`.
Expand Down
Loading