Move more docs to docs folder (#3801)
This commit is contained in:
parent
82a3353b97
commit
f94ccb789a
|
|
@ -446,8 +446,8 @@ The snippet below shows configuring the `Resource` associated with the provider.
|
|||
|
||||
```csharp
|
||||
using OpenTelemetry;
|
||||
using OpenTelemetry.Resources;
|
||||
using OpenTelemetry.Metrics;
|
||||
using OpenTelemetry.Resources;
|
||||
|
||||
using var meterProvider = Sdk.CreateMeterProviderBuilder()
|
||||
.ConfigureResource(r => r.AddService("MyServiceName"))
|
||||
|
|
|
|||
|
|
@ -199,11 +199,63 @@ logging, by supporting `Activity` and `LogRecord` respectively.*
|
|||
|
||||
### Resource
|
||||
|
||||
// TODO
|
||||
[Resource](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md)
|
||||
is the immutable representation of the entity producing the telemetry. If no
|
||||
`Resource` is explicitly configured, the
|
||||
[default](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#semantic-attributes-with-sdk-provided-default-value)
|
||||
resource is used to indicate the
|
||||
[Service](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service).
|
||||
The `ConfigureResource` method on `TracerProviderBuilder` can be used to
|
||||
configure the resource on the provider. When the provider is built, it
|
||||
automatically builds the final `Resource` from the configured `ResourceBuilder`.
|
||||
There can only be a single `Resource` associated with a
|
||||
provider. It is not possible to change the resource builder *after* the provider
|
||||
is built, by calling the `Build()` method on the `TracerProviderBuilder`.
|
||||
`ResourceBuilder` offers various methods to construct resource comprising of
|
||||
multiple attributes from various sources.
|
||||
|
||||
The snippet below shows configuring the `Resource` associated with the provider.
|
||||
|
||||
```csharp
|
||||
using OpenTelemetry;
|
||||
using OpenTelemetry.Resources;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
|
||||
.ConfigureResource(r => r.AddService("MyServiceName"))
|
||||
.Build();
|
||||
```
|
||||
|
||||
It is also possible to configure the `Resource` by using following
|
||||
environmental variables:
|
||||
|
||||
| Environment variable | Description |
|
||||
| -------------------------- | -------------------------------------------------- |
|
||||
| `OTEL_RESOURCE_ATTRIBUTES` | Key-value pairs to be used as resource attributes. See the [Resource SDK specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.5.0/specification/resource/sdk.md#specifying-resource-information-via-an-environment-variable) for more details. |
|
||||
| `OTEL_SERVICE_NAME` | Sets the value of the `service.name` resource attribute. If `service.name` is also provided in `OTEL_RESOURCE_ATTRIBUTES`, then `OTEL_SERVICE_NAME` takes precedence. |
|
||||
|
||||
### Sampler
|
||||
|
||||
// TODO
|
||||
[Samplers](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#sampler)
|
||||
are used to control the noise and overhead introduced by OpenTelemetry by
|
||||
reducing the number of samples of traces collected and sent to the processors.
|
||||
If no sampler is explicitly configured, the default is to use
|
||||
`ParentBased(root=AlwaysOn)`. `SetSampler` method on `TracerProviderBuilder` can
|
||||
be used to set sampler. Only one sampler can be associated with a provider. If
|
||||
multiple `SetSampler` is called, the last one wins. Also, it is not possible to
|
||||
change the sampler *after* the provider is built, by calling the `Build()`
|
||||
method on the `TracerProviderBuilder`.
|
||||
|
||||
The snippet below shows configuring a custom sampler to the provider.
|
||||
|
||||
```csharp
|
||||
using OpenTelemetry;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
|
||||
.SetSampler(new TraceIdRatioBasedSampler(0.25))
|
||||
.Build();
|
||||
```
|
||||
|
||||
## Context Propagation
|
||||
|
||||
|
|
|
|||
|
|
@ -97,15 +97,14 @@ namespace OpenTelemetry.Exporter
|
|||
var bucketsBuilder = new StringBuilder();
|
||||
var sum = metricPoint.GetHistogramSum();
|
||||
var count = metricPoint.GetHistogramCount();
|
||||
bucketsBuilder.Append($"Sum: {sum} Count: {count} ");
|
||||
if (metricPoint.HasMinMax())
|
||||
{
|
||||
bucketsBuilder.Append($"Sum: {sum} Count: {count} Min: {metricPoint.GetHistogramMin()} Max: {metricPoint.GetHistogramMax()} \n");
|
||||
}
|
||||
else
|
||||
{
|
||||
bucketsBuilder.Append($"Sum: {sum} Count: {count} \n");
|
||||
bucketsBuilder.Append($"Min: {metricPoint.GetHistogramMin()} Max: {metricPoint.GetHistogramMax()} ");
|
||||
}
|
||||
|
||||
bucketsBuilder.AppendLine();
|
||||
|
||||
bool isFirstIteration = true;
|
||||
double previousExplicitBound = default;
|
||||
foreach (var histogramMeasurement in metricPoint.GetHistogramBuckets())
|
||||
|
|
|
|||
Loading…
Reference in New Issue