Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tags to listener #107

Merged
merged 6 commits into from
Oct 20, 2020
Merged

Conversation

meghna-dd
Copy link
Contributor

What does this PR do?

Add version tags to trace/listerner.ts rather than enhanced-metrics.

Motivation

Better debugging experience.

Testing Guidelines

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@meghna-dd meghna-dd requested a review from a team as a code owner October 7, 2020 18:00
@codecov-io
Copy link

codecov-io commented Oct 7, 2020

Codecov Report

Merging #107 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #107      +/-   ##
==========================================
+ Coverage   88.28%   88.30%   +0.02%     
==========================================
  Files          28       28              
  Lines         913      915       +2     
  Branches      159      159              
==========================================
+ Hits          806      808       +2     
  Misses         74       74              
  Partials       33       33              
Impacted Files Coverage Δ
src/handler.ts 0.00% <ø> (ø)
src/trace/constants.ts 100.00% <100.00%> (ø)
src/trace/listener.ts 91.80% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e3ae714...17f9617. Read the comment docs.

Copy link
Contributor

@Czechh Czechh left a comment

Choose a reason for hiding this comment

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

Code LGTM - I'm interested in the integration tests + manual verification before merging+releasing

@@ -9,6 +9,8 @@ import { didFunctionColdStart } from "../utils/cold-start";
import { Source } from "./constants";
import { patchConsole } from "./patch-console";
import { SpanContext, TraceOptions, TracerWrapper } from "./tracer-wrapper";
const datadogLambdaVersion = "3.32.0";
Copy link
Contributor

Choose a reason for hiding this comment

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

You could export these are reuse them in the spec file, so you only have to substitute once. Or put them in the constants.ts file. I'd also leave this as a dummy value, eg 'x.xx.x' so if we accidentally push a build with the wrong version we can catch it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

DATADOG_LAMBDA_VERSION=$(cat package.json | jq -r ".version")
DD_TRACE_VERSION=$(cat package.json | jq -r ."devDependencies"'."dd-trace"')

sed -i "" -E "s/(datadogLambdaVersion = )\"([0-9]*\.[0-9]*\.[0-9]*)\"/\1\""$DATADOG_LAMBDA_VERSION"\"/" ./src/trace/listener.ts
Copy link
Contributor

Choose a reason for hiding this comment

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

So, we could apply this in build_layers but then running just yarn build, (which we do when deploying the npm package), wouldn't work. You could create a new script, say './update_dist_version.sh', and run that as a post-script to yarn build eg. https://gist.github.com/coryhouse/b7ff5e6d1e41b762c35b, and modify the dist directory instead of touching the src code every time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@@ -11,6 +11,13 @@ set -e
LAYER_DIR=".layers"
LAYER_FILES_PREFIX="datadog_lambda_node"
NODE_VERSIONS=("10.15" "12.13")
DATADOG_LAMBDA_VERSION=$(cat package.json | jq -r ".version")
DD_TRACE_VERSION=$(cat package.json | jq -r ."devDependencies"'."dd-trace"')
Copy link
Contributor

Choose a reason for hiding this comment

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

The version of dd-trace-js specified in the package.json can be just a suggestion. For instance ^0.20.0, would mean any minor version greater than 20, but not a major version, so 0.25.5 would match, but not 1.21.0. Right now it's locked in the package.json to an explicit version, but we might change that in the future. The place to actually search is the yarn.lock file, which usually has an entry like this: https://github.com/DataDog/datadog-lambda-js/blob/master/yarn.lock#L1341 . I think we can leave it for now though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

@DarcyRaynerDD DarcyRaynerDD left a comment

Choose a reason for hiding this comment

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

LGTM

@meghna-dd meghna-dd merged commit 3e06df8 into master Oct 20, 2020
@meghna-dd meghna-dd deleted the meghna.banerjee/add_version_to_trace branch October 20, 2020 15:54
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.

5 participants