This repository has been archived by the owner on May 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from opentracing/bhs/span_context_etc
An RFC for SpanContext, References, as well as changes to carriers
- Loading branch information
Showing
25 changed files
with
498 additions
and
388 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
opentracing-api/src/main/java/io/opentracing/References.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright 2016 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; | ||
|
||
/** | ||
* References is essentially a namespace for the official OpenTracing reference types. | ||
* | ||
* References are used by Tracer.buildSpan() to describe the relationships between Spans. | ||
* | ||
* @see io.opentracing.Tracer.SpanBuilder#addReference(Object, SpanContext) | ||
*/ | ||
public final class References { | ||
private References(){} | ||
|
||
/** | ||
* See http://opentracing.io/spec/#causal-span-references for more information about CHILD_OF references | ||
*/ | ||
public static final String CHILD_OF = "child_of"; | ||
|
||
/** | ||
* See http://opentracing.io/spec/#causal-span-references for more information about FOLLOWS_FROM references | ||
*/ | ||
public static final String FOLLOWS_FROM = "follows_from"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
opentracing-api/src/main/java/io/opentracing/SpanContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright 2016 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; | ||
|
||
/** | ||
* SpanContext represents Span state that must propagate to descendant Spans and across process boundaries. | ||
* | ||
* SpanContext is logically divided into two pieces: (1) the user-level "Baggage" (see set_baggage_item and get_baggage_item) that propagates across Span boundaries and (2) any Tracer-implementation-specific fields that are needed to identify or otherwise contextualize the associated Span instance (e.g., a <trace_id, span_id, sampled> tuple). | ||
*/ | ||
public interface SpanContext { | ||
/** | ||
* Sets a baggage item in the SpanContext as a key/value pair. | ||
* | ||
* Baggage enables powerful distributed context propagation functionality where arbitrary application data can be carried along the full path of request execution throughout the system. | ||
* | ||
* Note 1: Baggage is only propagated to the future (recursive) children of this SpanContext. | ||
* | ||
* Note 2: Baggage is sent in-band with every subsequent local and remote calls, so this feature must be used with care. | ||
* | ||
* @return this SpanContext instance, for chaining | ||
*/ | ||
SpanContext setBaggageItem(String key, String value); | ||
|
||
/** | ||
* @return the value of the baggage item identified by the given key, or null if no such item could be found | ||
*/ | ||
String getBaggageItem(String key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
opentracing-api/src/main/java/io/opentracing/propagation/HttpHeaderReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright 2016 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.propagation; | ||
|
||
import java.util.Iterator; | ||
import java.util.Map; | ||
|
||
/** | ||
* HttpHeaderReader is a built-in carrier for Tracer.inject(). | ||
* | ||
* HttpHeaderReader implementations allows Tracers to write key:value String pairs into arbitrary HTTP header representations. In this way, HttpHeaderReader prevents a tight coupling between OpenTracing and any particular Java HTTP Header representation. | ||
* | ||
* @see io.opentracing.Tracer#extract(Object) | ||
*/ | ||
public interface HttpHeaderReader { | ||
/** | ||
* Gets HTTP headers from the implementations backing store. | ||
* | ||
* Note that these headers will often be a superset of whatever was injected via an HttpHeaderWriter in the peer. As such, Tracers should use a unique prefix or substring to identify their header map entries. | ||
* | ||
* @return all entries in the HTTP header map; note that keys may appear multiple times (just as they may with HTTP headers) | ||
* | ||
* @see io.opentracing.Tracer#extract(Object) | ||
*/ | ||
Iterator<Map.Entry<String,String>> getEntries(); | ||
} |
35 changes: 35 additions & 0 deletions
35
opentracing-api/src/main/java/io/opentracing/propagation/HttpHeaderWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright 2016 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.propagation; | ||
|
||
/** | ||
* HttpHeaderWriter is a built-in carrier for Tracer.inject(). | ||
* | ||
* HttpHeaderWriter implementations allows Tracers to write key:value String pairs into arbitrary HTTP header representations. In this way, HttpHeaderWriter prevents a tight coupling between OpenTracing and any particular Java HTTP Header representation. | ||
* | ||
* @see io.opentracing.Tracer#inject(io.opentracing.SpanContext, Object) | ||
*/ | ||
public interface HttpHeaderWriter { | ||
/** | ||
* Puts a key:value pair into the HTTP header map. | ||
* | ||
* Note that headers added via put() will often share the HTTP header map with other application data. As such, Tracers should use a unique prefix or substring to identify their header map entries. | ||
* | ||
* @param key a key suitable for use in an HTTP header (i.e., case-insensitive, no special characters, etc) | ||
* @param value a value suitable for use in an HTTP header (i.e., URL-escaped) | ||
* | ||
* @see io.opentracing.Tracer#inject(io.opentracing.SpanContext, Object) | ||
*/ | ||
void put(String key, String value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.