Giter Site home page Giter Site logo

Truncate keys about apm-nodejs-http-client HOT 9 CLOSED

elastic avatar elastic commented on June 20, 2024
Truncate keys

from apm-nodejs-http-client.

Comments (9)

alemagio avatar alemagio commented on June 20, 2024

Hi, i would like to work on this.
I think that i should work on the truncate.js file and use the onObject callback (where i have access to the key) instead of the onValue (which is the one truncating now).
Right?

from apm-nodejs-http-client.

Qard avatar Qard commented on June 20, 2024

It might be achievable with onObject. It could be a bit of a challenge though as it's a bit tough to wrap your brain around the nested filter stuff--you could very easily blow away your own changes or send it into an infinite loop and blow the stack. Feel free to ask questions here if you get stuck and I'll do what I can to help. 👍

from apm-nodejs-http-client.

alemagio avatar alemagio commented on June 20, 2024

Hi, i started looking for this and I'm not sure what the expectation is.
If I take as an expample the truncateSpan function you expect that, given an input span like this:
{
foo: "bar",
}
and an option that sets the max key length to 2 the output should be:
{
fo: "bar",
}
Correct?

from apm-nodejs-http-client.

Qard avatar Qard commented on June 20, 2024

Yes. Recursively, all keys should be shortened. One challenge that we never put much thought into how to handle is what to do about collisions. For example, shortening a1 and a2 to key length 1 would result in two different values for a--which one should it finally be? I'm not really sure. 🤔

from apm-nodejs-http-client.

watson avatar watson commented on June 20, 2024

I would consider just truncating the keys that are controlled by the user. Might be easier on the CPU

from apm-nodejs-http-client.

alemagio avatar alemagio commented on June 20, 2024

Ok, but the issue regarding the collisions remains right?

from apm-nodejs-http-client.

Qard avatar Qard commented on June 20, 2024

Yes, collisions are still possible.

from apm-nodejs-http-client.

alemagio avatar alemagio commented on June 20, 2024

Just created a PR
It is not complete yet but i think it could be useful to make me understand if i'm on the right way
Let me know ;)

from apm-nodejs-http-client.

Qard avatar Qard commented on June 20, 2024

Closed by #92.

from apm-nodejs-http-client.

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.