Giter VIP home page Giter VIP logo

Comments (2)

unflxw avatar unflxw commented on June 18, 2024 1

Hi @pdany1116! For the use case where you're adding single primitive values one at a time, you might find the tags more useful, as they do work cumulatively:

Appsignal.tag_request(:user_id => 42)
Appsignal.tag_request(:is_admin => false)

Generally, we try not to make too many assumptions about what the structure of the user-provided custom data is. But since calling set_sample_data more than once is fine, you can implement this yourself as a monkey-patch on the Appsignal::Transaction class:

class Appsignal::Transaction
  def add_custom_data(key, value)
    @custom_data ||= {}
    @custom_data[key] = value
    set_sample_data('custom_data', @custom_data)
  end
end

Appsignal::Transaction.current.add_custom_data(:current_context, {:user_id => 42})
Appsignal::Transaction.current.add_custom_data(:params, input)

I hope this helps! I'm closing this issue, but do feel free to re-open (or reach out at [email protected]) is this does not work for you.

from appsignal-ruby.

pdany1116 avatar pdany1116 commented on June 18, 2024

Thanks @unflxw for the answer! Tags are great, I already use them for some additional info. The monkey-patch should do the trick, thank you!

from appsignal-ruby.

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.