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

NewEntity does add the new entity to the integration #275

Open
jregovic opened this issue Sep 10, 2021 · 1 comment
Open

NewEntity does add the new entity to the integration #275

jregovic opened this issue Sep 10, 2021 · 1 comment
Labels
bug Categorizes issue or PR as related to a bug. triage/pending Issue or PR is pending for triage and prioritization.

Comments

@jregovic
Copy link

jregovic commented Sep 10, 2021

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

go run redis.go -metrics -hostname localhost 

{"protocol_version":"4","integration":{"name":"com.myorg.redis","version":"0.1.0"},"data":[]}

Your Environment

MacOS 10.15.7
infra-integrations-sdk v4.1.0

Additional context

The issue is fixed by creating the entity and adding :

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":[]}]}
@jregovic jregovic added the bug Categorizes issue or PR as related to a bug. label Sep 10, 2021
@davidgit davidgit added the triage/pending Issue or PR is pending for triage and prioritization. label Sep 17, 2021
@jregovic
Copy link
Author

In v3.7.0, the somewhat equivalent method, Entity does add the new entity to the list of entities.

i.Entities = append(i.Entities, e)

The AddEntity method exists, but it is not obvious that this would need to be called, especially when updating to the v4 protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Categorizes issue or PR as related to a bug. triage/pending Issue or PR is pending for triage and prioritization.
Projects
None yet
Development

No branches or pull requests

2 participants