Skip to content

Commit

Permalink
Stop collecting package versions (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmojaki authored Aug 20, 2024
1 parent fe12714 commit 181640f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
6 changes: 3 additions & 3 deletions logfire/_internal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@
from logfire.version import VERSION

from .auth import DEFAULT_FILE, DefaultFile, is_logged_in
from .collect_system_info import collect_package_info
from .config_params import ParamManager, PydanticPluginRecordValues
from .constants import (
DEFAULT_FALLBACK_FILE_NAME,
OTLP_MAX_BODY_SIZE,
RESOURCE_ATTRIBUTES_PACKAGE_VERSIONS,
LevelName,
)
from .exporters.console import (
Expand Down Expand Up @@ -583,8 +581,10 @@ def _initialize(self) -> ProxyTracerProvider:
with suppress_instrumentation():
otel_resource_attributes: dict[str, Any] = {
ResourceAttributes.SERVICE_NAME: self.service_name,
RESOURCE_ATTRIBUTES_PACKAGE_VERSIONS: json.dumps(collect_package_info(), separators=(',', ':')),
ResourceAttributes.PROCESS_PID: os.getpid(),
# Having this giant blob of data associated with every span/metric causes various problems so it's
# disabled for now, but we may want to re-enable something like it in the future
# RESOURCE_ATTRIBUTES_PACKAGE_VERSIONS: json.dumps(collect_package_info(), separators=(',', ':')),
}
if self.service_version:
otel_resource_attributes[ResourceAttributes.SERVICE_VERSION] = self.service_version
Expand Down
21 changes: 4 additions & 17 deletions tests/test_collect_package_resources.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
import json

from dirty_equals import IsPartialDict

from logfire import VERSION, info
from logfire.testing import TestExporter


def test_collect_resources(exporter: TestExporter) -> None:
info('test')

resources = [
span['resource']
for span in exporter.exported_spans_as_dict(include_resources=True, include_package_versions=True)
]
from logfire import VERSION
from logfire._internal.collect_system_info import collect_package_info

assert len(resources) == 1
resource = resources[0]
data = json.loads(resource['attributes']['logfire.package_versions'])

assert data == IsPartialDict({'logfire': VERSION})
def test_collect_package_info() -> None:
assert collect_package_info() == IsPartialDict({'logfire': VERSION})

0 comments on commit 181640f

Please sign in to comment.