Comments (4)
Other alert condition types (all that I can tell) have PolicyID either in them or stitched in, so it seems reasonable to do so here as well.
from newrelic-client-go.
I think one use case and reason why PolicyID
was stitched in to some struct was to facilitate terraform import
for alert conditions, NRQL alert conditions, and plugins conditions.
Given the following HCL, it would be required to also have the alert policy defined as a separate block to import, but maybe someone didn't want to have both in their HCL.
resource "newrelic_alert_condition" "foo" {
policy_id = 123456
name = "foo"
type = "apm_app_metric"
entities = [654321]
metric = "apdex"
condition_scope = "application"
term {
// ...
}
}
In order for terraform import newrelic_alert_condition.foo ...
to work, since the API response for an alert channel doesn't contain a policy ID association anywhere, you would need to provide the policyID in some way. And since the Terraform read functionality doesn't have a way to read the policy_id
directly from the HCL and policy_id
does't exist in the state yet (hence the import), that's potentially one reason why it's stitched into the struct.
The stitched in PolicyID
field is also used for create and is included in the return struct which is then used to create the ID hash of the resource.
If we removed PolicyID
from the alerts.Condition
struct, we would need to make sure we returned a tuple of the condition and the policy ID.
TL;DR It would appear that stitching the PolicyID
might be a convenience thing vs a necessary thing, but the convenience factor seems to be pretty nice.
from newrelic-client-go.
We have consensus agreement that we should remove the transient PolicyID
field from the following structs to facilitate a 1:1 mapping the associated API responses.
from newrelic-client-go.
Awesome. Good work here @sanderblue.
from newrelic-client-go.
Related Issues (20)
- Support for FedRAMP-compliant endpoints HOT 3
- API Access to user-graphql.service.newrelic.com
- Question: How to query entities over 200
- Add support for more condition types
- Queries with both FACET and TIMESERIES fails on JSON unmarshalling HOT 1
- Expose a timeout option in the nrdb package api HOT 1
- When using `testhelpers`, the Insights API is not configured for the `httptest.Server`
- Bump major version HOT 2
- [Question] Top API endpoint transactions HOT 6
- Region Constants reference Deprecated API Endpoints HOT 5
- incorrect schema mapping in Alerts.ListAlertEvents HOT 2
- End of Life - New Relic Go Client SDK before version 0.73 HOT 1
- Support Node16 runtime for Synthetics HOT 1
- NRQL Drop Rule Getter Function HOT 4
- Provider dont catch permissions error and delete resource from state. HOT 1
- Adding "omitempty" will prevent boolean field from being sent to API if false HOT 1
- Event Batch Mode Panic HOT 1
- Error creating synthetic script monitor targeting legacy runtime. HOT 2
- EpochTime UnmarshalJSON Error HOT 5
- alertEventsResponse has wrong json tag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from newrelic-client-go.