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

chore | Add graphQL description to span exclusion rules APIs #237

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hypertrace.graphql.spanprocessing.schema.mutation;

import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;
import graphql.annotations.annotationTypes.GraphQLNonNull;
Expand All @@ -12,5 +13,6 @@ public interface DeleteSpanProcessingRuleResponse {
@GraphQLField
@GraphQLNonNull
@GraphQLName(DELETE_SPAN_PROCESSING_RULE_RESPONSE_SUCCESS)
@GraphQLDescription("Success field tells us whether the delete call was a success or not")
boolean success();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hypertrace.graphql.spanprocessing.schema.mutation;

import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;
import graphql.annotations.annotationTypes.GraphQLNonNull;
Expand All @@ -17,16 +18,19 @@ public interface ExcludeSpanRuleUpdate extends Identifiable {

@GraphQLField
@GraphQLName(NAME_KEY)
@GraphQLDescription("Update the rule name for the provided ruleId")
@GraphQLNonNull
String name();

@GraphQLField
@GraphQLName(SPAN_PROCESSING_FILTER_KEY)
@GraphQLDescription("Replace the existing spanFilters for the input ruleId")
@GraphQLNonNull
SpanProcessingRuleFilter spanFilter();

@GraphQLField
@GraphQLName(DISABLED_KEY)
@GraphQLDescription("Enable or disable the rule")
@GraphQLNonNull
boolean disabled();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.hypertrace.graphql.spanprocessing.schema.mutation;

import graphql.annotations.annotationTypes.GraphQLDataFetcher;
import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;
import graphql.annotations.annotationTypes.GraphQLNonNull;
Expand All @@ -16,6 +17,7 @@ public interface SpanProcessingMutationSchema {

@GraphQLField
@GraphQLName(CREATE_EXCLUDE_SPAN_RULE_MUTATION_NAME)
@GraphQLDescription("Creates a new ExcludeSpanRule. See ExcludeSpanRule for more information.")
@GraphQLNonNull
@GraphQLDataFetcher(ExcludeSpanCreateRuleMutator.class)
ExcludeSpanRule createExcludeSpanRule(
Expand All @@ -24,6 +26,8 @@ ExcludeSpanRule createExcludeSpanRule(

@GraphQLField
@GraphQLName(UPDATE_EXCLUDE_SPAN_RULE_MUTATION_NAME)
@GraphQLDescription(
"Update exclude span rule name, filters and enable/disable it for the provided ruleId")
@GraphQLNonNull
@GraphQLDataFetcher(ExcludeSpanUpdateRuleMutator.class)
ExcludeSpanRule updateExcludeSpanRule(
Expand All @@ -32,6 +36,7 @@ ExcludeSpanRule updateExcludeSpanRule(

@GraphQLField
@GraphQLName(DELETE_EXCLUDE_SPAN_RULE_MUTATION_NAME)
@GraphQLDescription("Delete exclude span rule based on ruleId")
@GraphQLNonNull
@GraphQLDataFetcher(ExcludeSpanDeleteRuleMutator.class)
DeleteSpanProcessingRuleResponse deleteExcludeSpanRule(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hypertrace.graphql.spanprocessing.schema.query;

import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;
import graphql.annotations.annotationTypes.GraphQLNonNull;
Expand All @@ -15,5 +16,6 @@ public interface ExcludeSpanRuleResultSet extends ResultSet<ExcludeSpanRule> {
@GraphQLField
@GraphQLNonNull
@GraphQLName(RESULT_SET_RESULTS_NAME)
@GraphQLDescription("Exclude span rule list in")
List<ExcludeSpanRule> results();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.hypertrace.graphql.spanprocessing.schema.query;

import graphql.annotations.annotationTypes.GraphQLDataFetcher;
import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;
import graphql.annotations.annotationTypes.GraphQLNonNull;
Expand All @@ -12,6 +13,7 @@ public interface SpanProcessingQuerySchema {
@GraphQLField
@GraphQLNonNull
@GraphQLName(EXCLUDE_SPAN_RULES_QUERY_NAME)
@GraphQLDescription("Get all exclude span rules")
@GraphQLDataFetcher(ExcludeSpanRulesFetcher.class)
ExcludeSpanRuleResultSet excludeSpanRules();
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package org.hypertrace.graphql.spanprocessing.schema.rule;

import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;
import graphql.annotations.annotationTypes.GraphQLNonNull;
import java.time.Instant;
import org.hypertrace.core.graphql.common.schema.id.Identifiable;

@GraphQLName(ExcludeSpanRule.TYPE_NAME)
@GraphQLDescription(
"An ExcludeSpanRule describes a set of conditions based on span attributes. When matched, a span is discarded and not eligible for further processing.")
public interface ExcludeSpanRule extends Identifiable, ExcludeSpanRuleInfo {
String TYPE_NAME = "ExcludeSpanRule";

Expand All @@ -15,11 +18,13 @@ public interface ExcludeSpanRule extends Identifiable, ExcludeSpanRuleInfo {

@GraphQLField
@GraphQLName(CREATION_TIME_KEY)
@GraphQLDescription("Exclude span rule creation time")
@GraphQLNonNull
Instant creationTime();

@GraphQLField
@GraphQLName(LAST_UPDATED_TIME_KEY)
@GraphQLDescription("Exclude span rule last update time")
@GraphQLNonNull
Instant lastUpdatedTime();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hypertrace.graphql.spanprocessing.schema.rule;

import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;
import graphql.annotations.annotationTypes.GraphQLNonNull;
Expand All @@ -16,21 +17,27 @@ public interface ExcludeSpanRuleInfo {

@GraphQLField
@GraphQLName(NAME_KEY)
@GraphQLDescription("Exclude span rule name")
@GraphQLNonNull
String name();

@GraphQLField
@GraphQLName(SPAN_FILTER_KEY)
@GraphQLDescription("Span processing rule filter contains filters based on span attributes")
@GraphQLNonNull
SpanProcessingRuleFilter spanFilter();

@GraphQLField
@GraphQLName(DISABLED_KEY)
@GraphQLDescription(
"Disabled field denotes whether the rule is disabled or not. By default it is enabled on write")
AnandShivansh marked this conversation as resolved.
Show resolved Hide resolved
@GraphQLNonNull
boolean disabled();

@GraphQLField
@GraphQLName(RULE_TYPE_KEY)
@GraphQLDescription(
"Exclude span rule type tells us whether it is user configured rule or system rule")
// TODO: make this field non-nullable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a change we still want to make? Anything stopping us from doing it? It can't be done once the API is exposed as it'll be a breaking change.

ExcludeSpanRuleRuleType ruleType();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hypertrace.graphql.spanprocessing.schema.rule.filter;

import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;
import graphql.annotations.annotationTypes.GraphQLNonNull;
Expand All @@ -15,11 +16,15 @@ public interface SpanProcessingLogicalFilter {

@GraphQLField
@GraphQLName(SPAN_PROCESSING_LOGICAL_OPERATOR_KEY)
@GraphQLDescription(
"The logical operator is used to combine the list of filters provided in the spanFilters field")
@GraphQLNonNull
LogicalOperator logicalOperator();

@GraphQLField
@GraphQLName(SPAN_PROCESSING_FILTERS_KEY)
@GraphQLDescription(
"List of span filters to be evaluated combining together with the logical operator provided")
@GraphQLNonNull
List<SpanProcessingRuleFilter> spanFilters();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument.FILTER_ARGUMENT_VALUE;

import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;
import graphql.annotations.annotationTypes.GraphQLNonNull;
Expand All @@ -16,19 +17,27 @@ public interface SpanProcessingRelationalFilter {

@GraphQLField
@GraphQLName(SPAN_PROCESSING_FILTER_KEY_KEY)
@GraphQLDescription(
"Span processing filter key is the span attribute provided as string like http.request.header.authorization")
String key();

@GraphQLField
@GraphQLName(SPAN_PROCESSING_FILTER_FIELD_KEY)
@GraphQLDescription(
"Span processing filter field supports a list of pre-defined fields like environment name, service name, url and url path (url without query params)")
SpanProcessingFilterField field();

@GraphQLField
@GraphQLName(RELATION_OPERATOR_KEY)
@GraphQLDescription(
"Span processing relational operator which combines the lhs (key or field) and rhs (value)")
@GraphQLNonNull
SpanProcessingRelationalOperator relationalOperator();

@GraphQLField
@GraphQLName(FILTER_ARGUMENT_VALUE)
@GraphQLDescription(
"Span processing filter value to be evaluated using the relational operator for the provided lhs (key or field)")
@GraphQLNonNull
Object value();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hypertrace.graphql.spanprocessing.schema.rule.filter;

import graphql.annotations.annotationTypes.GraphQLDescription;
import graphql.annotations.annotationTypes.GraphQLField;
import graphql.annotations.annotationTypes.GraphQLName;

Expand All @@ -12,9 +13,13 @@ public interface SpanProcessingRuleFilter {

@GraphQLField
@GraphQLName(SPAN_PROCESSING_LOGICAL_FILTER_KEY)
@GraphQLDescription(
"Span processing logical filter containing list of spanFilters and the logical operator")
SpanProcessingLogicalFilter logicalSpanFilter();

@GraphQLField
@GraphQLName(SPAN_PROCESSING_RELATIONAL_FILTER_KEY)
@GraphQLDescription(
"Span processing relational filter which takes in lhs and lhs, combining them with relational operator")
SpanProcessingRelationalFilter relationalSpanFilter();
}
Loading