/
annotationtype.go
45 lines (39 loc) · 989 Bytes
/
annotationtype.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package instrumentation
// Type is an enum for instrumentation types.
type Type string
// TypeSet is a map with Type keys.
type TypeSet map[Type]any
// NewTypeSet creates a new set of Type.
func NewTypeSet(types ...Type) TypeSet {
s := make(TypeSet, len(types))
for _, t := range types {
s[t] = nil
}
return s
}
const (
TypeJava Type = "java"
TypeNodeJS Type = "nodejs"
TypePython Type = "python"
TypeDotNet Type = "dotnet"
TypeGo Type = "go"
)
// InjectAnnotationKey maps the instrumentation type to the inject annotation.
func InjectAnnotationKey(instType Type) string {
switch instType {
case TypeJava:
return annotationInjectJava
case TypeNodeJS:
return annotationInjectNodeJS
case TypePython:
return annotationInjectPython
case TypeDotNet:
return annotationInjectDotNet
case TypeGo:
return annotationInjectGo
default:
return ""
}
}