(profiles []*profile.Profile, msrcs []plugin.MappingSources)
| 242 | } |
| 243 | |
| 244 | func combineProfiles(profiles []*profile.Profile, msrcs []plugin.MappingSources) (*profile.Profile, plugin.MappingSources, error) { |
| 245 | // Merge profiles. |
| 246 | // |
| 247 | // The merge call below only treats exactly matching sample type lists as |
| 248 | // compatible and will fail otherwise. Make the profiles' sample types |
| 249 | // compatible for the merge, see CompatibilizeSampleTypes() doc for details. |
| 250 | if err := profile.CompatibilizeSampleTypes(profiles); err != nil { |
| 251 | return nil, nil, err |
| 252 | } |
| 253 | if err := measurement.ScaleProfiles(profiles); err != nil { |
| 254 | return nil, nil, err |
| 255 | } |
| 256 | |
| 257 | // Avoid expensive work for the common case of a single profile/src. |
| 258 | if len(profiles) == 1 && len(msrcs) == 1 { |
| 259 | return profiles[0], msrcs[0], nil |
| 260 | } |
| 261 | |
| 262 | p, err := profile.Merge(profiles) |
| 263 | if err != nil { |
| 264 | return nil, nil, err |
| 265 | } |
| 266 | |
| 267 | // Combine mapping sources. |
| 268 | msrc := make(plugin.MappingSources) |
| 269 | for _, ms := range msrcs { |
| 270 | for m, s := range ms { |
| 271 | msrc[m] = append(msrc[m], s...) |
| 272 | } |
| 273 | } |
| 274 | return p, msrc, nil |
| 275 | } |
| 276 | |
| 277 | type profileSource struct { |
| 278 | addr string |
no test coverage detected
searching dependent graphs…