Skip to content

Commit

Permalink
chore: add OTEL_RESOURCE_ATTRIBUTES env var
Browse files Browse the repository at this point in the history
  • Loading branch information
rudoi committed Nov 5, 2024
1 parent de2bee3 commit 46a1822
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/controller/gameserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ func (r *GameServerReconciler) reconcilePod(ctx context.Context, gameServer *gam
// Add StorageKey argument
args = append(args, fmt.Sprintf("-StorageKey=%s", storageKey))

// set up OTEL_RESOURCE_ATTRIBUTES env var
otelResourceAttributes := fmt.Sprintf("game_server_name=%s", gameServer.GetName())

// We need to create a Pod.
pod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -253,6 +256,12 @@ func (r *GameServerReconciler) reconcilePod(ctx context.Context, gameServer *gam
Name: "game-server",
Image: image,
Args: args,
Env: []corev1.EnvVar{
{
Name: "OTEL_RESOURCE_ATTRIBUTES",
Value: otelResourceAttributes,
},
},
Ports: []corev1.ContainerPort{
{
Name: "game",
Expand Down

0 comments on commit 46a1822

Please sign in to comment.