OpenTelemetry log export
Author: anish-sahooCreated Aug 26, 2026Updated Aug 26, 2026
I'd love to have exportable logs + general niceties related to logging. Making this issue so I can track my work. Do not contribute to this, I am working on this.
# cog.yaml
observability:
logs: true# predict.py
import logging
def predict() -> str:
print("starting prediction")
logging.info("preprocessing complete")
return "result"Both print() and logging show up in the collector carrying prediction context:
body: "starting prediction"
attributes: { source: stdout, operation: predict, cog.prediction.id: "..." }
body: "preprocessing complete"
attributes: { source: logging, operation: predict, cog.prediction.id: "..." }Customization stays optional through telemetry.py:
# telemetry.py
from opentelemetry.sdk._logs import LoggerProvider
from opentelemetry.sdk.resources import Resource
def create_logger_provider(resource: Resource) -> LoggerProvider:
...// coglet runtime events export to the same OpenTelemetry destination.
tracing::info!("prediction accepted");Source: replicate/cog