awslabs / awslabs/aws-embedded-metrics-node

Public API for getting metrics that have been set

Open
#38 3 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue
Dominant language
TypeScript
Stars
263
Forks
39
PR merge metrics
No merged PRs in 30d

Description

I have a usecase where I want to get access to one or all the metrics that have been set with `putMetric` before sending a response back to the user. Specifically I'm planning on putting some of the metric values into [server timing headers](https://www.w3.org/TR/server-timing/) so that I can tie clientside behavior back to serverside metrics.

I'm found that while there is not a public `getMetric` method I **can** get access to previously set metrics by inspecting the data [here](https://github.com/awslabs/aws-embedded-metrics-node/blob/730bbaeb341ee3952a404c04fc1de59a6ec65cf5/src/logger/MetricsContext.ts#L37)

My question is whether this is an okay, somewhat stable method to use? Or if this is exclusively private/internal data that I should not be touching? If the latter, is there interest in adding formal `getMetric` or `getProperty` methods?

Contributor guide

Open the contributing guide

Research direction

Start with src/logger/MetricsContext.ts at the referenced data and trace how putMetric stores values. Determine the supported public contract for retrieving one or all previously set metrics before a response is sent, including the distinction between public and internal data; done means the API decision and expected retrieval behavior are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
api, observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.