Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions go-telemetry-api-extension/extensionApi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,16 @@ const (

// Client is a simple client for the Lambda Extensions API
type Client struct {
httpClient *http.Client
baseUrl string
ExtensionID string
httpClient *http.Client
baseUrl string
ExtensionID string
functionName string
}

func (e *Client) GetFunctionName() string {
return e.functionName
}

var l = log.WithFields(log.Fields{"pkg": "extensionApi"})

// Returns a Lambda Extensions API client
Expand Down
4 changes: 2 additions & 2 deletions go-telemetry-api-extension/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Notes:
package main

import (
"context"
"newrelic-lambda-extension/go-telemetry-api-extension/extensionApi"
"newrelic-lambda-extension/go-telemetry-api-extension/telemetryApi"
"context"
"os"
"os/signal"
"path"
Expand Down Expand Up @@ -65,7 +65,7 @@ func main() {
panic(err)
}
l.Info("[main] Subscription success")
dispatcher := telemetryApi.NewDispatcher(extensionApiClient.functionName)
dispatcher := telemetryApi.NewDispatcher(extensionApiClient.GetFunctionName())

// Will block until invoke or shutdown event is received or cancelled via the context.
for {
Expand Down
8 changes: 7 additions & 1 deletion go-telemetry-api-extension/telemetryApi/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s *TelemetryApiListener) http_handler(w http.ResponseWriter, r *http.Reque
return
}
// Parse and put the log messages into the queue
var slice []interface{}
var slice []LambdaTelemetryEvent
_ = json.Unmarshal(body, &slice)

for _, el := range slice {
Expand All @@ -98,3 +98,9 @@ func (s *TelemetryApiListener) Shutdown() {
}
}
}

type LambdaTelemetryEvent struct {
Time string
Type string
Record any
}
Loading