Skip to content

feat: add tracing interface lib#588

Draft
dwilding wants to merge 11 commits into
canonical:mainfrom
dwilding:add-tracing-lib
Draft

feat: add tracing interface lib#588
dwilding wants to merge 11 commits into
canonical:mainfrom
dwilding:add-tracing-lib

Conversation

@dwilding

@dwilding dwilding commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Resolves #581 and replaces #439.

This PR migrates charms.tempo_coordinator_k8s.v0.tracing to become the tracing interface lib in Charmlibs.

This is a bug-for-bug migration, following How to migrate to the charmlibs monorepo. The package version is set to 1.0.0. I had to make formatting and type-checking changes to comply with Charmlibs requirements.

The first 11 commits correspond to the migration plan in #581. I strongly recommend reviewing the commits in sequence, cross-checking with that plan.

Preview of the new reference docs

"""Raised when one wrongly assumes that there can only be one relation on an endpoint."""


if int(pydantic.version.VERSION.split(".")[0]) < 2:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now depend on pydantic>=2 (see pyproject.toml). So this is dead code. There's an identical if statement further down the file. Shall we remove the code?


Usage::

>>> from lib.charms.tempo_coordinator_k8s.v0.charm_tracing import trace_charm

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib.charms.tempo_coordinator_k8s.v0.charm_tracing is a separate lib. How should we adjust this usage example?

In #439, Dima thought that the whole charm_tracing_config function ought to be deprecated.

@@ -0,0 +1,247 @@
# Copyright 2026 Canonical Ltd.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only migrated the requirer tests. The Charmhub-hosted lib also has provider, legacy, and ingressed tests, which depend on TempoCoordinatorCharm. How should we handle those?

In #439, Dima migrated the provider tests by writing a minimal MyCharm(ops.CharmBase) wrapper for TracingEndpointProvider, to replace the TempoCoordinatorCharm dependency.

AmbiguousRelationUsageError,
BrokenEvent,
DataAccessPermissionError,
DatabagModel,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect people to subclass this? Should it even be exported?

Comment thread .docs/reference/libs.yaml
description: Deprecated in favor of ``charmlibs.interfaces.tracing``.
tags:
- observability
- name: charms.tempo_coordinator_k8s.tracing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also update the lib field in interfaces/tracing/interface/v2/interface.yaml? Or wait until this PR has merged?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate tracing interface lib

1 participant