Giter Site home page Giter Site logo

Comments (3)

Zizzamia avatar Zizzamia commented on July 19, 2024

It's a good practice to have each metric with a unique name.

const domain = 'http://example.com/';

async function apiExample(url, metricName) {
  perfume.start(`api.${metricName}`);
  const response = await fetch(domain + url);
  perfume.end(`api.${metricName}`);
  return response.json();
}

const first = apiExample('movies.json', 'movies');
const second = apiExample('another.json'. 'another');

Let me know if this makes sense for you 😄, and thank you for the compliments.
Out of curiosity, can you share more on where do you use Perfume? Company name, use cases, city your team lives?

Grazie 🙏

from perfume.js.

petrbrzek avatar petrbrzek commented on July 19, 2024

Thanks. I understand this approach is better, but the example is rather simplified. We want to measure some user action where you start measuring in a file A and stop measuring in a file B and you can also do those actions in parallel. Eg. in our app, you can open a design or more design simultaneously and we are interested in "opening design" time. So what I think we are going do is to use Perfume inside of our custom Perf service where you can scope measures by some unique id, so measurement will not interfere with each other. Another approach would be to create a new instance of Perfume every time, but that seems odd to me.

Out of curiosity, can you share more on where do you use Perfume? Company name, use cases, city your team lives?

No problem, the company is called Avocode - it's a hand-off tool for designers and developers. We are based in Prague, Czech Republic. We wanted to start doing RUM as we have a lot of users from eastern countries and we are really not sure how well the app runs for them.

from perfume.js.

Zizzamia avatar Zizzamia commented on July 19, 2024

Amazing, if you want we can talk via google hangout next week 😄
Feel free to private DM me on https://twitter.com/Zizzamia

I will personally avoid creating a new instance for each metric but instead wrap an instance inside your custom Perf service. Do you guys use any framework in particular? I'm looking forward to documenting more different use cases.

from perfume.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.