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

Otel collector support #22

Merged
merged 4 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .taskcat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ tests:
PrivateDNS: CreateNew
ExportMetrics: 'Yes'
EnableContainerInsights: 'Yes'
OpenTelemetryCollector: 'Yes'
CreateVpcEndpoints: 'Yes'
regions:
- us-east-1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ Run docker image without parameters to get the help output. Some examples:
docker run jaeger-taskcat
docker run jaeger-taskcat test -h
docker run jaeger-taskcat test run -h
```
```
34 changes: 33 additions & 1 deletion templates/jaeger-entry-existing-vpc.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ Metadata:
- JaegerVersion
- StorageBackend
- InternalLoadBalancer
- Label:
default: OpenTelemetry Collector configuration
Parameters:
- OpenTelemetryCollector
- OpenTelemetryCollectorImage
- OpenTelemetryCollectorVersion
- Label:
default: "[Only for Elasticsearch backend] Elasticsearch configuration"
Parameters:
Expand Down Expand Up @@ -115,7 +121,14 @@ Metadata:
default: Jaeger storage backend
InternalLoadBalancer:
default: Use internal load balancer
# Elasticsearch parameters
# OpenTelemetry Collector configuration
OpenTelemetryCollector:
default: OpenTelemetry Collector
OpenTelemetryCollectorImage:
default: OpenTelemetry Collector image
OpenTelemetryCollectorVersion:
default: OpenTelemetry Collector version
# Elasticsearch configuration
ESEngineVersion:
default: Elasticsearch version
ESInstanceCount:
Expand Down Expand Up @@ -228,6 +241,21 @@ Parameters:
Default: 'No'
Description: Choose "Yes" to deploy Jaeger load balancer in private VPC subnets.

# OpenTelemetry Collector parameters
OpenTelemetryCollector:
Type: String
AllowedValues: [ 'Yes', 'No' ]
Default: 'No'
Description: Choose "Yes" to deploy OpenTelemetry Collector in fron of Jaeger.
OpenTelemetryCollectorImage:
Type: String
Default: otel/opentelemetry-collector
Description: Docker image for the OpenTelemetry Collector
OpenTelemetryCollectorVersion:
Type: String
Default: '0.50.0'
Description: Version of the OpenTelemetry Collector.

# Elasticsearch parameters
ESEngineVersion:
Type: String
Expand Down Expand Up @@ -387,6 +415,10 @@ Resources:
JaegerVersion: !Ref JaegerVersion
StorageBackend: !Ref StorageBackend
InternalLoadBalancer: !Ref InternalLoadBalancer
# OpenTelemetry Collector parameters
OpenTelemetryCollector: !Ref OpenTelemetryCollector
OpenTelemetryCollectorImage: !Ref OpenTelemetryCollectorImage
OpenTelemetryCollectorVersion: !Ref OpenTelemetryCollectorVersion
# Elasticsearch parameters
ESEngineVersion: !Ref ESEngineVersion
ESInstanceCount: !Ref ESInstanceCount
Expand Down
34 changes: 33 additions & 1 deletion templates/jaeger-entry-new-vpc.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ Metadata:
- JaegerVersion
- StorageBackend
- InternalLoadBalancer
- Label:
default: OpenTelemetry Collector configuration
Parameters:
- OpenTelemetryCollector
- OpenTelemetryCollectorImage
- OpenTelemetryCollectorVersion
- Label:
default: "[Only for Elasticsearch backend] Elasticsearch configuration"
Parameters:
Expand Down Expand Up @@ -118,7 +124,14 @@ Metadata:
default: Jaeger storage backend
InternalLoadBalancer:
default: Use internal load balancer
# Elasticsearch parameters
# OpenTelemetry Collector configuration
OpenTelemetryCollector:
default: OpenTelemetry Collector
OpenTelemetryCollectorImage:
default: OpenTelemetry Collector image
OpenTelemetryCollectorVersion:
default: OpenTelemetry Collector version
# Elasticsearch configuration
ESEngineVersion:
default: Elasticsearch version
ESInstanceCount:
Expand Down Expand Up @@ -258,6 +271,21 @@ Parameters:
Default: 'No'
Description: Choose "Yes" to deploy Jaeger load balancer in private VPC subnets.

# OpenTelemetry Collector parameters
OpenTelemetryCollector:
Type: String
AllowedValues: [ 'Yes', 'No' ]
Default: 'No'
Description: Choose "Yes" to deploy OpenTelemetry Collector in fron of Jaeger.
OpenTelemetryCollectorImage:
Type: String
Default: otel/opentelemetry-collector
Description: Docker image for the OpenTelemetry Collector
OpenTelemetryCollectorVersion:
Type: String
Default: '0.50.0'
Description: Version of the OpenTelemetry Collector.

# Elasticsearch parameters
ESEngineVersion:
Type: String
Expand Down Expand Up @@ -446,6 +474,10 @@ Resources:
JaegerVersion: !Ref JaegerVersion
StorageBackend: !Ref StorageBackend
InternalLoadBalancer: !Ref InternalLoadBalancer
# OpenTelemetry Collector parameters
OpenTelemetryCollector: !Ref OpenTelemetryCollector
OpenTelemetryCollectorImage: !Ref OpenTelemetryCollectorImage
OpenTelemetryCollectorVersion: !Ref OpenTelemetryCollectorVersion
# Elasticsearch parameters
ESEngineVersion: !Ref ESEngineVersion
ESInstanceCount: !Ref ESInstanceCount
Expand Down
229 changes: 229 additions & 0 deletions templates/workload/jaeger-otel-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
AWSTemplateFormatVersion: '2010-09-09'
Description: Deploys OpenTelemetry Collector (TODO)

Parameters:
# Basic Configuration
EnvironmentName:
Type: String
# VPC parameters
VPCID:
Type: AWS::EC2::VPC::Id
Description: ID of your existing VPC (e.g., vpc-0343606e).
VPCCIDR:
AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-8]))$
Type: String
PrivateSubnet1ID:
Type: AWS::EC2::Subnet::Id
PrivateSubnet2ID:
Type: AWS::EC2::Subnet::Id
PrivateSubnet3ID:
Type: String
Default: ''
# Jaeger parameters
ClusterArn:
Type: String
LoadBalancerArn:
Type: String
JaegerEndpoint:
Type: String
OpenTelemetryCollectorImage:
Type: String
OpenTelemetryCollectorVersion:
Type: String

Conditions:
Using3AvailabilityZones: !Not [!Equals [!Ref PrivateSubnet3ID, '']]

Resources:

# Configuration
ConfigurationParameter:
Type: AWS::SSM::Parameter
Properties:
Description: Jaeger OpenTelemetry Collector configuration
Name: !Sub "/quickstart/jaeger/${EnvironmentName}/otel-collector-config"
Type: String
Value:
Fn::Base64:
Fn::Sub: |
receivers:
otlp:
protocols:
grpc:
http:
exporters:
logging:
loglevel: debug
jaeger:
endpoint: ${JaegerEndpoint}:14250
tls:
insecure: true
service:
pipelines:
traces:
receivers: [otlp]
exporters: [logging, jaeger]

# Target Groups
TargetGroup4317:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
Port: 4317
Protocol: TCP
TargetType: ip
VpcId: !Ref VPCID
Tags:
- Key: Name
Value: !Sub jaeger-4317-${EnvironmentName}

# Listeners
Listener4317:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
DefaultActions:
- TargetGroupArn:
Ref: TargetGroup4317
Type: forward
LoadBalancerArn: !Ref LoadBalancerArn
Port: 4317
Protocol: TCP

# Roles
TaskRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Version: "2012-10-17"

ExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Version: "2012-10-17"
Policies:
- PolicyName: jaeger-otel-execution-policy
PolicyDocument:
Version: "2012-10-17"
Statement:
- Action:
- logs:CreateLogStream
- logs:PutLogEvents
Effect: Allow
Resource: !GetAtt LogGroup.Arn
- Action:
- ssm:GetParameters
- ssm:GetParameter
Effect: Allow
Resource: !Sub "arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter${ConfigurationParameter}"

# Task Definition
LogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 30

TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: !Sub quickstart-jaeger-otel-${EnvironmentName}
Volumes:
- Name: otel-conf-volume
Host: {}
ContainerDefinitions:
- Name: jaeger-otel
Essential: true
Image: !Sub ${OpenTelemetryCollectorImage}:${OpenTelemetryCollectorVersion}
Command:
- --config=/otel/conf/jaeger-export.conf
DependsOn:
- Condition: COMPLETE
ContainerName: jaeger-otel-config
PortMappings:
- ContainerPort: 4317 # Default endpoint for OpenTelemetry receiver
Protocol: tcp
MountPoints:
- ContainerPath: /otel/conf
SourceVolume: otel-conf-volume
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group: !Ref LogGroup
awslogs-stream-prefix: jaeger-otel
awslogs-region: !Ref AWS::Region
- Name: jaeger-otel-config
Image: bash
Essential: false
Command:
- -c
- echo $OTEL_CONFIG | base64 -d - | tee /otel/conf/jaeger-export.conf
Secrets:
- Name: OTEL_CONFIG
ValueFrom: !Sub "arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter${ConfigurationParameter}"
MountPoints:
- ContainerPath: /otel/conf
SourceVolume: otel-conf-volume
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group: !Ref LogGroup
awslogs-stream-prefix: jaeger-otel-config
awslogs-region: !Ref AWS::Region
Cpu: "1024"
ExecutionRoleArn: !GetAtt ExecutionRole.Arn
Memory: "2048"
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
TaskRoleArn: !GetAtt TaskRole.Arn

# Service
Service:
Type: AWS::ECS::Service
Properties:
ServiceName: jaeger-otel
Cluster: !Ref ClusterArn
DesiredCount: 1
HealthCheckGracePeriodSeconds: 30
LaunchType: FARGATE
LoadBalancers:
- ContainerName: jaeger-otel
ContainerPort: 4317
TargetGroupArn: !Ref TargetGroup4317
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: DISABLED
SecurityGroups:
- !GetAtt ServiceSecurityGroup.GroupId
Subnets:
- !Ref PrivateSubnet1ID
- !Ref PrivateSubnet2ID
- !If [Using3AvailabilityZones, !Ref PrivateSubnet3ID, !Ref 'AWS::NoValue']
TaskDefinition: !Ref TaskDefinition

ServiceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: quickstart-jaeger/jaeger/jaeger-otel/SecurityGroup
VpcId: !Ref VPCID
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0
Description: Allow all outbound traffic by default
IpProtocol: tcp
FromPort: 0
ToPort: 65535
SecurityGroupIngress:
- CidrIp: !Ref VPCCIDR
Description: Allow ECS Service access (port 4317) from within VPC
IpProtocol: tcp
FromPort: 4317
ToPort: 4317
Loading