The featureFlags() GraphQL query is used to list feature flags depending on filters and context. All flags should be considered as beta features. Enabling features that are marked as experimental is strongly discouraged.

Syntax

Below is the syntax for the featureFlags() query field:

graphql
featureFlags(
     includeExperimentalFeatures: boolean, 
     enabledInScopeFilter: EnabledInScope
   ): [FeatureFlagV2!]!

The includeExperimentalFeatures is used to include experimental features. Enabling experimental features can lead to LogScale in a bad state beyond repair.

The example below requests a list of features that have been flagged, including experimental ones. For the return values, it's asking for the name of the flag, whether it's experimental, and a description of it.

Raw
graphql
query {featureFlags(
     includeExperimentalFeatures: true,
     enabledInScopeFilter: Disabled
     )
  {flag, experimental, description}
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "query {featureFlags(
     includeExperimentalFeatures: true,
     enabledInScopeFilter: Disabled
     )
  {flag, experimental, description}
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "query {featureFlags(
     includeExperimentalFeatures: true,
     enabledInScopeFilter: Disabled
     )
  {flag, experimental, description}
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "query {featureFlags( ^
     includeExperimentalFeatures: true, ^
     enabledInScopeFilter: Disabled ^
     ) ^
  {flag, experimental, description} ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "query {featureFlags(
     includeExperimentalFeatures: true,
     enabledInScopeFilter: Disabled
     )
  {flag, experimental, description}
}"
}'
"$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $INGEST_TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $json = '{"query" : "query {featureFlags(
     includeExperimentalFeatures: true,
     enabledInScopeFilter: Disabled
     )
  {flag, experimental, description}
}"
}';
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "query {featureFlags(
     includeExperimentalFeatures: true,
     enabledInScopeFilter: Disabled
     )
  {flag, experimental, description}
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "query {featureFlags(
     includeExperimentalFeatures: true,
     enabledInScopeFilter: Disabled
     )
  {flag, experimental, description}
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL/graphql',
  path: '/graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "featureFlags": [
      {
        "flag": "AlternateQueryMergeTargetHandling",
        "experimental": true,
        "description": "Enables alternate query merge target handling"
      },
      {
        "flag": "ArrayFunctions",
        "experimental": true,
        "description": "Enable ArrayFunctions in query language."
      },
      {
        "flag": "CachePolicies",
        "experimental": true,
        "description": "Prioritize newer over older segments."
      },
      {
        "flag": "CustomIngestTokens",
        "experimental": false,
        "description": "Enable custom ingest tokens not generated by LogScale."
      },
      ...
  }
}

The results would normally very lengthy. They've been shortened to save space on this page.

Given Datatypes

The enabledInScopeFilter parameter is used to enable filter defining. With it, you set which scope feature flags should be returned. It uses the EnabledInScope datatype, which has a few parameters that are listed below:

Table: EnabledInScope

ParameterTypeRequiredDefaultDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 13, 2024
Disabledboolean  Whether the feature flag is disabled.
GlobalScopeboolean  Whether the feature flag is enabled globally.
OrganizationScopeboolean  Whether the feature flag is enabled for the organization.
UserScopeboolean  Whether the feature flag is enabled for the user.

Returned Datatypes

For FeatureFlagV2, there are a few simple parameters. They're listed here along with descriptions of each:

Table: FeatureFlagV2

ParameterTypeRequiredDefaultDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 25, 2024
descriptionstringyes A description of the feature flag.
experimentalbooleanyes Whether the feature is experimental.
flagFeatureFlagyes The feature flag. See FeatureFlag.