-
Notifications
You must be signed in to change notification settings - Fork 115
feat: rie private to public automation initial merge #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e970820
50fd571
9707bee
1ed266f
7cbb9c1
c09024d
17dc38a
22d7a58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,8 @@ on: | |
| branches: | ||
| - develop | ||
| - main | ||
|
|
||
| merge_group: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,20 @@ | |||||||||||||||||||||||||||||
| name: Validate PR Branch into Main | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
| branches: | |||||||||||||||||||||||||||||
| - main | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| validate-pr-branch: | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Check source branch | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| SOURCE_BRANCH="${{ github.head_ref }}" | |||||||||||||||||||||||||||||
| if [[ "$SOURCE_BRANCH" != "develop" ]]; then | |||||||||||||||||||||||||||||
| echo "Error: Only pull requests from develop branch are allowed into main" | |||||||||||||||||||||||||||||
| echo "Current source branch ($SOURCE_BRANCH)." | |||||||||||||||||||||||||||||
| exit 1 | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| echo "Source branch is develop - merge allowed" | |||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+20
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
This autofix suggestion was applied.
Show autofix suggestion
Hide autofix suggestion
Copilot AutofixAI 17 days ago In general, fix this by adding a For this specific workflow in
Suggested changeset
1
.github/workflows/validate-branch-into-main.yaml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # RIE Telemetry Package | ||
|
|
||
| The RIE (Runtime Interface Emulator) telemetry package provides Telemetry API. | ||
|
|
||
| ## Architecture Overview | ||
|
|
||
| ``` | ||
| ┌─────────────────┐ ┌─────────────────┐ ┌──────────────────┐ | ||
| │ EventsAPI │ │ LogsEgress │ │ SubscriptionAPI │ | ||
| │ │ │ │ │ │ | ||
| │ • Platform │ │ • Runtime logs │ │ • Subscription │ | ||
| │ events │ │ • Extension │ │ management │ | ||
| │ • Lifecycle │ │ logs │ │ • Schema │ | ||
| │ events │ │ • Log capture │ │ validation │ | ||
| └─────────┬───────┘ └─────────┬───────┘ └──────────┬───────┘ | ||
| │ │ │ | ||
| └──────────────┬───────────────────────────────┘ | ||
| │ | ||
| ┌────▼────┐ | ||
| │ Relay │ | ||
| │ │ | ||
| │ Event │ | ||
| │ Broker │ | ||
| └────┬────┘ | ||
| │ | ||
| ┌──────────────┼──────────────┐ | ||
| │ │ │ | ||
| ┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼─────┐ | ||
| │Subscriber │ │Subscriber │ │Subscriber │ | ||
| │ A │ │ B │ │ C │ | ||
| └─────┬─────┘ └─────┬─────┘ └─────┬─────┘ | ||
| │ │ │ | ||
| ┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼─────┐ | ||
| │TCP Client │ │HTTP Client│ │TCP Client │ | ||
| └───────────┘ └───────────┘ └───────────┘ | ||
| ``` | ||
|
|
||
| ## Core Components | ||
|
|
||
| ### 1. EventsAPI (`events_api.go`) | ||
| **Responsibility**: Platform event generation and distribution | ||
|
|
||
| The EventsAPI serves as the primary interface for generating and broadcasting AWS Lambda platform events. It implements the `EventsAPI` interface and handles various lifecycle events including initialization, invocation, and error reporting. | ||
|
|
||
| ### 2. LogsEgress (`logs_egress.go`) | ||
| **Responsibility**: Log capture and forwarding | ||
|
|
||
| The LogsEgress component implements the `StdLogsEgressAPI` interface to capture stdout/stderr from both runtime and extensions, forwarding them to telemetry subscribers while maintaining original console output. | ||
|
|
||
| ### 3. Relay (`relay.go`) | ||
| **Responsibility**: Event broadcasting and subscriber management | ||
|
|
||
| The Relay acts as a central event broker, managing subscribers and broadcasting events to all registered telemetry consumers. | ||
|
|
||
| ### 4. SubscriptionAPI (`subscription_api.go`) | ||
| **Responsibility**: Subscription management and validation | ||
|
|
||
| The SubscriptionAPI handles telemetry subscription requests, validates them against JSON schemas, and manages the subscription lifecycle. | ||
|
|
||
| ## Internal Components | ||
|
|
||
| ### 1. Subscriber (`internal/subscriber.go`) | ||
| **Responsibility**: Event batching and delivery | ||
|
|
||
| Each subscriber represents a telemetry consumer and manages efficient event delivery through batching and asynchronous processing. | ||
|
|
||
| ### 2. Client (`internal/client.go`) | ||
| **Responsibility**: Protocol-specific event delivery | ||
|
|
||
| The client abstraction provides protocol-specific implementations for delivering events to telemetry consumers. | ||
|
|
||
| ### 3. Batch (`internal/batch.go`) | ||
| **Responsibility**: Event collection and timing | ||
|
|
||
| The batch component manages collections of events with size and time-based flushing logic. | ||
|
|
||
| ### 4. Types (`internal/types.go`) | ||
| **Responsibility**: Type definitions and constants | ||
|
|
||
| Centralized type definitions for protocols, event categories, and configuration structures. | ||
|
|
||
| ## Event Flow | ||
|
|
||
| ### 1. Subscription Flow | ||
| ``` | ||
| Extension/Agent → SubscriptionAPI → Schema Validation → Subscriber Creation → Relay Registration | ||
| ``` | ||
|
|
||
| ### 2. Event Flow | ||
| ``` | ||
| Event Source → EventsAPI → Relay → Subscribers → Batching → Client | ||
| ``` | ||
|
|
||
| ### 3. Log Flow | ||
| ``` | ||
| Runtime/Extension → LogsEgress → Console Output + Relay → Subscribers → Batching → Client | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package main | ||
|
|
||
| import ( | ||
| "github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda-managed-instances/aws-lambda-rie/run" | ||
| ) | ||
|
|
||
| func main() { | ||
| run.Run() | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package interop | ||
|
|
||
| import mock "github.com/stretchr/testify/mock" | ||
|
|
||
| type MockReserveIdleRuntimeRequest struct { | ||
| mock.Mock | ||
| } | ||
|
|
||
| func (_m *MockReserveIdleRuntimeRequest) InvokeID() string { | ||
| ret := _m.Called() | ||
|
|
||
| if len(ret) == 0 { | ||
| panic("no return value specified for InvokeID") | ||
| } | ||
|
|
||
| var r0 string | ||
| if rf, ok := ret.Get(0).(func() string); ok { | ||
| r0 = rf() | ||
| } else { | ||
| r0 = ret.Get(0).(string) | ||
| } | ||
|
|
||
| return r0 | ||
| } | ||
|
|
||
| func NewMockReserveIdleRuntimeRequest(t interface { | ||
| mock.TestingT | ||
| Cleanup(func()) | ||
| }) *MockReserveIdleRuntimeRequest { | ||
| mock := &MockReserveIdleRuntimeRequest{} | ||
| mock.Mock.Test(t) | ||
|
|
||
| t.Cleanup(func() { mock.AssertExpectations(t) }) | ||
|
|
||
| return mock | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package interop | ||
|
|
||
| import mock "github.com/stretchr/testify/mock" | ||
|
|
||
| type MockReserveIdleRuntimeResponse struct { | ||
| mock.Mock | ||
| } | ||
|
|
||
| func (_m *MockReserveIdleRuntimeResponse) reserveIdleRuntimeResponse() { | ||
| _m.Called() | ||
| } | ||
|
|
||
| func NewMockReserveIdleRuntimeResponse(t interface { | ||
| mock.TestingT | ||
| Cleanup(func()) | ||
| }) *MockReserveIdleRuntimeResponse { | ||
| mock := &MockReserveIdleRuntimeResponse{} | ||
| mock.Mock.Test(t) | ||
|
|
||
| t.Cleanup(func() { mock.AssertExpectations(t) }) | ||
|
|
||
| return mock | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add this file now? I see another PR open to add this, and some discussion there already: https://github.com/aws/aws-lambda-runtime-interface-emulator/pull/168/changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe so. It was added to the new GithubReady package that was made so I left it included