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

fix: metrics not being flushed on every invocation #45

Merged
merged 17 commits into from
May 29, 2020

Conversation

heitorlessa
Copy link
Contributor

@heitorlessa heitorlessa commented May 29, 2020

Issue #, if available: #43

Description of changes:

This addresses the bug found in #43 where a metric set wasn't being flushed at the end of each Lambda function invocation.

  • Adds additional tests to cover this behaviour
  • Further document existing tests
  • Remove redundant ones
  • Add a new section on how to manually serialize/flush metrics
  • Cut a new patch release
  • Tom to review

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

heitorlessa and others added 13 commits April 21, 2020 14:34
* docs: add pypi badge

* fix: add missing single_metric example; test var name

* chore: pypi monthly download badge

* chore: fix github badge typo

* feat: add docs to CI

* fix: CI attempt 2

* fix: CI attempt 3

* fix: CI attempt 3

* fix: CI attempt 4

* chore: clean up CI workflows

* Decorator factory Feat: Create your own middleware (#17)

* feat(utils): add decorator factory

* improv: use partial to reduce complexity

* improv: add error handling

* chore: type hint

* docs: include pypi downloads badge

* feat: opt in to trace each middleware that runs

* improv: add initial util tests

* improv: test explicit and implicit trace_execution

* improv: test decorator with params

* chore: linting

* docs: include utilities

* improv: correct tests, dec_factory only for func

* improv: make util name more explicit

* improv: doc trace_execution, fix casting

* docs: add limitations, improve syntax

* docs: use new docs syntax

* fix: remove middleware decorator from libs

* feat: build docs in CI

* chore: linting

* fix: CI python-version type

* chore: remove docs CI

* chore: kick CI

* chore: include build badge master branch

* chore: refactor naming

* fix: rearrange tracing tests

* improv(tracer): toggle default auto patching

* feat(tracer): retrieve registered class instance

* fix(Makefile):  make cov target more explicit

* improv(Register): support multiple classes reg.

* improv(Register): inject class methods correctly

* docs: add how to reutilize Tracer

* improv(tracer): test auto patch method

* improv: address nicolas feedback

* improv: update example to reflect middleware feat

* fix: metric dimension in root blob

* chore: version bump

Co-authored-by: heitorlessa <lessa@amazon.co.uk>

Co-authored-by: heitorlessa <lessa@amazon.co.uk>
* develop: (21 commits)
  bugfix: #32 Runtime Error for nested sync fns
  chore: renamed history to changelog dependabot
  bugfix: resolves #31 aiohttp lazy import
  chore: grammar issues
  improv: add project tenets
  Improv tracer - async support, patch, test coverage and X-Ray escape hatch (#29)
  Bugfix: "per second" metric units (#27)
  fix: #24 correct example test and docs
  chore: bump example to use 0.8.0 features
  Adopt logging best practices (#23)
  Decorator factory Feat: Create your own middleware (#17)
  chore: clean up CI workflows
  fix: CI attempt 4
  fix: CI attempt 3
  fix: CI attempt 3
  fix: CI attempt 2
  feat: add docs to CI
  chore: fix github badge typo
  chore: pypi monthly download badge
  fix: add missing single_metric example; test var name
  ...
* develop:
  chore: bump to release candidate
* develop:
  feat: add documentation website (#37)
  improv: move away from monorepo due to change in direction (#36)
  fix: #35 duplicate changelog to project root
* develop:
  docs: clean up readme in favour of docs website
  docs: add install in main docs website
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
* develop:
  Docs: fix minor UX issues (#42)
  feat: add algolia search for docs and api ref (#39)
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>

#43
@heitorlessa heitorlessa added the bug Something isn't working label May 29, 2020
@heitorlessa heitorlessa self-assigned this May 29, 2020
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
@heitorlessa heitorlessa merged commit afe74e5 into develop May 29, 2020
@heitorlessa heitorlessa deleted the fix/metrics-flush branch May 29, 2020 16:57
heitorlessa added a commit that referenced this pull request May 29, 2020
* develop:
  fix: metrics not being flushed on every invocation (#45)
@heitorlessa heitorlessa changed the title WIP: Fix metrics not being flushed on every invocation fix: metrics not being flushed on every invocation Jun 3, 2020
heitorlessa referenced this pull request in heitorlessa/aws-lambda-powertools-python Jun 17, 2020
* [Sync Master] 0.7.0 release (#22)

* docs: add pypi badge

* fix: add missing single_metric example; test var name

* chore: pypi monthly download badge

* chore: fix github badge typo

* feat: add docs to CI

* fix: CI attempt 2

* fix: CI attempt 3

* fix: CI attempt 3

* fix: CI attempt 4

* chore: clean up CI workflows

* Decorator factory Feat: Create your own middleware (#17)

* feat(utils): add decorator factory

* improv: use partial to reduce complexity

* improv: add error handling

* chore: type hint

* docs: include pypi downloads badge

* feat: opt in to trace each middleware that runs

* improv: add initial util tests

* improv: test explicit and implicit trace_execution

* improv: test decorator with params

* chore: linting

* docs: include utilities

* improv: correct tests, dec_factory only for func

* improv: make util name more explicit

* improv: doc trace_execution, fix casting

* docs: add limitations, improve syntax

* docs: use new docs syntax

* fix: remove middleware decorator from libs

* feat: build docs in CI

* chore: linting

* fix: CI python-version type

* chore: remove docs CI

* chore: kick CI

* chore: include build badge master branch

* chore: refactor naming

* fix: rearrange tracing tests

* improv(tracer): toggle default auto patching

* feat(tracer): retrieve registered class instance

* fix(Makefile):  make cov target more explicit

* improv(Register): support multiple classes reg.

* improv(Register): inject class methods correctly

* docs: add how to reutilize Tracer

* improv(tracer): test auto patch method

* improv: address nicolas feedback

* improv: update example to reflect middleware feat

* fix: metric dimension in root blob

* chore: version bump

Co-authored-by: heitorlessa <lessa@amazon.co.uk>

Co-authored-by: heitorlessa <lessa@amazon.co.uk>

* feat: add algolia search for docs and api ref (#39) (#40)

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

* fix: revert makefile build-docs-api

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

* fix: metric_set reuse #43

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

* fix: clear metrics

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

* fix: update serialize_metrics helper function to use MetricManager instead of Metrics

* fix: clear metrics after lambda invocation #43

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

* improv: document metrics tests, remove redundants

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

#43

* chore: linting

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

* docs: add section to flush metrics manually

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

* docs: include EMF Json object

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

* chore: bump version 0.9.4

Signed-off-by: heitorlessa <lessa@amazon.co.uk>

Co-authored-by: Tom McCarthy <thommcc@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant