awslabs / awslabs/aws-embedded-metrics-node

Facilitate subclassing of MetricsLogger

Open
#148 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
263
Forks
39
PR merge metrics
No merged PRs in 30d

Description

### Context

Our team wants to subclass `MetricsLogger` to track which metrics properties are being set. However, we are facing two issues that are preventing us from doing so:
1. The `context` property is private. This requires us to manually track the properties that have been set through `setProperty`.
2. `MetricsLogger`'s constructor requires parameters whose types are defined in internal modules, which makes it difficult to define a constructor of our own in the subclass.

### Ask

Our request is to make `MetricsLogger` more amenable to subclassing. Specifically, we would like to
1. Make `MetricsLogger.context` a protected property
2. Export `resolveEnvironment` and `MetricsContext` in the `index.js` as part of `aws-embedded-metrics-node`'s public API.

I am happy to submit a PR if our request is approved.

Contributor guide

Open the contributing guide

Research direction

Start at the package's index.js and locate the MetricsLogger implementation and its context property. Check how resolveEnvironment and MetricsContext are currently defined and consumed, then verify that subclass construction and access to context work through the public API. Done means the requested symbols and subclassing support are exposed without breaking existing usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
observability-sre
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.