(api *netdataapi.API, env EmitEnv, chartLabels map[string]string)
| 48 | } |
| 49 | |
| 50 | func emitChartLabels(api *netdataapi.API, env EmitEnv, chartLabels map[string]string) { |
| 51 | chartKeys := make([]string, 0, len(chartLabels)) |
| 52 | for key := range chartLabels { |
| 53 | if strings.TrimSpace(key) == "" || key == collectJobReservedLabel { |
| 54 | continue |
| 55 | } |
| 56 | chartKeys = append(chartKeys, key) |
| 57 | } |
| 58 | sort.Strings(chartKeys) |
| 59 | |
| 60 | keys := make([]string, 0, len(env.JobLabels)) |
| 61 | for key := range env.JobLabels { |
| 62 | if _, overridden := chartLabels[key]; overridden { |
| 63 | continue |
| 64 | } |
| 65 | if key == collectJobReservedLabel { |
| 66 | continue |
| 67 | } |
| 68 | keys = append(keys, key) |
| 69 | } |
| 70 | sort.Strings(keys) |
| 71 | for _, key := range keys { |
| 72 | sKey := sanitizeWireID(key) |
| 73 | if sKey == "" { |
| 74 | continue |
| 75 | } |
| 76 | api.CLABEL(sKey, sanitizeWireValue(env.JobLabels[key]), labelSourceConf) |
| 77 | } |
| 78 | for _, key := range chartKeys { |
| 79 | sKey := sanitizeWireID(key) |
| 80 | if sKey == "" { |
| 81 | continue |
| 82 | } |
| 83 | api.CLABEL(sKey, sanitizeWireValue(chartLabels[key]), labelSourceAuto) |
| 84 | } |
| 85 | if strings.TrimSpace(env.JobName) != "" { |
| 86 | api.CLABEL(collectJobReservedLabel, sanitizeWireValue(env.JobName), labelSourceAuto) |
| 87 | } |
| 88 | } |
no test coverage detected
searching dependent graphs…