Skip to content

Configure our opentelemetry tracing so we can sample it and enable opentelemetry tracing in prod #1090

@bisgaard-itis

Description

@bisgaard-itis

In the simcore stack tracing can either be enabled or disabled and it is enabled on master and staging deployments while disabled on production deployments. We should allow for a sampling based trace collection strategy in osparc simcore and enable tracing in production.

Steps to be done

from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.sampling import ParentBased, TraceIdRatioBased

# Sample 10% of new traces; child spans inherit their parent’s decision
tracer_provider = TracerProvider(
    sampler=ParentBased(root=TraceIdRatioBased(0.1))
)

where the 0.1 is the sampling ratio, which should be an environment variable. I would suggest to keep that value 1.0 on master and staging deployments and 0.1 or 0.2 on production deployments.

  • We should check that the above works with a sampling ratio of, say 0.1, on master before this moves to prod.
  • We need to add environment variables in the different repo.configs to set the wanted sampling rate.
  • Together with the above code modification I would also enable tracing in the local deployment by default .env-devel on osparc-simcore as it is very useful for local debugging.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions