Skip to content

feat: add tracer #107

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

Merged
merged 31 commits into from
Dec 14, 2021
Merged

feat: add tracer #107

merged 31 commits into from
Dec 14, 2021

Conversation

dreamorosi
Copy link
Contributor

Description of your changes

First draft of the Tracer module, would really appreciate some feedback especially (but not limited to) the unit tests.

How to verify this change

Related issues, RFCs

N/A

PR status

Is this ready for review?: NO
Is it a breaking change?: NO

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • I have added tests that prove my change is effective and works
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published in downstream module
  • The PR title follows the conventional commit semantics

Breaking change checklist

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@saragerion saragerion linked an issue Jul 16, 2021 that may be closed by this pull request
@saragerion saragerion added this to the beta-release milestone Jul 16, 2021
@saragerion
Copy link
Contributor

Reminder: review this first draft @alan-churley @saragerion

@github-actions
Copy link
Contributor

Coverage after merging feature/tracer into main

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
./packages/logger/src
   Logger.ts100%100%100%100%
   helpers.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/logger/src/config
   ConfigService.ts100%100%100%100%
   EnvironmentVariablesService.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/logger/src/formatter
   LogFormatter.ts100%100%100%100%
   PowertoolLogFormatter.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/logger/src/log
   LogItem.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/tracing/src
   Tracer.ts100%100%100%100%
   helpers.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/tracing/src/config
   ConfigService.ts100%100%100%100%
   EnvironmentVariablesService.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/tracing/src/provider
   ProviderService.ts100%100%100%100%
   index.ts100%100%100%100%

@github-actions
Copy link
Contributor

Coverage after merging feature/tracer into main

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
./packages/logger/src
   Logger.ts100%100%100%100%
   helpers.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/logger/src/config
   ConfigService.ts100%100%100%100%
   EnvironmentVariablesService.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/logger/src/formatter
   LogFormatter.ts100%100%100%100%
   PowertoolLogFormatter.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/logger/src/log
   LogItem.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/tracing/src
   Tracer.ts100%100%100%100%
   helpers.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/tracing/src/config
   ConfigService.ts100%100%100%100%
   EnvironmentVariablesService.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/tracing/src/provider
   ProviderService.ts100%100%100%100%
   index.ts100%100%100%100%

@github-actions
Copy link
Contributor

Coverage after merging feature/tracer into main

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
./packages/logger/src
   Logger.ts100%100%100%100%
   helpers.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/logger/src/config
   ConfigService.ts100%100%100%100%
   EnvironmentVariablesService.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/logger/src/formatter
   LogFormatter.ts100%100%100%100%
   PowertoolLogFormatter.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/logger/src/log
   LogItem.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/tracing/src
   Tracer.ts100%100%100%100%
   helpers.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/tracing/src/config
   ConfigService.ts100%100%100%100%
   EnvironmentVariablesService.ts100%100%100%100%
   index.ts100%100%100%100%
./packages/tracing/src/provider
   ProviderService.ts100%100%100%100%
   index.ts100%100%100%100%

@dreamorosi dreamorosi mentioned this pull request Dec 8, 2021
10 tasks
flochaz
flochaz previously approved these changes Dec 10, 2021
saragerion
saragerion previously approved these changes Dec 10, 2021
Copy link
Contributor

@saragerion saragerion left a comment

Choose a reason for hiding this comment

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

Fantastic! Thanks for the great work 👏
I added some minor comments, but it already looks good to me.

Comment on lines 5 to 9
// Reserved environment variables
private awsExecutionEnv = 'AWS_EXECUTION_ENV';
private chaliceLocalVariable = 'AWS_CHALICE_CLI_MODE';
private samLocalVariable = 'AWS_SAM_LOCAL';
private xRayTraceIdVariable = '_X_AMZN_TRACE_ID';
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: only AWS_EXECUTION_ENV and _X_AMZN_TRACE_ID are reserved env variables, see here:
https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
Also, chalice is a python library.

Suggested change
// Reserved environment variables
private awsExecutionEnv = 'AWS_EXECUTION_ENV';
private chaliceLocalVariable = 'AWS_CHALICE_CLI_MODE';
private samLocalVariable = 'AWS_SAM_LOCAL';
private xRayTraceIdVariable = '_X_AMZN_TRACE_ID';
// Reserved environment variables
private awsExecutionEnv = 'AWS_EXECUTION_ENV';
private xRayTraceIdVariable = '_X_AMZN_TRACE_ID';
// Additional environment variables
private samLocalVariable = 'AWS_SAM_LOCAL';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I like the proposed suggestion but I'll have to simply comment this section with // Environment variables because the suggested ordering conflicts with the eslint@typescript-eslint/member-ordering directive (samLocalVariable should be declared before xRayTraceIdVariable).

@dreamorosi dreamorosi dismissed stale reviews from saragerion and flochaz via a8f2eef December 10, 2021 10:46
Copy link
Contributor

@saragerion saragerion left a comment

Choose a reason for hiding this comment

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

Looks great :) amazing job andrea

@dreamorosi dreamorosi merged commit f92279f into main Dec 14, 2021
@dreamorosi dreamorosi deleted the feature/tracer branch December 14, 2021 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracer This item relates to the Tracer Utility
Projects
None yet
4 participants