Skip to content

Comments

Build collector for AgentCore Runtime#421

Open
wangzlei wants to merge 3 commits intoamazon-contributing:aws-ocb-devfrom
wangzlei:aws-ocb-dev
Open

Build collector for AgentCore Runtime#421
wangzlei wants to merge 3 commits intoamazon-contributing:aws-ocb-devfrom
wangzlei:aws-ocb-dev

Conversation

@wangzlei
Copy link
Collaborator

@wangzlei wangzlei commented Feb 20, 2026

Description

Running ./build-agentcore.sh builds a custom collector by ocb for running in AWS AgentCore Runtime
The custom collector contains limited components, binary size is around 40M so far.
Running ./test-agentcore.sh for e2e testing in local environment.

Testing

[/Volumes/workplace/opentelemetry-collector-contrib/ocb-utils/agentcore]$ ./build-agentcore.sh && ./test-agentcore.sh
==========================================
Building ARM64 Application Signals Collector
==========================================
OCB Version: 0.121.0
Target Platform: darwin/arm64
Building with current branch code
Cleaning output directory...

Step 1/4: Building Docker image...
[+] Building 24.6s (19/19) FINISHED                                                                                                                              docker:desktop-linux
 => [internal] load build definition from Dockerfile.agentcore-build                                                                                                             0.0s
 => => transferring dockerfile: 1.38kB                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                 1.0s
 => [internal] load metadata for public.ecr.aws/docker/library/golang:1.23.2                                                                                                     0.1s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                0.0s
 => => transferring context: 2B                                                                                                                                                  0.0s
 => [build 1/9] FROM public.ecr.aws/docker/library/golang:1.23.2@sha256:ad5c126b5cf501a8caef751a243bb717ec204ab1aa56dc41dc11be089fafcb4f                                         0.0s
 => => resolve public.ecr.aws/docker/library/golang:1.23.2@sha256:ad5c126b5cf501a8caef751a243bb717ec204ab1aa56dc41dc11be089fafcb4f                                               0.0s
 => [internal] load build context                                                                                                                                                0.8s
 => => transferring context: 2.31MB                                                                                                                                              0.8s
 => [stage-1 1/3] FROM docker.io/library/alpine:latest@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659                                                   0.0s
 => => resolve docker.io/library/alpine:latest@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659                                                           0.0s
 => CACHED [build 2/9] WORKDIR /tmp/build/                                                                                                                                       0.0s
 => CACHED [build 3/9] RUN go env -w GOPROXY=direct                                                                                                                              0.0s
 => CACHED [build 4/9] RUN curl --proto '=https' --tlsv1.2 -fL -o ocb     https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fbuilder%2F  0.0s
 => CACHED [build 5/9] RUN chmod +x ocb                                                                                                                                          0.0s
 => [build 6/9] COPY . /src/opentelemetry-collector-contrib/                                                                                                                     1.8s
 => [build 7/9] COPY ocb-utils/agentcore/builder-config-agentcore.yaml ./builder-config-agentcore.yaml                                                                           0.1s
 => [build 8/9] RUN apt-get update && apt-get install -y gettext-base && rm -rf /var/lib/apt/lists/*                                                                             3.7s
 => [build 9/9] RUN --mount=type=cache,target=/go/pkg/mod     export OCB_VERSION=0.121.0 &&     envsubst < builder-config-agentcore.yaml > builder-config-resolved.yaml &&      16.8s
 => CACHED [stage-1 2/3] COPY --from=build /tmp/build/otelcol-agentcore/otelcol-agentcore /output/                                                                               0.0s 
 => CACHED [stage-1 3/3] WORKDIR /output                                                                                                                                         0.0s 
 => exporting to image                                                                                                                                                           0.1s
 => => exporting layers                                                                                                                                                          0.0s
 => => exporting manifest sha256:bb7642a4fce1cd0ac54212ec94b9e7db2cf2be2c824008a472aee8a9c106eaaf                                                                                0.0s
 => => exporting config sha256:92fcf73ab3fe3b02f6367f99458a16d69aa19b2ce6a320c13bcdda0bebf96366                                                                                  0.0s
 => => exporting attestation manifest sha256:f49cf5880aa2296cce76a06f60486022a11e0e572e95edd2fed7c29f5f90fe9c                                                                    0.0s
 => => exporting manifest list sha256:b00011e0e4c386975ffcb8838f4e66384afae0f7772c05e13fcaae7277a40114                                                                           0.0s
 => => naming to docker.io/library/otelcol-appsignals-builder:latest                                                                                                             0.0s
 => => unpacking to docker.io/library/otelcol-appsignals-builder:latest                                                                                                          0.0s

Step 2/4: Running temporary container...
7c47fc9aed5dac73ac2ebbaa68edecd8f8ec0927b330f5fc4a3ac51cfd61e60c

Step 3/4: Copying binary from container to local...
Successfully copied 44.8MB to /Volumes/workplace/opentelemetry-collector-contrib/ocb-utils/agentcore/output/otelcol-agentcore

Step 4/4: Cleaning up temporary container...
otelcol-appsignals-build-temp

==========================================
✅ Build completed!
==========================================

Binary location: ./output/otelcol-agentcore

Verify file:
-rwxr-xr-x@ 1 wangzl  staff    43M Feb 20 10:45 ./output/otelcol-agentcore

Usage:
  ./output/otelcol-agentcore --config /path/to/your/config.yaml

[12:06:47] Step 1/7: Pre-flight checks
[12:06:48]   Binary: /Volumes/workplace/opentelemetry-collector-contrib/ocb-utils/agentcore/output/otelcol-agentcore
[12:06:48]   Region: us-west-2
[12:06:48]   Checks passed
[12:06:48] Step 2/7: Ensuring CloudWatch log groups and streams exist
[12:06:53]   Log groups ready: AgentCoreAppLogs, AgentCoreEMF
[12:06:53]   Test start timestamp: 1771618013000
[12:06:53] Step 3/7: Starting collector
[12:06:53]   Collector PID: 24894
[12:06:55]   Collector is ready
[12:06:55] Step 4/7: Sending telemetry data
Sending telemetry data (traces, metrics, logs)...
  Iteration 1/3 done
  Iteration 2/3 done
  Iteration 3/3 done
Waiting for export flush...
Done! Check collector logs for traces, metrics, and logs.
[12:07:05]   Telemetry sent
[12:07:05] Step 5/7: Waiting for CloudWatch ingestion (15s)
[12:07:20] Step 6/7: Verifying data in CloudWatch
[12:07:22] PASS: Logs: 3 matching events in AgentCoreAppLogs (5 total)
[12:07:23] PASS: Metrics (EMF): 1 matching events in AgentCoreEMF (4 total)
[12:07:24] PASS: Traces (Spans): 6 matching events in aws/spans (6 total)
[12:07:24] Step 7/7: Checking collector log for errors
[12:07:24] PASS: No export errors in collector log

==========================================
  Test Summary
==========================================
  PASS: 4
  FAIL: 0
==========================================
  Result: ALL PASSED

Stopping collector (PID 24894)...

Documentation

@wangzlei wangzlei requested a review from mxiamxia as a code owner February 20, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant