当前位置: 首页>>代码示例>>Golang>>正文


Golang Report.Topologies方法代码示例

本文整理汇总了Golang中github.com/weaveworks/scope/report.Report.Topologies方法的典型用法代码示例。如果您正苦于以下问题:Golang Report.Topologies方法的具体用法?Golang Report.Topologies怎么用?Golang Report.Topologies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/weaveworks/scope/report.Report的用法示例。


在下文中一共展示了Report.Topologies方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: interpolateCounts

// interpolateCounts compensates for sampling by artifically inflating counts
// throughout the report. It should be run once for each report, within the
// probe, before it gets emitted into the rest of the system.
func interpolateCounts(r report.Report) {
	rate := r.Sampling.Rate()
	if rate >= 1.0 {
		return
	}
	factor := 1.0 / rate
	for _, topology := range r.Topologies() {
		for _, nmd := range topology.Nodes {
			for _, emd := range nmd.Edges {
				if emd.EgressPacketCount != nil {
					*emd.EgressPacketCount = uint64(float64(*emd.EgressPacketCount) * factor)
				}
				if emd.IngressPacketCount != nil {
					*emd.IngressPacketCount = uint64(float64(*emd.IngressPacketCount) * factor)
				}
				if emd.EgressByteCount != nil {
					*emd.EgressByteCount = uint64(float64(*emd.EgressByteCount) * factor)
				}
				if emd.IngressByteCount != nil {
					*emd.IngressByteCount = uint64(float64(*emd.IngressByteCount) * factor)
				}
			}
		}
	}
}
开发者ID:philipz,项目名称:scope,代码行数:28,代码来源:sniffer.go

示例2: Tag

// Tag implements Tagger.
func (t Tagger) Tag(r report.Report) (report.Report, error) {
	other := report.MakeNodeMetadataWith(map[string]string{report.HostNodeID: t.hostNodeID})
	for _, topology := range r.Topologies() {
		for id, md := range topology.NodeMetadatas {
			topology.NodeMetadatas[id] = md.Merge(other)
		}
	}
	return r, nil
}
开发者ID:cgvarela,项目名称:scope,代码行数:10,代码来源:tagger.go

示例3: Tag

func (t originHostTagger) Tag(r report.Report) (report.Report, error) {
	for _, topology := range r.Topologies() {
		md := report.NodeMetadata{report.HostNodeID: t.hostNodeID}
		for nodeID := range topology.NodeMetadatas {
			topology.NodeMetadatas[nodeID].Merge(md)
		}
	}
	return r, nil
}
开发者ID:davkal,项目名称:scope,代码行数:9,代码来源:origin_host_tagger.go

示例4: Tag

// Tag implements Tagger.
func (t Tagger) Tag(r report.Report) (report.Report, error) {
	md := report.NewNodeMetadata(map[string]string{report.HostNodeID: t.hostNodeID})
	for _, topology := range r.Topologies() {
		for nodeID := range topology.NodeMetadatas {
			topology.NodeMetadatas[nodeID].Merge(md)
		}
	}
	return r, nil
}
开发者ID:neviim,项目名称:scope,代码行数:10,代码来源:tagger.go

示例5: getRenderingContext

func getRenderingContext(r report.Report, n RenderableNode) (multiContainer, multiHost bool) {
	var (
		originHosts      = map[string]struct{}{}
		originContainers = map[string]struct{}{}
	)
	for _, id := range n.Origins {
		for _, topology := range r.Topologies() {
			if nmd, ok := topology.Nodes[id]; ok {
				originHosts[report.ExtractHostID(nmd)] = struct{}{}
				if id, ok := nmd.Metadata[docker.ContainerID]; ok {
					originContainers[id] = struct{}{}
				}
			}
			// Return early if possible
			multiHost = len(originHosts) > 1
			multiContainer = len(originContainers) > 1
			if multiHost && multiContainer {
				return
			}
		}
	}
	return
}
开发者ID:philipz,项目名称:scope,代码行数:23,代码来源:detailed_node.go


注:本文中的github.com/weaveworks/scope/report.Report.Topologies方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。