title | platform |
---|---|
About the google_project_metrics resource |
gcp |
A google_project_metrics
is used to test a Google Metric resource
describe google_project_metrics(project: 'chef-gcp-inspec') do
it { should exist }
its('metric_filters') { should include 'resource.type=gae_app AND severity>=ERROR' }
its('metric_names') { should include 'some/metric' }
end
describe.one do
google_project_metrics(project: 'chef-gcp-inspec').metric_types.each do |metric_type|
describe metric_type do
it { should match 'some/metric' }
end
end
end
describe google_project_metrics(project: 'chef-inspec-gcp') do
its('count') { should be <= 100}
end
describe google_project_metrics(project: 'chef-inspec-gcp') do
its('metric_names') { should include "metric-name" }
end
google_project_metrics(project: 'chef-inspec-gcp').where(metric_name: /project/).metric_names.each do |metric_name|
describe google_project_metric(project: 'chef-inspec-gcp', metric: metric_name) do
its('filter') { should eq "(protoPayload.serviceName=\"cloudresourcemanager.googleapis.com\")" }
end
end
Properties that can be accessed from the google_project_metrics
resource:
See google_project_metric.md for more detailed information
metric_names
: an array ofgoogle_project_metric
namedescriptions
: an array ofgoogle_project_metric
descriptionmetric_filters
: an array ofgoogle_project_metric
filtermetric_descriptors
: an array ofgoogle_project_metric
metric_descriptorlabel_extractors
: an array ofgoogle_project_metric
label_extractorsvalue_extractors
: an array ofgoogle_project_metric
value_extractorbucket_options
: an array ofgoogle_project_metric
bucket_options
This resource supports all of the above properties as filter criteria, which can be used
with where
as a block or a method.
Ensure the Stackdriver Logging API is enabled for the current project.