Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5734,6 +5734,12 @@ components:
Scope down exclusion filter to only a subset of logs with a log query.
example: "*"
type: string
sample_attribute:
description: |-
Sample attribute to use for the sampling of logs going through this exclusion filter.
When set, only the logs with the specified attribute are sampled.
example: "@ci.job_id"
type: string
sample_rate:
description: |-
Sample rate to apply to logs going through this exclusion filter,
Expand Down
2 changes: 1 addition & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ components:
type: string
ResourceID:
description: |-
Identifier, formatted as `type:id`. Supported types: `dashboard`, `integration-service`, `integration-webhook`, `notebook`, `reference-table`, `security-rule`, `slo`, `workflow`, `app-builder-app`, `connection`, `connection-group`, `rum-application`, `cross-org-connection`, `spreadsheet`, `on-call-schedule`, `on-call-escalation-policy`, `on-call-team-routing-rules`, `logs-pipeline`.
Identifier, formatted as `type:id`. Supported types: `dashboard`, `integration-service`, `integration-webhook`, `notebook`, `powerpack`, `reference-table`, `security-rule`, `slo`, `synthetics-global-variable`, `synthetics-test`, `synthetics-private-location`, `monitor`, `workflow`, `app-builder-app`, `connection`, `connection-group`, `rum-application`, `cross-org-connection`, `spreadsheet`, `on-call-schedule`, `on-call-escalation-policy`, `on-call-team-routing-rules`, `logs-pipeline`, `case-management-project`.
example: "dashboard:abc-def-ghi"
in: path
name: resource_id
Expand Down
6 changes: 5 additions & 1 deletion examples/v1/logs-indexes/CreateLogsIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ public static void main(String[] args) {
.exclusionFilters(
Collections.singletonList(
new LogsExclusion()
.filter(new LogsExclusionFilter().query("*").sampleRate(1.0))
.filter(
new LogsExclusionFilter()
.query("*")
.sampleAttribute("@ci.job_id")
.sampleRate(1.0))
.name("payment")))
.filter(new LogsFilter().query("source:python"))
.name("main")
Expand Down
6 changes: 5 additions & 1 deletion examples/v1/logs-indexes/UpdateLogsIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public static void main(String[] args) {
.exclusionFilters(
Collections.singletonList(
new LogsExclusion()
.filter(new LogsExclusionFilter().query("*").sampleRate(1.0))
.filter(
new LogsExclusionFilter()
.query("*")
.sampleAttribute("@ci.job_id")
.sampleRate(1.0))
.name("payment")))
.filter(new LogsFilter().query("source:python"))
.numFlexLogsRetentionDays(360L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/** Exclusion filter is defined by a query, a sampling rule, and a active/inactive toggle. */
@JsonPropertyOrder({
LogsExclusionFilter.JSON_PROPERTY_QUERY,
LogsExclusionFilter.JSON_PROPERTY_SAMPLE_ATTRIBUTE,
LogsExclusionFilter.JSON_PROPERTY_SAMPLE_RATE
})
@jakarta.annotation.Generated(
Expand All @@ -29,6 +30,9 @@ public class LogsExclusionFilter {
public static final String JSON_PROPERTY_QUERY = "query";
private String query;

public static final String JSON_PROPERTY_SAMPLE_ATTRIBUTE = "sample_attribute";
private String sampleAttribute;

public static final String JSON_PROPERTY_SAMPLE_RATE = "sample_rate";
private Double sampleRate;

Expand Down Expand Up @@ -62,6 +66,28 @@ public void setQuery(String query) {
this.query = query;
}

public LogsExclusionFilter sampleAttribute(String sampleAttribute) {
this.sampleAttribute = sampleAttribute;
return this;
}

/**
* Sample attribute to use for the sampling of logs going through this exclusion filter. When set,
* only the logs with the specified attribute are sampled.
*
* @return sampleAttribute
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SAMPLE_ATTRIBUTE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSampleAttribute() {
return sampleAttribute;
}

public void setSampleAttribute(String sampleAttribute) {
this.sampleAttribute = sampleAttribute;
}

public LogsExclusionFilter sampleRate(Double sampleRate) {
this.sampleRate = sampleRate;
return this;
Expand Down Expand Up @@ -140,20 +166,22 @@ public boolean equals(Object o) {
}
LogsExclusionFilter logsExclusionFilter = (LogsExclusionFilter) o;
return Objects.equals(this.query, logsExclusionFilter.query)
&& Objects.equals(this.sampleAttribute, logsExclusionFilter.sampleAttribute)
&& Objects.equals(this.sampleRate, logsExclusionFilter.sampleRate)
&& Objects.equals(this.additionalProperties, logsExclusionFilter.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(query, sampleRate, additionalProperties);
return Objects.hash(query, sampleAttribute, sampleRate, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class LogsExclusionFilter {\n");
sb.append(" query: ").append(toIndentedString(query)).append("\n");
sb.append(" sampleAttribute: ").append(toIndentedString(sampleAttribute)).append("\n");
sb.append(" sampleRate: ").append(toIndentedString(sampleRate)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
Expand Down
Loading
Loading