forked from open-telemetry/opentelemetry-java-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTelemetryPolicy.java
More file actions
53 lines (48 loc) · 1.51 KB
/
TelemetryPolicy.java
File metadata and controls
53 lines (48 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.contrib.dynamic.policy;
import java.util.Objects;
/**
* Represents a single Telemetry Policy identified by type.
*
* <p>A {@code TelemetryPolicy} instance encapsulates a specific rule or configuration intent
* identified by its {@link #getType() type}.
*
* <p>Policies are immutable data carriers.
*
* <p>As an example, policy type {@code trace-sampling} indicates that trace sampling behavior
* should be configured.
*
* <p>Direct instantiation of this base class is intentionally supported for type-only policy
* signals (for example, to indicate policy removal/reset without policy-specific values).
*
* @see io.opentelemetry.contrib.dynamic.policy
*/
public class TelemetryPolicy {
private final String type; // e.g. "trace-sampling"
/**
* Constructs a new TelemetryPolicy.
*
* <p>This constructor is used by type-specific subclasses and also directly for type-only policy
* signals such as policy removal/reset.
*
* @param type the type of the policy (e.g., "trace-sampling"), must not be null.
*/
public TelemetryPolicy(String type) {
Objects.requireNonNull(type, "type cannot be null");
this.type = type;
}
/**
* Returns the type of this policy.
*
* <p>The type identifies the domain and expected behavior of the policy (e.g., "trace-sampling",
* "metric-rate").
*
* @return the policy type.
*/
public String getType() {
return type;
}
}