diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..54c66ad --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Build / maven artifacts +*.class +target/ +pom.xml.versionsBackup + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.war +*.ear + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# IntelliJ project files +.idea/ +*.iml + +# Eclipse +.project +.classpath +.settings + diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..c6feb8b Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..56bb016 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip \ No newline at end of file diff --git a/.settings.xml b/.settings.xml new file mode 100644 index 0000000..f51fb0c --- /dev/null +++ b/.settings.xml @@ -0,0 +1,43 @@ + + + + + + sonatype + ${env.SONATYPE_USER} + ${env.SONATYPE_PASSWORD} + + + bintray + ${env.BINTRAY_USER} + ${env.BINTRAY_KEY} + + + jfrog-snapshots + ${env.BINTRAY_USER} + ${env.BINTRAY_KEY} + + + github.com + ${env.GH_USER} + ${env.GH_TOKEN} + + + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0e52fd7 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,43 @@ +sudo: required +dist: trusty + +language: java +jdk: +- oraclejdk8 + +cache: + directories: + - $HOME/.m2/repository + +before_install: + # allocate commits to CI, not the owner of the deploy key + - git config user.name "opentracingci" + - git config user.email "opentracingci+opentracing@googlegroups.com" + + # setup https authentication credentials, used by ./mvnw release:prepare + - git config credential.helper "store --file=.git/credentials" + - echo "https://$GH_TOKEN:@github.com" > .git/credentials + +install: + # Override default travis to use the maven wrapper + - ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -B -V + +script: + - ./travis/publish.sh + +branches: + except: + - /^[0-9]/ + +env: + global: + # Ex. travis encrypt -r org/repo GH_TOKEN=XXX-https://github.com/settings/tokens-XXX + - secure: "Ou7BCMOXuitko2VkLRHSh56ucuRF7pv7HQot9pwySp8rLYneME4yqcVEVv/1+eu/LSGkQJ+eO3EL8hFPn3Nk6VRfdGCtz/3UFyzJqTZOZdg2Aw7RibiDb81jPvdD9XOhQx2qQYwoxWbeKgkGJsbHbq7j39b0t61X+hp7BmW0e94O7y8velCTskT7JRxBvJiy/DnEQ+GCHGN0nzEhclyGthvz8mll2lwZ3tRd+EblERLgQNvhUa4r+r4lgvmtgly4UibMVe6fyZLyvK5SHoeUFHn+aSFXNl7a6czxCf5Ed1n6bYpHYcBH/7jbS02BdYCZNgKlEVJ5XeJOExQmxk20HaFnV++H0h7u/wuYIOJEOdh2ZyvXJs9JjgLKhSJpocNyeoAWBw+Dhr8szr/8BQUSaO6WeR5jzQyvXF7JA4veLShrjwK81F7Wg+OaPlU6v8MX4pG3ktsEbFRCVV1cVU5FceJepufA3QcBI7yw0w/UOiiftdEIo91hYbAHdq9ZSJZehF76zEJbqV/jCivIWPkUCEnq9NQ/v5RhSY8wmgQ+N1Oz9tbShfIRbC4BOpD7w8jWN9+hr1jrfLK4a62ayujEU3eP/Jnga/nGCEKkbNAGsQZogtn7s+fsiE2x66jNjlfbzjlPsg/o3g39kz+AtCSkQykfIyJM5Q4+jpUAglvwUgA=" + # Ex. travis encrypt -r org/repo SONATYPE_USER=your_sonatype_account + - secure: "n1NdUm2haaFukpR3188URxAcfUuo08gQFyzPdZ7RlmFlJldi77nxmv3sNprphgj2rP/kcpdSHEsnxZqgfB34jLvv3PKwsO+auLn8biXPZN6DjBAlkT3mkNIdSNvs9rub2/E5u8EmCSUe4oseHHVflfaTzESHabX1rhMRQAGuLQE2cfDZp5JXnEdAUmZl6RyGGXazQvY36dx+kfEQaJJWqS2bZC03cwkjh/k/pGVpplrirD4LuidF/q+v0YlCI1XMWZYiYrkU7Cphhs46tq4n+2cCKS6Ymmj1Ck7WOk9x17KfHO2/DnwqaxjBTqIqJm7m7ObK5Cng8W13XKlbYGfsePBui9mgW6iJK4ClFtFrNqeys187qMU2ejT09PXcUEeGU6JL0TBUKGEiWJTAYG8fF5K6gJTyDM3jJBZfaR+Sl13DkHHUn7qxFLVbCaLWDUeRjsLiq05ipDhqSX9j+jat647SY9kU8sXugGxC20045uvv5TregpFa1xm4izBK1gB4a0TuFCAkqQX8L6u+PplD4mACVhY8tUeOkmdcSwuGsguL7zOZnbXQWdTTHanoJn9BsdVd21oZkE/TwfYshjH7UfASGd595SU+PXSS6BFwCnoD42w+X8ljfSGzf80LWY1XmTCrEXf3bcOVx+mef76SQJT/bm+zZ0FJ5AToY+xihms=" + # Ex. travis encrypt -r org/repo SONATYPE_PASSWORD=your_sonatype_password + - secure: "haWMaoQ5Q43xCdSTj3o0r6urglrEU/Xj9cw6eV7DhMPBHFXt1mJqxYoVgObYf/s/agjwHghaZIekq/aTtPXZjMvW+FSHu2J9ktNhAMJ3u0ZBlUO/tUCpmTyIP+ODok3N6521oP0lJALqXYz93szyaEJAhaaVzs+lzgmeimEeJug/VMYq2wNaI4Ox7JfFjVQIYUNLNfHaHl38YR6UB/xdyonfvbKgTCt8MRobmNDVT9jg8dZmRYGUK8rXWV3bhdC1NoMoVawyqzxaC85hcjNAjdYMvgtFi2X0uikZ0AyFwo8pLAAOODGQFZU610wCMkA6F4Aco+gTLdRC1DSVIsbju2BWZ/fQxUVkAxcxJN6Bz8gBvtTE4D/t4Z9dTpMsjT4kSg7JA+sy9xnPbvvQ4N5Xw8ddc1YL1RDosxWkoLqoPfzppj5RB0H38LKO8Tav+FPWQYmsmRMAEyFE+Cvp8Djwd4YBjGK9bCdM89QgfQhuyb6tjyzmWtFyJviiHWMQUgHWf0wSu/hDwNhVAN14pxG7iyzF5L0qH8NTLXDVUttHCSJ0Qq0uZtaDBBoBxFyuYOdSnVyOTrsRTdOQ13+Xj/y0ufF+WcUUA4lKV+eTa2wxjAWwkZoXXTh0FjZfDidk4MfgM3XzHrqVNWOzsmV8B3Au+qKwZGNtj8v2hr5vWCwiAFU=" + # Ex. travis encrypt -r org/repo BINTRAY_USER=your_github_account + - secure: "yZiwZwwhElkgASVkIVLVLCJqtMM1bvx9XJGFDBKZjL0Zx87T2lqkiA6h6T0ZuX1pHQ12WzJDS92Uo91CvJ3UhEKRCCLZBxP3Xn+R9bTpTgEX7dcRfTZpeaxqpqgD8409rMfx5pH8A2R1sphB4H5trkxqifVA8panZed2ugu/2nT2babB1bg2AOGq8pJY7genOX2RP9dI6vKJSrMaVWxjwD7o0FUXSFdvDz6Ye9VlnqRl5lSVDEz0pT2LE95m96I+gPybdtOoys5kIRnwVlzgBlyKq/jm4YlHp/6TjTydY2V3L93oFTQ9Xnbc/P3eS24x/TSCHdX5vSd7DfZU23sZNXeALf+VWq8e4qXIwAsAcMPtK6gLZp33jVdTFMEw1ZhW1KCoGXQTndNN306e1enlLbutS779xNrBA058Wj3tAGU4jBBEreG5y4i/aFwTtmJYomRj0BDBmUXsPkiilDDlYKPQnjc7c/GNp7NQ5IAlmQgxJcuFMGO4vu/LRdtxXj6Uur3fd4Hfvr5kYRGogClKod9AOBWTpGebjI39y6PmPZmLb4XAsR9NGvFIBfo8TJLN58AKp3Ugie9zriWN1ebtkPhaZSCsVmQSgHMKWdaWJz7ZVXIXpuYsoWDu9Ir+w3+547KUk/ZkA1HSdGHt+fdlOJ6ic6c61fTDjCJCsHEjFoo=" + # Ex. travis encrypt -r org/repo BINTRAY_KEY=xxx-https://bintray.com/profile/edit-xxx + - secure: "oOLl7a3a0ofBLr4Rm1Y/+n5B49S8R4oBywIYZZiDUZj+aluZnOY70TuXeMgvSyl/7rlwkpIe+kOR13kNsJtPgLA2GY0+bfiE3XVqk9gdXSqGfPRoaTbyLCg/09xg9PDKGOQdHvBI8mHMVLmeiQuiQzLiuJh+pF/W12sYWT8C/HGPjF6exckPLus9o8DBjbeiCLGzpA5gXefplGGZS+7eegpLU3SoK9lYddjmS9cudqF7YDq33e0/t+eAe4YsCHoQoolyHFVjMRN0+fUDVvPvUVjVFhkmS/GC91bqR2FmJ6Lk8gyk09vk0da3D2rBYQXNzDTCUwCUBLPIPrxS68UfE2jXKV7FcPPzTFbgF+TNbC4JpBmZJIDEg6h8euOHRNaNJMqDoR+BkPKhkcvEnb/Trpita3QzxoH+L+kou3sMKmhcoaZ2eK0VaUnT7EXFm2duY2jHLwYIV/sqWCmc6Hjgz/Egt5FqAz214l05olOzzG8caxQl7yZWjUkqftxnSKlMwjcX9L6UW1aXR9rapm36bfKlfAj+QJkBzaXrQ7Qu3iTfI8I+T0QpJ0LsXWPuERTZqoJZ77QW+wP8yNMk28sHvsCgW9F9VfyY74gKYuQno+ApwrVoujgznU44/e1ByxH/xqXzlQbDOEDkzKyHLUkSlTgvC6fvqfm9reM8X5fS/3E=" diff --git a/README.md b/README.md index b5b847d..f6b3e1a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,13 @@ -# java-observer -Span life cycle observer API +[![Build Status][ci-img]][ci] [![Released Version][maven-img]][maven] + +# OpenTracing Observer + +This project provides an observer API for the OpenTracing Tracer. + +## Release +Follow instructions in [RELEASE](RELEASE.md) + + [ci-img]: https://travis-ci.org/opentracing-contrib/java-observer.svg?branch=master + [ci]: https://travis-ci.org/opentracing-contrib/java-observer + [maven-img]: https://img.shields.io/maven-central/v/io.opentracing.contrib/opentracing-observer.svg?maxAge=2592000 + [maven]: http://search.maven.org/#search%7Cga%7C1%7Copentracing-observer diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..1926582 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,7 @@ +# OpenTracing Release Process + +This repo uses semantic versions. Please keep this in mind when choosing version numbers. + +For the up-to-date release process, please refer the +[release process from the OpenTracing Java API](https://github.com/opentracing/opentracing-java/blob/master/RELEASE.md). + diff --git a/header.txt b/header.txt new file mode 100644 index 0000000..422184a --- /dev/null +++ b/header.txt @@ -0,0 +1,11 @@ +Copyright ${project.inceptionYear} The OpenTracing Authors + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +in compliance with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License +is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +or implied. See the License for the specific language governing permissions and limitations under +the License. diff --git a/mvnw b/mvnw new file mode 100755 index 0000000..6ecc150 --- /dev/null +++ b/mvnw @@ -0,0 +1,236 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # + # Look for the Apple JDKs first to preserve the existing behaviour, and then look + # for the new JDKs provided by Oracle. + # + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then + # + # Apple JDKs + # + export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then + # + # Oracle JDKs + # + export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home + fi + + if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then + # + # Apple JDKs + # + export JAVA_HOME=`/usr/libexec/java_home` + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + local basedir=$(pwd) + local wdir=$(pwd) + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + wdir=$(cd "$wdir/.."; pwd) + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in $@ +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..8e2b745 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,146 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in %* +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/opentracing-observer/pom.xml b/opentracing-observer/pom.xml new file mode 100644 index 0000000..1e75093 --- /dev/null +++ b/opentracing-observer/pom.xml @@ -0,0 +1,41 @@ + + + + 4.0.0 + + opentracing-observer-parent + io.opentracing.contrib + 0.0.1-SNAPSHOT + + + opentracing-observer + + + + io.opentracing + opentracing-api + + + + junit + junit + ${version.junit} + test + + + + diff --git a/opentracing-observer/src/main/java/io/opentracing/contrib/observer/TracerObserver.java b/opentracing-observer/src/main/java/io/opentracing/contrib/observer/TracerObserver.java new file mode 100644 index 0000000..d41b00c --- /dev/null +++ b/opentracing-observer/src/main/java/io/opentracing/contrib/observer/TracerObserver.java @@ -0,0 +1,22 @@ +/** + * Copyright 2017 The OpenTracing Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package io.opentracing.contrib.observer; + +/** + * This interface represents an observer used to receive notifications related to {@link Span}s. + * + */ +public interface TracerObserver { + +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..88988b2 --- /dev/null +++ b/pom.xml @@ -0,0 +1,206 @@ + + + + 4.0.0 + + io.opentracing.contrib + opentracing-observer-parent + 0.0.1-SNAPSHOT + pom + + OpenTracing Observer + Observer API for OpenTracing instrumented services + http://github.com/opentracing-contrib/java-observer + + + https://github.com/opentracing-contrib/java-observer + scm:git:https://github.com/opentracing-contrib/java-observer.git + scm:git:https://github.com/opentracing-contrib/java-observer.git + HEAD + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + gbrown + Gary Brown + gbrown@redhat.com + + + + 2017 + + + OpenTracing + http://opentracing.io/ + + + + opentracing-observer + + + + 1.7 + 1.7 + UTF-8 + + 0.30.0 + 4.12 + + 0.3.4 + 0.1.0 + 2.8.2 + 2.10.4 + 3.0 + 2.5.3 + 3.0.1 + + + + + + io.opentracing + opentracing-api + ${version.io.opentracing} + + + + + + + bintray + https://api.bintray.com/maven/opentracing/maven/opentracing-observer/;publish=1 + + + jfrog-snapshots + http://oss.jfrog.org/artifactory/oss-snapshot-local + + + + + + + + com.mycila + license-maven-plugin + ${version.maven-license-plugin} + + + + io.takari + maven + ${version.io.takari-maven} + + + + + + + maven-release-plugin + ${version.maven-release-plugin} + + false + release + true + @{project.version} + + + + io.zipkin.centralsync-maven-plugin + centralsync-maven-plugin + ${version.io.zikin.centralsync-maven-plugin} + + opentracing + maven + opentracing-observer + + + + com.mycila + license-maven-plugin + +
header.txt
+ true + true + + LICENSE + **/*.txt + mvnw + mvnw.cmd + travis/publish.sh + .mvn/wrapper/maven-wrapper.properties + +
+ + + + check + + compile + + +
+
+
+ + + + release + + + + + maven-source-plugin + ${version.maven-source-plugin} + + + attach-sources + + jar + + + + + + + maven-javadoc-plugin + ${version.maven-javadoc-plugin} + + false + + + + attach-javadocs + + jar + + package + + + + + + + +
diff --git a/travis/publish.sh b/travis/publish.sh new file mode 100755 index 0000000..43c60b4 --- /dev/null +++ b/travis/publish.sh @@ -0,0 +1,117 @@ +set -euo pipefail +set -x + +build_started_by_tag() { + if [ "${TRAVIS_TAG}" == "" ]; then + echo "[Publishing] This build was not started by a tag, publishing snapshot" + return 1 + else + echo "[Publishing] This build was started by the tag ${TRAVIS_TAG}, publishing release" + return 0 + fi +} + +is_pull_request() { + if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then + echo "[Not Publishing] This is a Pull Request" + return 0 + else + echo "[Publishing] This is not a Pull Request" + return 1 + fi +} + +is_travis_branch_master() { + if [ "${TRAVIS_BRANCH}" = master ]; then + echo "[Publishing] Travis branch is master" + return 0 + else + echo "[Not Publishing] Travis branch is not master" + return 1 + fi +} + +check_travis_branch_equals_travis_tag() { + #Weird comparison comparing branch to tag because when you 'git push --tags' + #the branch somehow becomes the tag value + #github issue: https://github.com/travis-ci/travis-ci/issues/1675 + if [ "${TRAVIS_BRANCH}" != "${TRAVIS_TAG}" ]; then + echo "Travis branch does not equal Travis tag, which it should, bailing out." + echo " github issue: https://github.com/travis-ci/travis-ci/issues/1675" + exit 1 + else + echo "[Publishing] Branch (${TRAVIS_BRANCH}) same as Tag (${TRAVIS_TAG})" + fi +} + +check_release_tag() { + tag="${TRAVIS_TAG}" + if [[ "$tag" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]]; then + echo "Build started by version tag $tag. During the release process tags like this" + echo "are created by the 'release' Maven plugin. Nothing to do here." + exit 0 + elif [[ ! "$tag" =~ ^release-[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]]; then + echo "You must specify a tag of the format 'release-0.0.0' to release this project." + echo "The provided tag ${tag} doesn't match that. Aborting." + exit 1 + fi +} + +is_release_commit() { + project_version=$(./mvnw help:evaluate -N -Dexpression=project.version|grep -v '\[') + if [[ "$project_version" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]]; then + echo "Build started by release commit $project_version. Will synchronize to maven central." + return 0 + else + return 1 + fi +} + +release_version() { + echo "${TRAVIS_TAG}" | sed 's/^release-//' +} + +safe_checkout_master() { + # We need to be on a branch for release:perform to be able to create commits, and we want that branch to be master. + # But we also want to make sure that we build and release exactly the tagged version, so we verify that the remote + # master is where our tag is. + git checkout -B master + git fetch origin master:origin/master + commit_local_master="$(git show --pretty='format:%H' master)" + commit_remote_master="$(git show --pretty='format:%H' origin/master)" + if [ "$commit_local_master" != "$commit_remote_master" ]; then + echo "Master on remote 'origin' has commits since the version under release, aborting" + exit 1 + fi +} + +#---------------------- +# MAIN +#---------------------- + +if ! is_pull_request && build_started_by_tag; then + check_travis_branch_equals_travis_tag + check_release_tag +fi + +./mvnw install -nsu + +# If we are on a pull request, our only job is to run tests, which happened above via ./mvnw install +if is_pull_request; then + true +# If we are on master, we will deploy the latest snapshot or release version +# - If a release commit fails to deploy for a transient reason, delete the broken version from bintray and click rebuild +elif is_travis_branch_master; then + ./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DskipTests deploy + + # If the deployment succeeded, sync it to Maven Central. Note: this needs to be done once per project, not module, hence -N + if is_release_commit; then + ./mvnw --batch-mode -s ./.settings.xml -nsu -N io.zipkin.centralsync-maven-plugin:centralsync-maven-plugin:sync + fi + +# If we are on a release tag, the following will update any version references and push a version tag for deployment. +elif build_started_by_tag; then + safe_checkout_master + ./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion="$(release_version)" -Darguments="-DskipTests" release:prepare +fi +