Skip to content

Commit bb6ea95

Browse files
authored
Merge pull request #9 from axiomhq/add-field-for-dataset-detection
attach axiom object for automatic dataset detection
2 parents aade7fe + c883e67 commit bb6ea95

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

server/server.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010

1111
"github.com/axiomhq/axiom-go/axiom"
1212
"go.uber.org/zap"
13+
14+
"github.com/axiomhq/axiom-lambda-extension/version"
1315
)
1416

1517
type Server struct {
@@ -30,6 +32,7 @@ var (
3032
AWS_LAMBDA_INITIALIZATION_TYPE = os.Getenv("AWS_LAMBDA_INITIALIZATION_TYPE")
3133
AWS_LAMBDA_FUNCTION_MEMORY_SIZE, _ = strconv.ParseInt(os.Getenv("AWS_LAMBDA_FUNCTION_MEMORY_SIZE"), 10, 32)
3234
lambdaMetaInfo = map[string]any{}
35+
axiomMetaInfo = map[string]string{}
3336
)
3437

3538
func init() {
@@ -43,6 +46,9 @@ func init() {
4346
"memorySizeMB": AWS_LAMBDA_FUNCTION_MEMORY_SIZE,
4447
"version": AWS_LAMBDA_FUNCTION_VERSION,
4548
}
49+
axiomMetaInfo = map[string]string{
50+
"awsLambdaExtensionVersion": version.Get(),
51+
}
4652
}
4753

4854
func New(port string, axClient *axiom.Client, axDataset string) *Server {
@@ -78,6 +84,7 @@ func (s *Server) httpHandler(w http.ResponseWriter, r *http.Request) {
7884
for _, e := range events {
7985
// attach the lambda information to the event
8086
e["lambda"] = lambdaMetaInfo
87+
e["axiom"] = axiomMetaInfo
8188
// replace the time field with axiom's _time
8289
e["_time"], e["time"] = e["time"], nil
8390
}

version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package version
22

33
// manually set constant version
4-
const version string = "v1"
4+
const version string = "v2"
55

66
// Get returns the Go module version of the axiom-go module.
77
func Get() string {

0 commit comments

Comments
 (0)