Sha256: 9e9161904a7c81169111c6dc98eb6204a75014c0aa8abdc4ae4e69266301bdc4

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

### Installation

```ruby
gem 'gn-tracker'
```

### Configuration

```ruby
require "gn/tracker"

Gn::Tracker.configure do |config|
  config.application = "YourApp"
  config.path = "/var/www/example/shared/logstash"
end
```

### Unstruct Event

Just call `track_unstruct_event` method:

```ruby
require "gn/tracker"

tracker = Gn::Tracker.new
tracker.track_unstruct_event(message: { a: 1 }, schema: "iglu:br.com.example.com/schema/1.0.0")
```

The attributes `message` and `schema` are mandatory. If you want to send an event for a different application, you can specify an `application`:

```ruby
require "gn/tracker"

tracker = Gn::Tracker.new

tracker.track_unstruct_event(
  message: { a: 1 },
  schema: "iglu:br.com.example.com/schema/1.0.0",
  application: "Kituno"
)
```

You can pass the argument `true_timestamp` (in milliseconds):

```ruby
require "gn/tracker"

tracker = Gn::Tracker.new
tracker.track_unstruct_event(
  message: { a: 1 },
  schema: "iglu:br.com.example.com/schema/1.0.0",
  application: "Kituno",
  true_timestamp: "1509471096577"
)
```

and pass the argument `contexts` (array with aditional contexts):

```ruby
require "gn/tracker"

contexts = [
  {
    schema: "iglu:br.com.example.com/another_schema/1.0.0",
    message: { b: 2 }
  },

  {
    schema: "iglu:br.com.example.com/third_schema/1.0.0",
    message: { c: 3 }
  }
]

tracker = Gn::Tracker.new

tracker.track_unstruct_event(
  message: { a: 1 },
  schema: "iglu:br.com.example.com/schema/1.0.0",
  application: "Kituno",
  contexts: contexts
)
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gn-tracker-0.4.0 README.md