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

Docs: extract Metrics code snippets in separate files #1221

Closed
1 task done
dreamorosi opened this issue Jan 10, 2023 · 3 comments · Fixed by #1245
Closed
1 task done

Docs: extract Metrics code snippets in separate files #1221

dreamorosi opened this issue Jan 10, 2023 · 3 comments · Fixed by #1245
Assignees
Labels
completed This item is complete and has been merged/shipped documentation Improvements or additions to documentation

Comments

@dreamorosi
Copy link
Contributor

dreamorosi commented Jan 10, 2023

What were you searching in the docs?

Currently the code snippets in the documentation under the Metrics's section are hardcoded as part of the page's markdown.

This authoring experience, which doesn't provide linting, is error prone, which causes issues in the docs and in turns to users.

This issue is part of a larger effort being tracked at #729.

Is this related to an existing documentation section?

https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/metrics/

How can we improve?

The code snippets should be extracted to their own separate files, placed under docs/snippets/metrics.

So for instance, the first snippet that currently reads:

import { Metrics } from '@aws-lambda-powertools/metrics';

const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName: 'orders' });

export const handler = async (_event, _context): Promise<void> => {
    // ...
};

would be replaced with:

--8<-- "docs/snippets/metrics/basicUsage.ts"

And the content should be placed in its own file at the path: docs/snippets/metrics/basicUsage.ts.

This applies to all TypeScript code snippets of the page.

Got a suggestion in mind?

No response

Acknowledgment

  • I understand the final update might be different from my proposed suggestion, or refused.
@dreamorosi dreamorosi added documentation Improvements or additions to documentation triage This item has not been triaged by a maintainer, please wait help-wanted We would really appreciate some support from community for this one confirmed The scope is clear, ready for implementation and removed triage This item has not been triaged by a maintainer, please wait labels Jan 10, 2023
@dreamorosi
Copy link
Contributor Author

Names for the files (in order of appearance in this file), if I have forgotten any of them let me know:

  1. basicUsage.ts
  2. sam.ts
  3. createMetrics.ts
  4. customDimensions.ts
  5. multiValueMetrics.ts
  6. defaultDimensions.ts
  7. defaultDimensionsMiddy.ts
  8. setDefaultDimensions.ts
  9. defaultDimensionsDecorator.ts
  10. middy.ts
  11. decorator.ts
  12. manual.ts
  13. throwOnEmptyMetrics.ts
  14. captureColdStartMetricMiddy.ts
  15. captureColdStartMetricDecorator.ts
  16. addMetadata.ts
  17. singleMetricDifferentDimsMiddy.ts
  18. singleMetricDifferentDimsDecorator.ts

@niko-achilles
Copy link
Contributor

@dreamorosi checked the quantity of code snippets and identified the same number of 18. The names you proposed have the corresponding meaning as described in the metrics-docs.

I can start today evening with this issue .

@dreamorosi dreamorosi moved this from Backlog to Working on it in AWS Lambda Powertools for TypeScript Jan 13, 2023
niko-achilles added a commit to niko-achilles/aws-lambda-powertools-typescript that referenced this issue Jan 13, 2023
@dreamorosi dreamorosi linked a pull request Jan 14, 2023 that will close this issue
13 tasks
niko-achilles added a commit to niko-achilles/aws-lambda-powertools-typescript that referenced this issue Jan 17, 2023
dreamorosi pushed a commit that referenced this issue Jan 17, 2023
* docs(metrics): extract Metrics code snippets in separate files #1221

* fix(docs): hl_lines of multiValueMetrics code snippet
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in AWS Lambda Powertools for TypeScript Jan 17, 2023
@github-actions
Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added the pending-release This item has been merged and will be released soon label Jan 17, 2023
@dreamorosi dreamorosi moved this from Coming soon to Shipped in AWS Lambda Powertools for TypeScript Feb 27, 2023
@dreamorosi dreamorosi added completed This item is complete and has been merged/shipped and removed help-wanted We would really appreciate some support from community for this one pending-release This item has been merged and will be released soon confirmed The scope is clear, ready for implementation labels Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed This item is complete and has been merged/shipped documentation Improvements or additions to documentation
Projects
None yet
2 participants