Open jregovic opened 3 years ago
In v3.7.0, the somewhat equivalent method, Entity does add the new entity to the list of entities. https://github.com/newrelic/infra-integrations-sdk/blob/1f48f6c9407a8be59e2494cf7f426563420a46f1/integration/integration.go#L194
The AddEntity method exists, but it is not obvious that this would need to be called, especially when updating to the v4 protocol.
Description
When calling integration.NewEntity in an integration, the entity is not added to the list of entities for the integration. This results in the integration data being missing
Expected Behavior
The entity should be added to the list of integrations and the data serialized.
Steps to Reproduce
{"protocol_version":"4","integration":{"name":"com.myorg.redis","version":"0.1.0"},"data":[]}
i.Entities = append(i.Entities,entity) go run redis.go -metrics -hostname localhost
{"protocol_version":"4","integration":{"name":"com.myorg.redis","version":"0.1.0"},"data":[{"common":{},"entity":{"name":"redis_01","displayName":"RedisServer","type":"my-redis","metadata":{}},"metrics":[{"timestamp":1631239424,"name":"query.instantaneousOpsPerSecond","type":"gauge","attributes":{},"value":0}],"inventory":{},"events":[]}]}