Hello 👋 I am trying to run an otel
Hello
I am trying to run an otel collector as a container
It looks like this:
and then the code is pretty simple:
But I always get a standard message when hitting /health:
Do you know what I could be missing? Despite defaultPort set to 13133, I don't see it being reflected when running
It looks like this:
docker pull otel/opentelemetry-collector-contrib:0.128.0
docker tag otel/opentelemetry-collector-contrib:0.128.0 opentelemetry-collector-contrib:0.128.0
npx wrangler containers push opentelemetry-collector-contrib:0.128.0docker pull otel/opentelemetry-collector-contrib:0.128.0
docker tag otel/opentelemetry-collector-contrib:0.128.0 opentelemetry-collector-contrib:0.128.0
npx wrangler containers push opentelemetry-collector-contrib:0.128.0and then the code is pretty simple:
// ...
export class OpenTelemetryContainer extends Container {
// Port the container listens on (default: 8080)
defaultPort = 13133; // http port
// Time before ~~container~~ sleeps due to inactivity (default: 30s)
sleepAfter = "2m";
// Environment variables passed to the container
envVars = {
MESSAGE: "I was passed in via the container class!",
};
// ...
}
//...
app.get("/health", async (c) => {
const container = getContainer(c.env.OTEL_CONTAINER);
return await container.fetch(c.req.raw);
});// ...
export class OpenTelemetryContainer extends Container {
// Port the container listens on (default: 8080)
defaultPort = 13133; // http port
// Time before ~~container~~ sleeps due to inactivity (default: 30s)
sleepAfter = "2m";
// Environment variables passed to the container
envVars = {
MESSAGE: "I was passed in via the container class!",
};
// ...
}
//...
app.get("/health", async (c) => {
const container = getContainer(c.env.OTEL_CONTAINER);
return await container.fetch(c.req.raw);
});But I always get a standard message when hitting /health:
There is no Container instance available at this time.
This is likely because you have reached your max concurrent instance count (set in wrangler config) or are you currently provisioning the Container.
If you are deploying your Container for the first time, check your dashboard to see provisioning status, this may take a few minutes.There is no Container instance available at this time.
This is likely because you have reached your max concurrent instance count (set in wrangler config) or are you currently provisioning the Container.
If you are deploying your Container for the first time, check your dashboard to see provisioning status, this may take a few minutes.Do you know what I could be missing? Despite defaultPort set to 13133, I don't see it being reflected when running
docker psdocker ps78b186a1676b cloudflare-dev/opentelemetrycontainer:dd5373cf "/otelcol-contrib --…" 8 seconds ago Up 7 seconds 0.0.0.0:32813->4317/tcp, [::]:32813->4317/tcp, 0.0.0.0:32814->4318/tcp, [::]:32814->4318/tcp, 0.0.0.0:32815->55678/tcp, [::]:32815->55678/tcp, 0.0.0.0:32816->55679/tcp, [::]:32816->55679/tcp workerd-opentelemetry-exploration-OpenTelemetryContainer-c8a1bd81d48b5c133d43ff665add35273c6305f82f94a7fe0adae6baa179c40878b186a1676b cloudflare-dev/opentelemetrycontainer:dd5373cf "/otelcol-contrib --…" 8 seconds ago Up 7 seconds 0.0.0.0:32813->4317/tcp, [::]:32813->4317/tcp, 0.0.0.0:32814->4318/tcp, [::]:32814->4318/tcp, 0.0.0.0:32815->55678/tcp, [::]:32815->55678/tcp, 0.0.0.0:32816->55679/tcp, [::]:32816->55679/tcp workerd-opentelemetry-exploration-OpenTelemetryContainer-c8a1bd81d48b5c133d43ff665add35273c6305f82f94a7fe0adae6baa179c408