netdata / netdata-cloud

The public repository of Netdata Cloud. Contribute with bug reports and feature requests.
GNU General Public License v3.0
41 stars 16 forks source link

[Bug]: Color selection should work per collector and not per context for consistency #813

Open shyamvalsan opened 1 year ago

shyamvalsan commented 1 year ago

Bug description

Color selection for dimensions should be per collector instead of per context as it is currently.

Without this we have inconsistent summary dashboards with same dimension showing up in different colors which is confusing.

Expected behavior

Same dimension should always use same color scheme within the same summary dashboard section.

Steps to reproduce

  1. Visit demo space and check out Postgres summary dashboard (inspect row 2)

Screenshots

image

See how the dbs postgres and working swap color in different bar charts.

Error Logs

N/A

Desktop

N/A

Additional context

No response

hugovalente-pm commented 1 year ago

@novykh yesterday you were speaking about the logic on how colors are assigned to dimensions.

I believe you mentioned these were set by context depending on the order you received the values from the collectors but on apps.plugin I remember we discussing that different charts (I think with different contexts) were able to share the same color definition. is it true?

novykh commented 1 year ago

Yes and no, yes the netdata dimension will have the same on every chart under apps for example, but it doesn't guarantee consistency between reloads and revisits to the same charts in the future. The apps contexts do not have a consistent sorting (agent side) this means there is no way to assign same values for same names every time you present a chart.

novykh commented 1 year ago

Reopened after this: https://discord.com/channels/847502280503590932/1026434195024781412/threads/1155304151388012574

novykh commented 1 year ago

@hugovalente-pm @shyamvalsan this is not straightforward to be tackled, since more info is needed on the /data in order to do some other grouping/caching for the colors.

Today we use the first part of the context to cache the colors, in my mind maybe we need the family as well, but we don't have it on the /data and I'm not sure if this will suffice.

We have users in the past that asked for this, since they were getting different colors for same dimensions in the same view. This was really visible when the dimensions were used in summary charts.

cc @ilyam8

hugovalente-pm commented 1 year ago

I'm not sure how frequent this is happening, this report on discord is the only I'm aware of and it is one chart on one node that the user is experiencing this

novykh commented 1 year ago

@ilyam8 showed me another case, and he had the same thing in his mind, that first part of context level is not a good grouping for caching colors. I feel like we can leave it as is, and pass to the /data another key. Maybe collector_id or something like that, and we can use this on the caching. So everything coming from this collector would have the same coloring for same dimensions. Or we can pass an arbitrary group key, where even inside the same collector we can group metrics' dimensions. Whatever we decide, the fallback always will be the approach we have today.

hugovalente-pm commented 1 year ago

Maybe collector_id or something like that, and we can use this on the caching. So everything coming from this collector would have the same coloring for same dimensions. Or we can pass an arbitrary group key, where even inside the same collector we can group metrics' dimensions

I'm not into the technical complication details, in terms of flexibility the addition of group key seems to provide more flexibility but I can image the overhead to add it to each and every collector, so if collector_id does the trick we could go with that