question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve metrics to be more analytics friendly

See original GitHub issue

@oscarotero and team, I have these suggestions for improving metrics:

  1. Increase granularity
  2. Allow “baggage” (in open telemetry terms) to be contributed by pages

Increasing granularity. Right now we have the following in metrics.json where the “name” has event details that need to parsed in order to be consumable for analytics:

{
    "name": "Load: /support/generate-static-build.sh",
    "entryType": "measure",
    "startTime": 1009.5581999999999,
    "duration": 0.1815000000000282,
    "detail": null
  }

Instead, I suggest something like this:

{
    "name": "Load: /home", // human-friendly, not useful for analytics
    "nature": { category: "load" }, // analytics-friendly, nature can be like a URL with depth /load/X, /preprocess, /render/Z, etc. and can be merged with metrics contributed by pages being rendered
    "target": { url: "/page/url", ...anything else we know about target... }, // analytics-friendly
    "entryType": "measure", // "measure" is the only entry I see here -- is there anything else?
    "startTime": 1007.8624, // analytics-friendly, 
    "duration": 2187.5929, // suggest removing "duration" and only including analytics-friendly "endTime"
    "detail": null // suggest renaming to "baggage" using OpenTelemetry terminology; and allow this to be contributed/merged from generated pages (through filter.metrics({ nature: {  }, baggage: {... anything ...}})
}

Allow metrics “contribution” by pages. Many of my pages run database calls or other expensive calls and I’d like to add my own metrics for those expensive items.

export default async function ( // for Lume
  page: lumeAide.RenderablePage,
  filters: lumeAide.Filters,
) {
  // do something expensive
  filter.metrics({ nature: {  }, baggage: {... anything ...}}); // I can call my own metrics?
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
oscaroterocommented, Oct 8, 2021

I think this is already implemented, so I’m closing it.

1reaction
oscaroterocommented, Jul 10, 2021

What you’re proposing is that, instead of returning a function, returns an Instrument object with a measure function? I mean:

// This is your proposal (the not type-safe option)
const observe = this.metrics.typicalInstrument("Copy (all files)");
for (const [from, to] of this.source.staticFiles) {
  await this.#copyStatic(from, to);
}
observe.measure();


// And this is my proposal
const end = this.metrics.start("Copy (all files)");
for (const [from, to] of this.source.staticFiles) {
  await this.#copyStatic(from, to);
}
end();

I see both are almost the same, but maybe I’m missing something. Maybe you’re planning to expand the observe object with more functionalities?

My idea to make this extensible is that you could create your own class extending Metrics:

class DbMetrics extends Metrics {
    measureDatabase() {
        return this.start("Database");
    }
}

I guess what you’re proposing is creating an interface that you can use without extending the base class, right?

class MyMetrics implements InstumentationSupplier {

Anyway, I’ll release a new version in next days, but if you want to test it right now, just run lume upgrade --dev and this will install the last commit version.

btw, feel free to create a pull request if you want to work on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Metrics to Improve Customer Experience Analytics | CDW
4 Metrics to Improve Customer Experience Analytics · Market Efficacy · Logistics · Customer Sentiment · Omnichannel Pathways.
Read more >
How to Use Google Analytics Data to Improve Your Website
You can boost your engagement rate by doing the following: Create easy-to-read content that users can scan and understand quickly.
Read more >
How Can Data Analytics Improve the Measurement of ...
At the end of this post, you'll realize how much better it is to shoot for objective metrics and people analytics than to...
Read more >
HR Must Make People Analytics More User-Friendly
On the “push” side, HR leaders can do a better job of presenting human capital metrics to the rest of the organization using...
Read more >
KPIs vs. Metrics: 5 ways data analytics can help monitor ...
Metrics drive improvements and help businesses focus their people and resources on what counts. Data analytics can help establish KPIs and metrics related...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found