Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mscwilson committed Sep 7, 2022
2 parents 04fd0ba + 4cbf9e8 commit b2c85c2
Show file tree
Hide file tree
Showing 44 changed files with 2,600 additions and 885 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Admin

on:
create:
pull_request:
types:
- opened
branches:
- 'release/**'
push:
branches:
- "release/**"

jobs:
update-labels:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Update issue status labels
uses: snowplow-incubator/labels-helper-action@v1
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}

link-pr-issue:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Match the issue to the PR
uses: snowplow-incubator/pull-request-helper-action@v1
env:
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
Java 1.0.0 (2022-09-06)
-----------------------
Add close() to Emitter interface and Tracker (#357)
Deprecate Builder classes (#355)
Reduce the default maximum event buffer capacity (#352)
Add admin workflow for automatic issue labelling (#346)
Remove SimpleEmitter (#341)
Add a Snowplow interface with the ability to initialize and manage multiple trackers (#340)
Restore Emitter callbacks for success and failure (#339)
Add a maximum wait time and jitter to event sending retry (#338)
Set default HTTP status codes not to retry on (#337)
Add support for storing cookies in OkHttpClientAdapter (#336)
Remove Guava dependency (#320)
Standardise API for Tracker and Subject Builders (#302)
Rename Unstructured events to SelfDescribing (#296)

Java 0.12.2 (2022-06-17)
-----------------------
Bump jackson-databind to 2.13.3 (#333)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Java Analytics for Snowplow

[![early-release]][tracker-classification] [![Build][github-image]][github] [![Release][release-image]][releases] [![License][license-image]][license]
[![maintained]][tracker-classification] [![Build][github-image]][github] [![Release][release-image]][releases] [![License][license-image]][license]

## Overview

Expand Down Expand Up @@ -88,4 +88,4 @@ limitations under the License.
[apidocs]: https://snowplow.github.io/snowplow-java-tracker/index.html?overview-summary.html

[tracker-classification]: https://docs.snowplowanalytics.com/docs/collecting-data/collecting-from-own-applications/tracker-maintenance-classification/
[early-release]: https://img.shields.io/static/v1?style=flat&label=Snowplow&message=Early%20Release&color=014477&labelColor=9ba0aa&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAeFBMVEVMaXGXANeYANeXANZbAJmXANeUANSQAM+XANeMAMpaAJhZAJeZANiXANaXANaOAM2WANVnAKWXANZ9ALtmAKVaAJmXANZaAJlXAJZdAJxaAJlZAJdbAJlbAJmQAM+UANKZANhhAJ+EAL+BAL9oAKZnAKVjAKF1ALNBd8J1AAAAKHRSTlMAa1hWXyteBTQJIEwRgUh2JjJon21wcBgNfmc+JlOBQjwezWF2l5dXzkW3/wAAAHpJREFUeNokhQOCA1EAxTL85hi7dXv/E5YPCYBq5DeN4pcqV1XbtW/xTVMIMAZE0cBHEaZhBmIQwCFofeprPUHqjmD/+7peztd62dWQRkvrQayXkn01f/gWp2CrxfjY7rcZ5V7DEMDQgmEozFpZqLUYDsNwOqbnMLwPAJEwCopZxKttAAAAAElFTkSuQmCC
[maintained]: https://img.shields.io/static/v1?style=flat&label=Snowplow&message=Maintained&color=9e62dd&labelColor=9ba0aa&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAeFBMVEVMaXGXANeYANeXANZbAJmXANeUANSQAM+XANeMAMpaAJhZAJeZANiXANaXANaOAM2WANVnAKWXANZ9ALtmAKVaAJmXANZaAJlXAJZdAJxaAJlZAJdbAJlbAJmQAM+UANKZANhhAJ+EAL+BAL9oAKZnAKVjAKF1ALNBd8J1AAAAKHRSTlMAa1hWXyteBTQJIEwRgUh2JjJon21wcBgNfmc+JlOBQjwezWF2l5dXzkW3/wAAAHpJREFUeNokhQOCA1EAxTL85hi7dXv/E5YPCYBq5DeN4pcqV1XbtW/xTVMIMAZE0cBHEaZhBmIQwCFofeprPUHqjmD/+7peztd62dWQRkvrQayXkn01f/gWp2CrxfjY7rcZ5V7DEMDQgmEozFpZqLUYDsNwOqbnMLwPAJEwCopZxKttAAAAAElFTkSuQmCC
5 changes: 1 addition & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ wrapper.gradleVersion = '6.5.0'

group = 'com.snowplowanalytics'
archivesBaseName = 'snowplow-java-tracker'
version = '0.12.2'
version = '1.0.0'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'

Expand Down Expand Up @@ -75,9 +75,6 @@ dependencies {
// Jackson JSON processor
api 'com.fasterxml.jackson.core:jackson-databind:2.13.3'

// Preconditions
api 'com.google.guava:guava:31.1-jre'

// Testing libraries
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testCompileOnly 'junit:junit:4.13.2'
Expand Down
4 changes: 2 additions & 2 deletions examples/simple-console/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ test {
}

dependencies {
implementation 'com.snowplowanalytics:snowplow-java-tracker:0.+'
implementation 'com.snowplowanalytics:snowplow-java-tracker:1.+'

implementation ('com.snowplowanalytics:snowplow-java-tracker:0.+') {
implementation ('com.snowplowanalytics:snowplow-java-tracker:1.+') {
capabilities {
requireCapability 'com.snowplowanalytics:snowplow-java-tracker-okhttp-support'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@

package com.snowplowanalytics;

import com.snowplowanalytics.snowplow.tracker.DevicePlatform;
import com.snowplowanalytics.snowplow.tracker.Snowplow;
import com.snowplowanalytics.snowplow.tracker.Subject;
import com.snowplowanalytics.snowplow.tracker.Tracker;
import com.snowplowanalytics.snowplow.tracker.emitter.BatchEmitter;
import com.snowplowanalytics.snowplow.tracker.configuration.EmitterConfiguration;
import com.snowplowanalytics.snowplow.tracker.configuration.NetworkConfiguration;
import com.snowplowanalytics.snowplow.tracker.configuration.TrackerConfiguration;
import com.snowplowanalytics.snowplow.tracker.events.*;
import com.snowplowanalytics.snowplow.tracker.payload.SelfDescribingJson;

import java.util.List;
import java.util.Collections;
import static java.util.Collections.singletonList;
import java.util.List;

import com.google.common.collect.ImmutableMap;

public class Main {

Expand All @@ -42,17 +44,13 @@ public static void main(String[] args) throws InterruptedException {
// the namespace to attach to events
String namespace = "demo";

// build an emitter, this is used by the tracker to batch and schedule transmission of events
BatchEmitter emitter = BatchEmitter.builder()
.url(collectorEndpoint)
.batchSize(4) // send batches of 4 events. In production this number should be higher, depending on the size/event volume
.build();
// The easiest way to build a tracker is with configuration classes
TrackerConfiguration trackerConfig = new TrackerConfiguration(namespace, appId);
NetworkConfiguration networkConfig = new NetworkConfiguration(collectorEndpoint);
EmitterConfiguration emitterConfig = new EmitterConfiguration().batchSize(4); // send batches of 4 events. In production this number should be higher, depending on the size/event volume

// now we have the emitter, we need a tracker to turn our events into something a Snowplow collector can understand
final Tracker tracker = new Tracker.TrackerBuilder(emitter, namespace, appId)
.base64(true)
.platform(DevicePlatform.ServerSideApp)
.build();
// We need a tracker to turn our events into something a Snowplow collector can understand
final Tracker tracker = Snowplow.createTracker(trackerConfig, networkConfig, emitterConfig);

System.out.println("Sending events to " + collectorEndpoint);
System.out.println("Using tracker version " + tracker.getTrackerVersion());
Expand All @@ -61,10 +59,10 @@ public static void main(String[] args) throws InterruptedException {
List<SelfDescribingJson> context = singletonList(
new SelfDescribingJson(
"iglu:com.snowplowanalytics.iglu/anything-c/jsonschema/1-0-0",
ImmutableMap.of("foo", "bar")));
Collections.singletonMap("foo", "bar")));

// This is an example of a eventSubject for adding user data
Subject eventSubject = new Subject.SubjectBuilder().build();
Subject eventSubject = new Subject();
eventSubject.setUserId("[email protected]");
eventSubject.setLanguage("EN");

Expand All @@ -78,6 +76,7 @@ public static void main(String[] args) throws InterruptedException {
.subject(eventSubject)
.build();

// EcommerceTransactions will be deprecated soon: we advise using SelfDescribing events instead
// EcommerceTransactionItems are tracked as part of an EcommerceTransaction event
// They are processed into separate events during the `track()` call
EcommerceTransactionItem item = EcommerceTransactionItem.builder()
Expand Down Expand Up @@ -107,27 +106,25 @@ public static void main(String[] args) throws InterruptedException {
.build();


// This is an example of a custom "Unstructured" event based on a schema
// Unstructured events are also called "self-describing" events
// because of their SelfDescribingJson base
Unstructured unstructured = Unstructured.builder()
// This is an example of a custom SelfDescribing event based on a schema
SelfDescribing selfDescribing = SelfDescribing.builder()
.eventData(new SelfDescribingJson(
"iglu:com.snowplowanalytics.iglu/anything-a/jsonschema/1-0-0",
ImmutableMap.of("foo", "bar")
Collections.singletonMap("foo", "bar")
))
.customContext(context)
.build();


// This is an example of a ScreenView event which will be translated into an Unstructured event
// This is an example of a ScreenView event which will be translated into a SelfDescribing event
ScreenView screenView = ScreenView.builder()
.name("name")
.id("id")
.customContext(context)
.build();


// This is an example of a Timing event which will be translated into an Unstructured event
// This is an example of a Timing event which will be translated into a SelfDescribing event
Timing timing = Timing.builder()
.category("category")
.label("label")
Expand All @@ -148,13 +145,13 @@ public static void main(String[] args) throws InterruptedException {

tracker.track(pageViewEvent); // the .track method schedules the event for delivery to Snowplow
tracker.track(ecommerceTransaction); // This will track two events
tracker.track(unstructured);
tracker.track(selfDescribing);
tracker.track(screenView);
tracker.track(timing);
tracker.track(structured);

// Will close all threads and force send remaining events
emitter.close();
tracker.close();
Thread.sleep(5000);

System.out.println("Tracked 7 events");
Expand Down
Loading

0 comments on commit b2c85c2

Please sign in to comment.