Skip to content
9 changes: 3 additions & 6 deletions collector/internal/telemetryapi/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ func setupListener(t *testing.T) (*Listener, string) {

address, err := listener.Start()
require.NoError(t, err)

t.Cleanup(func() {
listener.Shutdown()
})

return listener, address
}

Expand Down Expand Up @@ -193,8 +188,8 @@ func TestListener_StartAndShutdown(t *testing.T) {
} else {
require.NoError(t, resp.Body.Close())
}
listener.Shutdown()

listener.Shutdown()
require.Nil(t, listener.httpServer, "httpServer should be nil after Shutdown()")
}

Expand Down Expand Up @@ -241,6 +236,7 @@ func TestListener_httpHandler(t *testing.T) {
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
listener, address := setupListener(t)
defer listener.Shutdown()
submitEvents(t, address, test.events)
require.EventuallyWithT(t, func(c *assert.CollectT) {
require.Equal(c, test.expectedCount, listener.queue.Len())
Expand Down Expand Up @@ -302,6 +298,7 @@ func TestListener_Wait_Success(t *testing.T) {
for _, test := range testCases {
t.Run(test.name, func(t *testing.T) {
listener, address := setupListener(t)
defer listener.Shutdown()

waitDone := make(chan error, 1)
go func() {
Expand Down
24 changes: 19 additions & 5 deletions collector/internal/telemetryapi/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,29 @@ const (
PlatformInitStart EventType = Platform + ".initStart"
// PlatformInitRuntimeDone is used when function initialization ended.
PlatformInitRuntimeDone EventType = Platform + ".initRuntimeDone"
// PlatformReport is used when a report of function invocation is received.
PlatformReport EventType = Platform + ".report"
// Function invocation started.
// PlatformInitReport is used when a report of function initialization is received.
PlatformInitReport EventType = Platform + ".initReport"
// PlatformStart is used when function invocation started.
PlatformStart EventType = Platform + ".start"
// The runtime finished processing an event with either success or failure.
// PlatformRuntimeDone is used when the runtime finished processing an event with either success or failure.
PlatformRuntimeDone EventType = Platform + ".runtimeDone"
// PlatformReport is used when a report of function invocation is received.
PlatformReport EventType = Platform + ".report"
// PlatformRestoreStart is used when runtime restore started.
PlatformRestoreStart EventType = Platform + ".restoreStart"
// PlatformRestoreRuntimeDone is used when runtime restore completed.
PlatformRestoreRuntimeDone EventType = Platform + ".restoreRuntimeDone"
// PlatformRestoreReport is used when a report of runtime restore is received.
PlatformRestoreReport EventType = Platform + ".restoreReport"
// PlatformExtension is used for extension state events.
PlatformExtension EventType = Platform + ".extension"
// PlatformTelemetrySubscription is used when the extension subscribed to the Telemetry API.
PlatformTelemetrySubscription EventType = Platform + ".telemetrySubscription"
// PlatformLogsDropped is used when Lambda dropped log entries.
PlatformLogsDropped EventType = Platform + ".logsDropped"
// Function is used to receive log events emitted by the function
Function EventType = "function"
// Extension is used is to receive log events emitted by the extension
// Extension is used to receive log events emitted by the extension
Extension EventType = "extension"
)

Expand Down
3 changes: 2 additions & 1 deletion collector/lambdacomponents/receiver/telemetryapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
package receiver

import (
"github.com/open-telemetry/opentelemetry-lambda/collector/receiver/telemetryapireceiver"
"go.opentelemetry.io/collector/receiver"

"github.com/open-telemetry/opentelemetry-lambda/collector/receiver/telemetryapireceiver"
)

func init() {
Expand Down
Loading
Loading