tags

package
v0.0.0-...-f1bff1d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 5 Imported by: 8

Documentation

Index

Constants

View Source
const (
	XAkitaOriginalOrganizationID = "x-akita-original-organization-id"

	XAkitaOriginalService = "x-akita-original-service"

	XAkitaOriginalServiceID = "x-akita-original-service-id"

	XAkitaOriginalSpec = "x-akita-original-spec"

	XAkitaOriginalSpecID = "x-akita-original-spec-id"
)

Tags applied to a copy of the spec

Variables

This section is empty.

Functions

func CheckReservedKey

func CheckReservedKey(k Key) error

Returns an error if the key is reserved for Postman internal use.

func IsReservedKey

func IsReservedKey(k Key) bool

Determines whether a key is reserved for Postman internal use.

Types

type CreatedBy

type CreatedBy = string
const (
	// Designates a spec that was automatically created by a schedule.
	CreatedBySchedule CreatedBy = "schedule"

	// Designates a spec that was automatically created as an aggregate ("big")
	// model.
	CreatedByBigModel CreatedBy = "aggregator"
)

Valid values for the XAkitaCreatedBy tag.

type Key

type Key = tags.Key
const (
	// Identifies the source of a trace or spec. See `Source` for values.
	XAkitaSource Key = "x-akita-source"

	// Identifies the process by which a trace or spec was created. See
	// `CreatedBy` for values.
	XAkitaCreatedBy Key = "x-akita-created-by"

	// The original filesystem path of an uploaded trace.
	XAkitaTraceLocalPath Key = "x-akita-trace-local-path"

	// The type of scheduled model, if XAkitaCreatedBy == CreatedBySchedule.
	XAkitaScheduledModelType Key = "x-akita-scheduled-model-type"

	// The version of the service(s) under observation, as defined by the
	// user.
	XAkitaServiceVersion Key = "x-akita-service-version"
)
const (
	// Identifies the CI framework from which a trace or spec was obtained (e.g.,
	// CircleCI, Travis).
	XAkitaCI Key = "x-akita-ci"

	// Each model derived from a PR (or MR) is automatically diffed against a
	// baseline spec. This tag identifies the AKID for that baseline spec.
	// Attached to specs.
	XAkitaComparedWith Key = "x-akita-compared-with"

	// Each model derived from a PR (or MR) is automatically diffed against a
	// baseline spec. This tag identifies the number of differences that were
	// found in this diff. Attached to specs for which this automatic diffing is
	// done.
	XAkitaNumDifferences Key = "x-akita-num-differences"
)

Generic CI tags

const (
	// The contents of the TRAVIS_BUILD_WEB_URL environment variable. Attached to
	// traces and specs derived from a Travis job.
	XAkitaTravisBuildWebURL Key = "x-akita-travis-build-web-url"

	// The contents of the TRAVIS_JOB_WEB_URL environment variable. Attached to
	// traces and specs derived from a Travis job.
	XAkitaTravisJobWebURL Key = "x-akita-travis-job-web-url"
)

Travis tags

const (
	// Identifies the git branch from which the trace or spec was derived.
	// Attached to traces or specs obtained from CI.
	XAkitaGitBranch Key = "x-akita-git-branch"

	// Identifies the git commit hash from which the trace or spec was derived.
	// Attached to traces or specs obtained from CI.
	// May also be attached to deployment traces if the git commit is known
	// and applicable.
	XAkitaGitCommit Key = "x-akita-git-commit"

	// A link to the git repository. Attached to traces or specs obtained from a
	// pull/merge request.
	XAkitaGitRepoURL Key = "x-akita-git-repo-url"
)

Generic git tags

const (
	// Identifies the GitHub PR number associated with the pull request. Attached
	// to traces or specs obtained from a GitHub pull request.
	XAkitaGitHubPR Key = "x-akita-github-pr"

	// A link to the GitHub pull request. Attached to traces or specs obtained
	// from a GitHub pull request.
	XAkitaGitHubPRURL Key = "x-akita-github-pr-url"

	// Identifies the GitHub repository for which the pull request was made.
	// Attached to traces or specs obtained from a GitHub pull request.
	XAkitaGitHubRepo Key = "x-akita-github-repo"
)

GitHub tags

const (
	XAkitaGitLabProject Key = "x-akita-gitlab-project"
	XAkitaGitLabMRIID   Key = "x-akita-gitlab-mr-iid"
)

GitLab tags

const (
	// The name of the deployment environment. Suggested values are "production"
	// or "staging", but may be a user-defined value.
	XAkitaDeployment Key = "x-akita-deployment"

	// Used for specifications where the number of witnesses is too large.
	XAkitaTruncated Key = "x-akita-truncated"

	// The presence of this tag indicates that the associated model should not be
	// incorporated into any aggregate models. The value of this tag is ignored.
	XAkitaDoNotAggregate Key = "x-akita-do-not-aggregate"
)

Deployment tags

const (
	XAkitaAWSRegion Key = "x-akita-aws-region"

	// Task and service for agents deployed in ECS.
	XAkitaECSTask    Key = "x-akita-ecs-task"
	XAkitaECSService Key = "x-akita-ecs-service"
)

AWS deployment tags

const (
	// Kubernetes namespace
	// = metadata.namespace in the Downward API
	XAkitaKubernetesNamespace Key = "x-akita-k8s-namespace"

	// Node (host) on which the collection agent is running
	// = spec.nodeName in the Downward API (v1.4.0+)
	XAkitaKubernetesNode Key = "x-akita-k8s-node"

	// IP address of the Kubernetes node
	// = status.hostIP in the Downward API
	XAkitaKubernetesHostIP Key = "x-akita-k8s-host-ip"

	// Pod in which the collection agent is running; may be
	// a dedicated pod using host networking, or an application
	// pod when running as a sidecar.
	// = metadata.name in the Downward API
	XAkitaKubernetesPod Key = "x-akita-k8s-pod"

	// Pod IP address
	// = status.podIP in the Downward API (v1.7.0+)
	XAkitaKubernetesPodIP Key = "x-akita-k8s-pod-ip"

	// Daemonset used to create the collection agent, if any
	XAkitaKubernetesDaemonset Key = "x-akita-k8s-daemonset"
)

Kubernetes deployment tags

const (
	// A comma-separated list of interfaces on which packets were captured.
	XAkitaDumpInterfacesFlag Key = "x-akita-dump-interfaces-flag"

	// The packet filter given on the command line to capture packets.
	XAkitaDumpFilterFlag Key = "x-akita-dump-filter-flag"
)

Packet-capture tags

const (
	// The contents of the CIRCLE_BUILD_URL environment variable. Attached to
	// traces and specs derived from a CircleCI job.
	XAkitaCircleCIBuildURL Key = "x-akita-circleci-build-url"
)

CircleCI tags

type ScheduledModelType

type ScheduledModelType = string
const (
	// Designates a spec that was created as a "large model".  We show the
	// latest large model on the API Model page in the Akita app.
	ScheduledLargeModel ScheduledModelType = "large-model"

	// Designates a spec that was created as a large diffing model.  The
	// most recent large diffing model is used when computing model
	// differences.
	ScheduledLargeDiffingModel ScheduledModelType = "large-diffing-model"

	// Designates a spec that was created as a small diffing model.  The
	// most recent small diffing model is used when computing model
	// differences.
	ScheduledSmallDiffingModel ScheduledModelType = "small-diffing-model"
)

Valid values for the XAkitaScheduledModelType tag.

type SingletonTags

type SingletonTags map[Key]string

SingletonTags maps tags to single values.

func FromPairs

func FromPairs(pairs []string) (SingletonTags, error)

Returns a SingletonTags from parsing a list of "key=value" pairs. Produces an error if any element of the list is improperly formatted, or if any key is given more than once. The caller must emit an appropriate warning if any keys are reserved.

func (SingletonTags) AsTags

func (ts SingletonTags) AsTags() Tags

type Source

type Source = string
const (
	// Designates a trace or spec that was generated from CI.
	CISource Source = "ci"

	// Designates a trace or spec that was derived from a staging or production
	// deployment.
	DeploymentSource Source = "deployment"

	// Designates a trace or spec that whas manually uploaded by the user.
	UploadedSource Source = "uploaded"

	// Designates a trace or spec that was manually created by the user. For
	// example, traces captured from network traffic using the CLI's `apidump`
	// command are tagged with this source.
	UserSource Source = "user"
)

Valid values for the XAkitaSource tag.

type Tags

type Tags map[Key]ValueSet

Maps tags to sets of values.

func FromPairsMultivalue

func FromPairsMultivalue(pairs []string) (Tags, error)

Returns a Tags from parsing a list of "key=value" pairs. Produces an error if any element of the list is improperly formatted. The caller must emit an appropriate warning if any keys are reserved.

func (Tags) Add

func (t Tags) Add(key tags.Key, value string)

Adds a value to the given key.

func (Tags) AsSingletonTags

func (t Tags) AsSingletonTags() SingletonTags

Returns a new tags map with a single value for each tag. If more than one value was present for a given tag, returns the first value in the list. If there are no values in the list, the tag is removed.

func (Tags) Clone

func (t Tags) Clone() Tags

func (Tags) Intersect

func (t Tags) Intersect(t2 Tags)

Removes any tag from t that doesn't exist in t2. For any key k in both t and t2, t[k] is remapped to the intersection of their values. If the intersection is empty, then k is removed.

func (Tags) Set

func (t Tags) Set(key tags.Key, values []string)

Sets the given key to the given values. Values are copied.

func (Tags) SetAll

func (t Tags) SetAll(t2 Tags)

SetAll copies all values from t2 into t. If a key exists in both sets of tags, the value in t is overwritten with that in t2.

func (Tags) SetSingleton

func (t Tags) SetSingleton(key tags.Key, value string)

Sets the given key to the given value.

func (Tags) Union

func (t Tags) Union(t2 Tags)

Copies tags from t2 that don't exist in t. For any key k in both t and t2, t[k] is remapped to the union of their values. Does not preserve duplicates or maintain list order.

type Value

type Value = string

type ValueSet

type ValueSet map[Value]struct{}

func NewValueSet

func NewValueSet(vs ...Value) ValueSet

func (ValueSet) Add

func (vs ValueSet) Add(v Value)

Adds a value to this set.

func (ValueSet) AsSlice

func (vs ValueSet) AsSlice() []Value

Returns a sorted slice of values.

func (ValueSet) Clone

func (vs ValueSet) Clone() ValueSet

func (ValueSet) GetFirst

func (vs ValueSet) GetFirst() (v Value, exists bool)

Returns the smallest value in the set. If the set is empty, returns exists == false.

func (ValueSet) Intersect

func (vs ValueSet) Intersect(other ValueSet)

Removes values in vs that are not in other.

func (ValueSet) MarshalJSON

func (vs ValueSet) MarshalJSON() ([]byte, error)

Marshals ValueSet as a sorted list.

func (ValueSet) Union

func (vs ValueSet) Union(other ValueSet)

Adds values from other to vs.

func (*ValueSet) UnmarshalJSON

func (vs *ValueSet) UnmarshalJSON(b []byte) error

Parses ValueSet from a list, removing duplicates.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL