Skip to content
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

feat(sage): create the project sage-otel-collector (ARCH-324) #2908

Merged

Conversation

tschaffter
Copy link
Member

@tschaffter tschaffter commented Nov 13, 2024

Closes https://sagebionetworks.jira.com/browse/ARCH-324

Changelog

  • Copy the files from Sage-Bionetworks/sage-otel-collector to the folder apps/sage/otel-collector.
  • Add project.json with task to build, scan and serve the app.
  • Add Docker compose files in docker/sage.

Preview

Build the Docker image

nx build-image sage-otel-collector

Output:

$ docker images
REPOSITORY                                     TAG           IMAGE ID       CREATED              SIZE
ghcr.io/sage-bionetworks/sage-otel-collector   local         79875fd10376   About a minute ago   281MB
ghcr.io/sage-bionetworks/sage-otel-collector   sha-7b6c9c3   79875fd10376   About a minute ago   281MB

Note

The task build-image for this project is automatically inferred by the Sage Monorepo Nx Plugin, eliminating the need to define it in project.json.

Scan the Docker image with Trivy

$ nx scan-image sage-otel-collector

> nx run sage-otel-collector:scan-image

> trivy image ghcr.io/sage-bionetworks/sage-otel-collector:local --quiet
...

Start the Docker container locally

nx serve-detach sage-otel-collector

Output:

> nx run sage-otel-collector:serve-detach

> docker/sage/serve-detach.sh sage-otel-collector

[+] Running 2/2
 ✔ Network sage                   Created                                                                                0.2s 
 ✔ Container sage-otel-collector  Started                                                                                1.0s 

—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Successfully ran target serve-detach for project sage-otel-collector (2s)

$ docker ps
CONTAINER ID   IMAGE                                                COMMAND                  CREATED              STATUS              PORTS                                                                                                                                                       NAMES
ae000b420be8   ghcr.io/sage-bionetworks/sage-otel-collector:local   "/otelcol-contrib --…"   About a minute ago   Up About a minute   0.0.0.0:1888->1888/tcp, 0.0.0.0:4317->4317/tcp, 0.0.0.0:8888-8889->8888-8889/tcp, 4318/tcp, 0.0.0.0:13133->13133/tcp, 0.0.0.0:55679->55679/tcp, 55678/tcp   sage-otel-collector

Publish the Docker image to GHCR

This Docker image ghcr.io/sage-bionetworks/sage-otel-collector will be published to GHCR with the tag "edge" and "sha-<7-digit commit ID>" when merging this PR to the main branch. This behavior is defined by the task publish-image (will be automatically inferred in the future like the task build-image) and the main CI/CD workflow.

Publishing this image with a semver version will be described in a following PR.

@tschaffter tschaffter marked this pull request as ready for review November 13, 2024 18:09
@tschaffter tschaffter merged commit e42f2b9 into Sage-Bionetworks:main Nov 13, 2024
15 of 16 checks passed
@tschaffter tschaffter deleted the sage/create-sage-otel-collector branch November 13, 2024 18:21
- '8888:8888' # Prometheus metrics exposed by the collector
- '8889:8889' # Prometheus exporter metrics
- '13133:13133' # health_check extension
- '4317:4317' # OTLP gRPC receiver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my purpose only 13133 and 4318 are needed. I am sending data over http instead of grpc

If you are planning to use this for OC, then some more ports are needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is addressed in #2909.

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.

2 participants