Get facets
const url = 'http://localhost:8080/api/v1/projects/example/facets';const options = { method: 'POST', headers: { cookie: 'cetra_session=<cetra_session>', 'Content-Type': 'application/json' }, body: '{"fields":[{"field":"example","limit":1,"q":"example"}],"filter":"example","from":"example","include_eval":true,"include_experiments":true,"search":"example","to":"example","view":"traces"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/projects/example/facets \ --header 'Content-Type: application/json' \ --cookie cetra_session=<cetra_session> \ --data '{ "fields": [ { "field": "example", "limit": 1, "q": "example" } ], "filter": "example", "from": "example", "include_eval": true, "include_experiments": true, "search": "example", "to": "example", "view": "traces" }'Evaluation, playground and assistant traces (environment = cetra-eval, environment = cetra-playground or environment = cetra-assistant) and experiment traces are excluded unless include_eval or include_experiments is set. Answers 1 to 20 fields over the rows the list would show: the window, the default exclusions, search and filter, given once for every field, but not the list’s cursor, sort or limit. The answer has one result per field, in request order, with either facet or error: a bad field, limit or q, or a field that times out, fails only that field. A bad filter, search on sessions, a bad window, or 0 or more than 20 fields fail the whole request. A field is a column of the view, or map['key'] of a map column; a bare map column facets its keys. kind is values (strings, booleans, lists and map['key']), keys (a bare map) or histogram (numbers: min, max, approximate p50, p95 and p99, and 20 equal buckets below p99 plus one bucket from p99 to max). total counts rows, missing the rows with no value (null, or an empty list or map). Values are counted per row: a list counts a row once under each distinct element. Keys starting with cetra. are left out. q keeps values containing it, ignoring case. Spans count stored copies separately. Sessions take no search. Nothing is cached on the server. A read: a read-only personal access token and a read key may call it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Project UUID, URL-encoded org-slug/project-slug, or current.
Request Bodyrequired
Section titled “Request Bodyrequired”Body of POST /api/v1/projects/{project}/facets: fields over the rows of one list (D-C-24).
object
The fields, 1 to 20. Answered in this order.
One field of a facet batch.
object
column or map['key']. A bare map column facets its keys.
Most values or keys returned (1 to 100, default 10). Ignored by histograms.
Case-insensitive substring the value or key must contain. 1 to 200 characters after trimming. Ignored by histograms.
Filter DSL expression over view. Blank means no filter.
Inclusive range start. RFC 3339 or epoch milliseconds.
Include traces from the reserved environments (cetra-eval, cetra-playground, cetra-assistant). Default false.
Include experiment traces. Default false.
Full-text search. traces and spans only. At most 1,024 bytes.
Exclusive range end. RFC 3339 or epoch milliseconds.
The list the facets describe.
Responses
Section titled “Responses”One result per field, in request order.
The answer of a facet batch: one result per requested field, in request order.
object
One result per requested field, in request order.
One field’s result: exactly one of facet and error.
object
Why this field was not answered. The other fields are not affected.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
The facet, when the field was answered.
object
The histogram of a number field.
object
Every bucket, empty ones included.
One histogram bucket. [lo, hi), except the last bucket, which is [lo, hi].
object
Rows in the bucket.
Upper bound.
Lower bound.
Largest value.
Smallest value.
Median.
95th percentile.
99th percentile.
What the answer describes.
Rows with no value: null, or an empty list or map.
True when more distinct values matched than limit.
Rows counted.
At most limit values or keys, by count descending then value ascending.
One value or key and the rows under it.
object
Rows counted under it.
The value or key. Booleans are true or false.
The field, as requested.
The list the facets describe.
Example
{ "results": [ { "error": { "code": "bad_request" }, "facet": { "kind": "values" } } ], "view": "traces"}The request is malformed or a filter is invalid.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}No credentials, or the credentials are invalid.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The credentials do not allow this operation, or the organization’s plan does not include it (code plan_required).
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The resource does not exist.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The request body is larger than the limit.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The request body is not JSON.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The query took longer than its time limit, needed more memory or temporary disk space than allowed, a filter deletion matched more than 100,000 traces, or the owner cannot be that user (code owner_not_allowed).
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}Too many requests.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The server is busy or a dependency is unavailable. Retry later.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}