-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[receiver/cloudfoundry]: move datapoint level attributes to resource level #34905
Conversation
33dd51e
to
f5a7a6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a high level review this round, I'll review again once naming is a bit more sorted out 👍
for _, envelope := range envelopes { | ||
if envelope != nil { | ||
// There is no concept of startTime in CF loggregator, and we do not know the uptime of the component | ||
// from which the metric originates, so just provide receiver start time as metric start time | ||
convertEnvelopeToMetrics(envelope, libraryMetrics, cfr.receiverStartTime) | ||
convertEnvelopeToMetrics(envelope, metrics.ResourceMetrics().AppendEmpty(), cfr.receiverStartTime) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be able to conform to OTel metrics formatting with resource attributes, we need to try to create more of a hierarchy here with resource metrics, rather than a flat layout as we have without resource attributes here.
If two metrics share the same resource attributes, they should be in the same resource metric. However, the way the logic currently is written, each metric is in its own resource metric, regardless of whether or not it shares identical resource attributes with other metrics.
I could see two main ways of doing this:
- When converting envelopes to metrics, check if a resource metric already exists with the parsed resource attributes. If yes, insert the new metric into the existing resource metric.
- After all envelopes have been converted to metrics, deduplicate the resource metrics to merge them.
I think option 1. may be more straight forward and clear to follow the logic of, but I'd welcome more input here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, will adapt using the 1. option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adapted to the new logic, please have a look if you have time. Still adding some more tests, but not done with those yet, so please keep that i mind for now
namePrefix := envelope.Tags["origin"] + "." | ||
|
||
if allowResourceAttributes.IsEnabled() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @jriguera pointed out in the original issue, not all of the attributes can be considered resource attributes. We should have a predefined list of resource attributes that are copied when the feature gate is enabled.
When the feature gate is enabled the predefined attributes are copied to resource attributes. The rest of the attributes will be datapoint attributes as they are today. The predefined list will only be resource attributes, they will not be both resource attributes and datapoint attributes.
-> org.cloudfoundry.index: Str(4b406f26-f1ec-4d66-8b92-f09ab6105d46)
-> org.cloudfoundry.ip: Str(10.0.4.8)
-> org.cloudfoundry.job: Str(compute)
-> org.cloudfoundry.instance_group: Str(compute)
-> org.cloudfoundry.origin: Str(system_metrics_agent)
-> org.cloudfoundry.source_id: Str(system_metrics_agent)
@jriguera From your comment on the original issue it sounded like you don't believe the above attributes should be considered resource attributes. Is that correct? If so, can you expand your reasoning? My understanding is that since they describe the resource the metrics are coming from they can be considered resource attributes. Source
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so the list above is the full list of resource attributes, is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, this should be the full list of resource attributes, please correct me if I am missing something
-> org.cloudfoundry.index
-> org.cloudfoundry.ip
-> org.cloudfoundry.deployment
-> org.cloudfoundry.id
-> org.cloudfoundry.job
-> org.cloudfoundry.product
-> org.cloudfoundry.instance_group
-> org.cloudfoundry.instance_id
-> org.cloudfoundry.origin
-> org.cloudfoundry.system_domain
-> org.cloudfoundry.source_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adapted the logic, here is the list (for now) of resource attributes
6cfb0b8
to
827da54
Compare
8c6601c
to
6f34911
Compare
c5c9421
to
a675f65
Compare
@crobert-1 would you have time to take another look? |
42b4e5e
to
36cb58f
Compare
I was hoping to hear back from @jriguera to try and get a consensus around which attributes should be moved to resource attributes here. If we don't hear back soon we can move this forward. 👍 |
c1d06cc
to
7466806
Compare
I will continue with my reviewing tomorrow |
Hi @jriguera, any other comments? |
27a3988
to
4b8a984
Compare
cc @jriguera |
a0016ff
to
54c4e50
Compare
cc @jriguera |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart of the issues with names of some tests and the flags, it looks good to me.
If I have enough time next days, I would like to test it in my environment.
9e4df9b
to
49a5d0b
Compare
49a5d0b
to
0f706bf
Compare
@crobert-1 any objections against merging this? |
@odubajDT I think @crobert-1 is not available for now, we need to find other person to review and approve the merge |
After this is merged, I also will need to apply the same functionality to traces (another PR as a draft which I need to finish) |
ec66156
to
dae3634
Compare
18324ca
to
b1bdfb2
Compare
8d75948
to
5cb6ed4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code LGTM
…level Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
Signed-off-by: odubajDT <[email protected]>
e9af734
to
0569f6b
Compare
# Use this changelog template to create an entry for release notes. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: breaking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it breaking, given that the feature gate is in alpha? Feel free to submit a PR changing it to enhancement
if you agree.
Description:
Introduce a feature gate enable copying envelope tags to the metrics as resource attributes instead of datapoint attributes.
Link to tracking Issue: #34824