Skip to content

Add support for DD_VERSION and DD_ENV variables#803

Merged
labbati merged 9 commits intomasterfrom
brettlangdon/dd.version.env
Jul 1, 2020
Merged

Add support for DD_VERSION and DD_ENV variables#803
labbati merged 9 commits intomasterfrom
brettlangdon/dd.version.env

Conversation

@brettlangdon
Copy link
Copy Markdown
Member

@brettlangdon brettlangdon commented Mar 25, 2020

Description

Adding support for DD_VERSION and DD_ENV environment variables.

These variables should set default global tags of version and env on every span generated.

Readiness checklist

  • Changelog has been added to the appropriate release draft. Create one if necessary.
  • Tests added for this feature/bug.

Reviewer checklist

  • Appropriate labels assigned.
  • Milestone is set.
  • Changelog has been added to the appropriate release draft. For community contributors the reviewer is in charge of this task.

Copy link
Copy Markdown
Collaborator

@morrisonlevi morrisonlevi left a comment

Choose a reason for hiding this comment

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

This looks good to me, but I am surprised that tests did not fail.

@labbati
Copy link
Copy Markdown
Member

labbati commented Mar 26, 2020

@brettlangdon thanks for the work on this. I can download it tomorrow first thing in the morning and play with it to understand why it is not failing, as I am surprised as well

@brettlangdon
Copy link
Copy Markdown
Member Author

well, by default it won't add actually modify anything, if no env variables are provided, then no changes to spans.

@brettlangdon brettlangdon marked this pull request as ready for review April 1, 2020 13:44
$this->assertTrue(empty($traces[0][0]['meta']['env']));
}

public function testDDEnvHasPrecendenceOverGlobalTags()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note, this would succeed in any case until the DD_TAG PR #920 is merged. After #920 is merged then it succeed only if the order it correct.

$this->assertTrue(empty($traces[0][0]['meta']['version']));
}

public function testDDVersionHasPrecendenceOverGlobalTags()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note, this would succeed in any case until the DD_TAG PR #920 is merged. After #920 is merged then it succeed only if the order it correct.

@labbati labbati added this to the 0.47.0 milestone Jun 12, 2020
@SammyK SammyK added the 🏆 enhancement A new feature or improvement label Jun 15, 2020
Copy link
Copy Markdown
Contributor

@SammyK SammyK left a comment

Choose a reason for hiding this comment

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

Excellent work @brettlangdon! 🔝

Comment thread src/DDTrace/Tracer.php

// Application version
if (null !== $this->serviceVersion) {
$span->setTag(Tag::VERSION, $this->serviceVersion);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just want to confirm that it was intentional to not use Tag::SERVICE_VERSION here, correct?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's correct. Tag::SERVICE_VERSION =service.version is only there for compatibility for OpenTelemetry. What we want to set is version.

@labbati labbati closed this Jun 19, 2020
@labbati labbati reopened this Jul 1, 2020
@labbati labbati merged commit b0ccf2f into master Jul 1, 2020
@labbati labbati deleted the brettlangdon/dd.version.env branch July 1, 2020 13:37
@morrisonlevi morrisonlevi mentioned this pull request Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏆 enhancement A new feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants