Skip to content

[BUG] Sampling rules not respected when using orchestrion #741

@giou-k

Description

@giou-k

Version of orchestrion

Latest - 1.6.1

Describe what happened:
I have the following setup:

  1. I am creating a docker image for my app via a Dockerfile.
  2. Inside the image, I am using serverless-init for my agent, and in there I have set the sampling rules for my service.
  3. I am using orchestrion too, in order to build my app.
  4. I have run orchestrion pin and pushed my go mod and orchestrion.tool.go changes to the repo.
  5. Inside the code I have added //dd:spans and they seem to work fine. I am getting the traces.

I checked my gcp server via dd_trace_startup_logs and the env var is truly getting defined correctly based on my env var DD_TRACE_SAMPLING_RULES='[{"service": "notification-processor", "sample_rate": 0.1}]'.

Describe what you expected:
I would expect that the sampling will be respected but it doesn't. I tried also using sampling value of Zero, but I was getting traces. Looking at ingestion-control in DD I can see that my app has the Automatic label.
When I deleted the orchestrion from my docker image, and used the classic dd tracer client in code, finally the ingestion-control changed to Configured Local and traces tagged with the ingestion reason rule, respecting my sampling rule rate.
I would expect that the same would be happening when I use orchestrion tool.

Steps to reproduce the issue:

here is my Dockerfile, so that you have a better view:

# Build stage
FROM golang:1.24.8-alpine AS builder
RUN apk update && \
    apk upgrade --no-cache && \
    apk add --no-cache ca-certificates && \
    update-ca-certificates && \
    rm -rf /var/cache/apk/*

#RUN go install github.com/DataDog/orchestrion@v1.6.1

WORKDIR /src
COPY . .

#RUN orchestrion go build -o app cmd/main.go
RUN go build -o app cmd/main.go

# Final stage
FROM alpine:latest
# For Security, Update packages to patch known vulnerabilities in the base image.
# Clean up apt cache to keep the image size down.
RUN apk update && \
    apk upgrade --no-cache && \
    apk add --no-cache ca-certificates && \
    update-ca-certificates

# Copy Go binary
COPY --from=builder /src/app /usr/local/bin/app

# Copy Datadog init
COPY --from=datadog/serverless-init:latest-alpine /datadog-init /usr/local/bin/datadog-init

ENV DD_TRACE_DEBUG=true \
DD_TRACE_SAMPLING_RULES='[{"service": "notification-processor", "sample_rate": 0.1}]'

# Set entrypoint and default command
ENTRYPOINT ["/usr/local/bin/datadog-init"]
CMD ["/usr/local/bin/app"]

EXPOSE 8080

Additional environment details (Version of Go, Operating System, etc.):
go version 1.24.8
personla laptop: macOS
docker on amd64 though
Terraform
Gcp cloud run

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions