Skip to content

OpenTelemetry log export #3162

Description

@anish-sahoo

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");

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions