OTEL Deployment
At your company, developers can spin up EC2 instances as needed. As the platform team, you want to ensure proper observability by automatically deploying OpenTelemetry collectors to gather metrics and provide standardized monitoring endpoints.
Requirements
- Automatically deploy OpenTelemetry (OTEL) collectors whenever a new EC2 instance is created
- Track resource utilization metrics (CPU, memory, disk) across all developer instances
- Provide developers with a consistent OTLP endpoint they can use for custom metrics
- Maintain the same deployment configuration in both testing and production environments
Technologies
AWS EC2
Cloud computing platform that provides scalable compute capacity. We’ll use EC2 instances as our deployment targets for running applications and collecting metrics.
OpenTelemetry Collector
A vendor-agnostic way to receive, process and export telemetry data. The collector will be automatically deployed to gather system metrics and provide a standardized endpoint for custom application metrics.
Github Actions
CI/CD platform that will automate our deployment pipeline. It will handle the provisioning of collectors and configuration management across all environments.
Solution
1. Getting EC2 Instances into Ctrlplane
Before deploying OpenTelemetry collectors, EC2 instances must be registered as Resources in Ctrlplane. These Resources represent the external state of our EC2 instances and require consistent updates as the state of each instance changes.
These are just some of the ways you can get EC2 instances into Ctrlplane.
In this tutorial, we’ll simplify the process by using the Ctrlplane CLI to manage the state of EC2 instances within Ctrlplane. This approach keeps our deployment pipeline straightforward and concentrated on the primary task. However, a limitation is that the pipeline executes every 10 minutes. Consequently, if a new EC2 instance is launched, it won’t trigger a deployment of OTEL until the next 10-minute cycle.
2. Github Deployment Pipeline
3. Policy Configuration
Conclusion
While this example focuses on AWS EC2, the solution can be applied to any resource type. As long as you can create resources representing your deployment target in Ctrlplane, you can automate the deployment of OpenTelemetry collectors and provide standardized monitoring endpoints for your development teams.