Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddEnvResAttributes = func(res *resource.Resource, attributeMap map[string]string) (*resource.Resource, error) { attributes := make([]attribute.KeyValue, 0, 1) servieName, ok := attributeMap[serviceNameKey] if ok { serviceNameAttr := attribute.Key(serviceNameKey).String(servieName) attributes = append(attributes, serviceNameAttr) } servieNameSpace, ok := attributeMap[serviceNamespaceKey] if ok { serviceNameAttr := attribute.Key(serviceNamespaceKey).String(servieNameSpace) attributes = append(attributes, serviceNameAttr) } envRes := resource.NewSchemaless(attributes...) return resource.Merge(res, envRes) }
AddEnvResAttributes adds service attributes from attributeMap to a resource
View Source
var GetServiceDetails = func() map[string]string { resourceAttributes := os.Getenv(resourceAttributesKey) if resourceAttributes == "" { return nil } attributeKVPairs := strings.Split(resourceAttributes, commaSeperator) attribute := make(map[string]string) for _, kv := range attributeKVPairs { keyValueList := strings.Split(kv, equalSeperator) attribute[keyValueList[0]] = keyValueList[1] } return attribute }
GetServiceDetails gets service details from environment variables
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.