Skip to content
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

Adding Correlations API and removing DistributedContext #420

Merged
merged 22 commits into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The OpenTelemetry specification describes the cross-language requirements and ex
- [Package/Library Layout](specification/library-layout.md)
- [Concurrency and Thread-Safety](specification/concurrency.md)
- API Specification
- [DistributedContext](specification/api-distributedcontext.md)
- [CorrelationContext](specification/api-correlationcontext.md)
- [Propagators](specification/api-propagators.md)
- [Tracing](specification/api-tracing.md)
- [Metrics](specification/api-metrics.md)
Expand Down
83 changes: 83 additions & 0 deletions specification/api-correlationcontext.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Correlations API

`CorrelationContext` is used to annotate telemetry, adding context and information to metrics, traces, and logs.
It is an abstract data type represented by a set of name/value pairs describing user-defined properties.
Each name in `CorrelationContext` MUST be associated with exactly one value.
`CorrelationContext` MUST be serialized according to the [W3C Correlation Context](https://w3c.github.io/correlation-context/) specification.
codeboten marked this conversation as resolved.
Show resolved Hide resolved

## Conflict Resolution

If a new name/value pair is added and its name is the same as an existing name, than the new pair MUST take precedence. The value
is replaced with the added value (regardless if it is locally generated or received from a remote peer).

## CorrelationContext
codeboten marked this conversation as resolved.
Show resolved Hide resolved

### GetCorrelations

codeboten marked this conversation as resolved.
Show resolved Hide resolved
Returns the name/value pairs in this `CorrelationContext`. The order of name/value pairs MUST NOT be
significant. Based on the language specification, the returned value can be
either an immutable collection or an immutable iterator to the collection of
codeboten marked this conversation as resolved.
Show resolved Hide resolved
name/value pairs in this `CorrelationContext`.

OPTIONAL parameters:

`Context` the context from which to remove the correlation.

### GetCorrelation
codeboten marked this conversation as resolved.
Show resolved Hide resolved

To access the value for a name/value pair by a prior event, the Correlations API
SHALL provide a function that takes a context and a name as input, and returns a
value. Returns the value associated with the given name, or null
if the given name is not present.

REQUIRED parameters:

`Name` the name to return the value for.

OPTIONAL parameters:

`Context` the context from which to get the correlation.

### SetCorrelation
codeboten marked this conversation as resolved.
Show resolved Hide resolved

To record the value for a name/value pair, the Correlations API SHALL provide a function which
takes a context, a name, and a value as input. Returns an updated `Context` which
codeboten marked this conversation as resolved.
Show resolved Hide resolved
contains the new value.

REQUIRED parameters:

`Name` the name for which to set the value.

`Value` the value to set.

OPTIONAL parameters:

`Context` the context to which the value will be set.

### RemoveCorrelation
codeboten marked this conversation as resolved.
Show resolved Hide resolved

To delete a name/value pair, the Correlations API SHALL provide a function which takes a context
and a name as input. Returns an updated `Context` which no longer contains the selected name.

REQUIRED parameters:

`Name` the name to remove.

OPTIONAL parameters:

`Context` the context from which to remove the correlation.

### ClearCorrelations

To avoid sending any name/value pairs to an untrusted process, the Correlations API SHALL provide
a function to remove all Correlations from a context. Returns an updated `Context`
with no correlations.

OPTIONAL parameters:

`Context` the context from which to remove all correlations.

### CorrelationContext Propagation

`CorrelationContext` MAY be propagated across process boundaries or across any arbitrary boundaries
(process, $OTHER_BOUNDARY1, $OTHER_BOUNDARY2, etc) for various reasons.
226 changes: 0 additions & 226 deletions specification/api-distributedcontext.md

This file was deleted.

15 changes: 5 additions & 10 deletions specification/library-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ api
├── metrics
├── trace
│ └── propagation
├── distributedcontext
├── correlationcontext
│ └── propagation
├── internal
└── logs
Expand All @@ -33,16 +33,11 @@ This directory describes the API that provides in-process context propagation.

This directory describes the Metrics API that can be used to record application metrics.

### [/distributedcontext](api-distributedcontext.md)
### [/correlationcontext](api-correlationcontext.md)

This directory describes the DistributedContext API that can be used to manage context propagation
This directory describes the CorrelationContext API that can be used to manage context propagation
and metrics-related labeling.

This API consists of a few main classes:

- `Entry` is used to label anything that is associated with a specific operation, such as an HTTP request.
- An `Entry` consists of `EntryMetadata`, `EntryKey`, and `EntryValue`.

### [/trace](api-tracing.md)

This API consist of a few main classes:
Expand Down Expand Up @@ -71,7 +66,7 @@ sdk
├── metrics
├── resource
├── trace
├── distributedcontext
├── correlationcontext
├── internal
└── logs
```
Expand All @@ -93,7 +88,7 @@ information about the entity for which stats or traces are recorded. For example
by a Kubernetes container can be linked to a resource that specifies the cluster, namespace, pod,
and container name.

### `/sdk/distributedcontext`
### `/sdk/correlationcontext`

### [/sdk/trace](sdk-tracing.md)

Expand Down
Loading