MCPcopy Index your code
hub / github.com/docker/cli / getPluginResourceAttributes

Function getPluginResourceAttributes

cli-plugins/manager/telemetry.go:29–48  ·  view source on GitHub ↗
(cmd *cobra.Command, plugin Plugin)

Source from the content-addressed store, hash-verified

27)
28
29func getPluginResourceAttributes(cmd *cobra.Command, plugin Plugin) attribute.Set {
30 commandPath := cmd.Annotations[metadata.CommandAnnotationPluginCommandPath]
31 if commandPath == "" {
32 commandPath = fmt.Sprintf("%s %s", cmd.CommandPath(), plugin.Name)
33 }
34
35 attrSet := attribute.NewSet(
36 cobraCommandPath.String(commandPath),
37 )
38
39 kvs := make([]attribute.KeyValue, 0, attrSet.Len())
40 for iter := attrSet.Iter(); iter.Next(); {
41 attr := iter.Attribute()
42 kvs = append(kvs, attribute.KeyValue{
43 Key: dockerCLIAttributePrefix + attr.Key,
44 Value: attr.Value,
45 })
46 }
47 return attribute.NewSet(kvs...)
48}
49
50func appendPluginResourceAttributesEnvvar(env []string, cmd *cobra.Command, plugin Plugin) []string {
51 if attrs := getPluginResourceAttributes(cmd, plugin); attrs.Len() > 0 {

Callers 1

Calls 3

NextMethod · 0.80
StringMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…