Skip to content

First PR - Implements the Opentracing API #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 89 commits into from
May 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
c0a0b6d
init struct
Apr 25, 2017
8c242ad
init struct with files :'(
Apr 25, 2017
fdd653d
java 1.8
Apr 25, 2017
c9c53c9
adding first tests
Apr 25, 2017
7ee51d0
implementing a first version of span
Apr 25, 2017
580a0d2
filling the SpanContext Pojo
Apr 26, 2017
7f0a2d6
filling the Span Pojo
Apr 26, 2017
a8535a0
sync w/ @renaud.boutet
Apr 26, 2017
af244a0
delete the notion of parentContext for the span
Apr 26, 2017
1a981bb
Added writer, serialisation, API + changed some types
Apr 26, 2017
c769fa6
pre merge
Apr 26, 2017
69ea857
Merge remote-tracking branch 'origin/dev' into dev
Apr 26, 2017
299cc57
And, ... Voilà
Apr 26, 2017
8b66116
chaining props and context
Apr 26, 2017
df1c528
firsts integration
Apr 26, 2017
0399cb0
Serialization of spans
Apr 26, 2017
638f303
Resolved conflicts
Apr 26, 2017
1955dcd
trying to fix inherits
Apr 26, 2017
ee9f912
Merge remote-tracking branch 'origin/dev' into dev
Apr 26, 2017
c9abfa6
fixing merge, todo: fix nano test
Apr 26, 2017
4dd11b5
fix issue w/ endTime and duration
Apr 26, 2017
7e38848
Changed id generations + fixed serialization
Apr 26, 2017
dae7e56
Resolved conflicts
Apr 26, 2017
588cfef
fixing minor issues
Apr 26, 2017
52626f9
adding unsupported exceptions
Apr 26, 2017
09c0cbb
API implem
Apr 26, 2017
ef6dccc
Resolved conflicts
Apr 26, 2017
445e9da
adding a logger conf
Apr 26, 2017
352e10e
remove useless api method
Apr 26, 2017
81656a2
Fixed serialization and send to DDagent
Apr 26, 2017
a3b1d24
Conflicts resolution
Apr 26, 2017
7e7700f
adding a list of traces to rebuild the entire trace for DD
Apr 26, 2017
bc8395d
end of day, enjoy the night
Apr 26, 2017
0663d34
First version of the writer working with the Agent API
Apr 26, 2017
5c089cf
Merge branch 'dev' of github.com:DataDog/raclette-java into dev
Apr 26, 2017
99977a0
Small fixes
Apr 26, 2017
1852489
ignoring logs
Apr 27, 2017
1137854
logging in json
Apr 27, 2017
1626562
adding ability to report all span in the trace
Apr 27, 2017
d364d10
Merge remote-tracking branch 'origin/dev' into dev
Apr 27, 2017
b6632ee
fixing some issue after the merge
Apr 27, 2017
cf5f254
Rename DDTracer, DDSpanBuilder + Remove Arraylist externally
Apr 27, 2017
3481439
Logging + comments
Apr 27, 2017
fd840ab
toString, hashcode, equals
Apr 27, 2017
a6bcea9
cleaning and moving all att to the context
Apr 27, 2017
5846f45
Merge remote-tracking branch 'origin/dev' into dev
Apr 27, 2017
f76da5d
consoliding the merge
Apr 27, 2017
b36a0f5
Test Writer
Apr 27, 2017
2273454
fixing nano
Apr 27, 2017
628f2eb
Logging Writter + AllSampler + Tracer empty constructor
Apr 27, 2017
a30b13f
Fixed conflicts
Apr 27, 2017
412cf7e
adding the rateSampler
Apr 27, 2017
49d7771
adding tests
Apr 27, 2017
403e340
fixing conflicts
Apr 27, 2017
6ef772b
changing List<Span> for List<DDSpan>
Apr 27, 2017
df4e0eb
adding some tests
Apr 27, 2017
6af3f61
Serializer test
Apr 27, 2017
abdbfff
Conflicts merging
Apr 27, 2017
bebf815
simplifying the test
Apr 27, 2017
02e7ed0
serializer test
Apr 27, 2017
e165cd0
cleaning code for the PR
Apr 28, 2017
9a95af8
Merge branch 'dev' of github.com:DataDog/raclette-java into dev
Apr 28, 2017
f979522
serializer test
Apr 28, 2017
97f7ed4
fixed time measures + some comments
Apr 28, 2017
ad8ad68
Consolidation of the PR
Apr 28, 2017
538f708
One more test
Apr 28, 2017
944b29d
Removing useless files
May 2, 2017
c6391ea
standard gitignore
May 2, 2017
3b8517e
adding mockito to the test scope
May 2, 2017
8409dad
Removing SpanSerializer interface
May 2, 2017
a38ee29
Renaming a props
May 2, 2017
edf3b75
Fixing log and Json reviews
May 2, 2017
a53987a
Refactoring protected fields to private ones
May 2, 2017
de30f5b
[PR #1] Removing the main
May 2, 2017
9e2a9fd
[PR #1] Removing the equals and hashcode methods
May 2, 2017
5e43447
[PR #1] Removing the equals and hashcode methods
May 2, 2017
1698b6c
[PR #1] Always use code-blocks
May 2, 2017
8cfb275
[PR #1] Using TimeUnit for a more expressive way
May 2, 2017
1508804
[PR #1] make fields private
May 2, 2017
dec780b
[PR #1] improving logging
May 2, 2017
3fa20e3
[PR #1] improving logging
May 2, 2017
c9ea5c0
[PR #1] making fields private
May 2, 2017
9e9e525
[PR #1] Refactoring Thread > Executor
May 2, 2017
772e969
[PR #1] making fields private
May 2, 2017
6aa6ac3
[PR #1] making fields private
May 2, 2017
7031ff1
[PR #1] improving logging
May 2, 2017
4cc2b46
[PR #1] Interface should not use the impl instead of the interface
May 3, 2017
1d388dd
[PR #1] cleaning
May 3, 2017
61ca5fd
[PR #1] Migrating all things to the span context (and add setters, an…
May 3, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 32 additions & 154 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,156 +1,34 @@
# Maven #
#########
target

# Created by https://www.gitignore.io/api/java,maven,eclipse,intellij

### Eclipse ###

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
# Eclipse #
###########
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar

# End of https://www.gitignore.io/api/java,maven,eclipse,intellij
.settings
.project
.classpath

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

# Intellij Idea #
#################
/.idea
*.iml

# Visual Studio Code #
######################
.vscode

# Others #
##########
/logs/*
73 changes: 73 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.datadog</groupId>
<artifactId>raclette-java</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<version>0.21.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.8</version>
</dependency>

<!-- Logging dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.9</version>
</dependency>

<!-- Testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.7.22</version>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably in test scope.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>

</project>
19 changes: 19 additions & 0 deletions src/main/java/com/datadoghq/trace/Sampler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.datadoghq.trace;


import io.opentracing.Span;

/**
* Main interface to sample a collection of traces.
*/
public interface Sampler {

/**
* Sample a collection of traces based on the parent span
*
* @param span the parent span with its context
* @return true when the trace/spans has to be reported/written
*/
boolean sample(Span span);

}
23 changes: 23 additions & 0 deletions src/main/java/com/datadoghq/trace/Writer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.datadoghq.trace;

import java.util.List;

import io.opentracing.Span;

/**
* A writer is responsible to send collected spans to some place
*/
public interface Writer {

/**
* Write a trace represented by the entire list of all the finished spans
*
* @param trace the list of spans to write
*/
void write(List<Span> trace);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is order important? If not, this should probably be a Collection<Span>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No unfortunately we send List<List> (or list of traces if you prefer) to the writer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@renaudboutet not sure that the order is so important. We just have to send an array of span. A collection should be fine


/**
* Indicates to the writer that no future writing will come and it should terminates all connections and tasks
*/
void close();
}
16 changes: 16 additions & 0 deletions src/main/java/com/datadoghq/trace/impl/AllSampler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.datadoghq.trace.impl;

import com.datadoghq.trace.Sampler;
import io.opentracing.Span;

/**
* Sampler that always says yes...
*/
public class AllSampler implements Sampler {

@Override
public boolean sample(Span span) {
return true;
}

}
Loading