Skip to content

Session scoped resource attributes wrongly persist in OTel #475

@mmarczell-graphisoft

Description

@mmarczell-graphisoft

Previously the SDK did not log the application version in the OTel standard service.version attribute, so I added the following line to my app:

try embrace.metadata.addResource(key: ResourceAttributes.serviceVersion.rawValue, value: "1.0.0");

SDK from version 6.12 added automatic logging of this OTel property in #254, so I removed the line from the app code. Now I'm getting OTel traces on my OTel collector where emb.app.version and emb.app.bundle_version are up to date, but service.version contains an earlier version: the last version of the app which still had the above line. Even if I add this line

try embrace.metadata.removeResource(key: ResourceAttributes.serviceVersion.rawValue);

the field is still included in the attributes logged to OTel.

I can see that the resource API is deprecated, but I would still like a way to clear this wrongly persisted value so that the logic in

if attributes[SemanticConventions.Service.version.rawValue] == nil, let appVersion = EMBDevice.appVersion {

can kick in and provide the correct value.

Please note that this bug is not specific to service.version: any session scoped resource attribute added, even in an earlier version of the SDK, has persisted in the database and pollutes the attributes logged to OTel.

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