Skip to content

Commit

Permalink
feat: generate feature JSON data products (#132)
Browse files Browse the repository at this point in the history
* feat: generate features/feature info data products
  • Loading branch information
cwaldren-ld authored Aug 9, 2024
1 parent 1ae0036 commit 452cb06
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 10 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ The data is intended for consumption by downstream products and services.

It also contains a [Go module](./api) exposing the metadata for easier consumption by Go applications.

| Data Product | Description | Format |
|------------------------------------------|-----------------------------------------------------------------|----------|
| [Database](./metadata.sqlite3) | Database containing data from which other products are derived. | sqlite3 |
| [SDK Names](products/names.json) | SDK friendly names for display. | JSON |
| [SDK Releases](products/releases.json) | SDK major/minor releases with EOL dates. | JSON |
| [SDK Types](products/types.json) | SDK types for categorization. | JSON |
| [SDK Languages](products/languages.json) | Programming languages associated with SDKs. | JSON |
| [SDK Repos](products/repos.json) | SDK source repositories | JSON |
| Data Product | Description | Format |
|------------------------------------------------|-----------------------------------------------------------------|---------|
| [Database](./metadata.sqlite3) | Database containing data from which other products are derived. | sqlite3 |
| [SDK Names](products/names.json) | SDK friendly names for display. | JSON |
| [SDK Releases](products/releases.json) | SDK major/minor releases with EOL dates. | JSON |
| [SDK Types](products/types.json) | SDK types for categorization. | JSON |
| [SDK Languages](products/languages.json) | Programming languages associated with SDKs. | JSON |
| [SDK Repos](products/repos.json) | SDK source repositories | JSON |
| [SDK Features](products/features.json) | SDK supported features | JSON |
| [SDK Feature Info](products/feature_info.json) | Descriptions of SDK features | JSON |


## structure
Expand Down
94 changes: 94 additions & 0 deletions api/sdkmeta/data/feature_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"allFlags": {
"description": "Return the flag variations for all feature flags for a given context.",
"name": "Getting all flags"
},
"appMetadata": {
"description": "Specify application and application version information.",
"name": "Application metadata"
},
"autoEnvAttrs": {
"description": "Automatically include device and application data in each evaluated context.",
"name": "Automatic environment attributes"
},
"bigSegments": {
"description": "Configure a persistent store to hold segments that are either synced from external tools, or that contain an arbitrarily large number of contexts of any one context kind.",
"name": "Big segments"
},
"bootstrapping": {
"description": "Provide an initial set of flag values that are immediately available during client initialization.",
"name": "Bootstrapping"
},
"contexts": {
"description": "Evaluate flags based on contexts. A context is a generalized way of referring to the people, services, machines, or other resources that encounter feature flags. SDKs without this feature only support flag evaluation for users.",
"name": "Contexts and context kinds"
},
"experimentation": {
"description": "Connect a flag with one or more metrics to measure end-user behavior for different variations of a flag. Requires minimum SDK versions, but no SDK configuration.",
"name": "Experimentation"
},
"fileDataSource": {
"description": "Use flag values, specified in JSON or YAML files, for all flag evaluations. Useful for testing or prototyping; do not use in production.",
"name": "Reading flags from a file"
},
"flagChanges": {
"description": "Use a listener pattern to subscribe to flag change notifications.",
"name": "Subscribing to flag changes"
},
"hooks": {
"description": "Define callbacks that are executed by the SDK at various points of interest, usually for metrics or tracing.",
"name": "Hooks"
},
"migrations": {
"description": "Configure how to read and write data for an old and new system, determine which stage of a migration the application is in, execute the correct read and write calls for each stage.",
"name": "Migration flags"
},
"multiEnv": {
"description": "Evaluate flags from multiple environments using a single client instance",
"name": "Multiple environments"
},
"offlineMode": {
"description": "Close the SDK's connection to LaunchDarkly. Use cached or fallback values for each flag evaluation.",
"name": "Offline mode"
},
"otel": {
"description": "Add flag evaluation information to OpenTelemetry spans.",
"name": "OpenTelemetry"
},
"privateAttrs": {
"description": "Use context attribute values for targeting, but do not send them to LaunchDarkly.",
"name": "Private attributes"
},
"relayProxyDaemon": {
"description": "Configure the SDK to connect to a persistent store, such as the Relay Proxy's data store.",
"name": "Relay Proxy in daemon mode"
},
"relayProxyProxy": {
"description": "Configure the SDK to connect to alternate service endpoints, such as the Relay Proxy.",
"name": "Relay Proxy in proxy mode"
},
"secureMode": {
"description": "For clent-side SDKs, require a hash, signed with the SDK key for the LaunchDarkly environment, to evaluate flag variations. For server-side or edge SDKs, generate a secure mode hash.",
"name": "Secure mode"
},
"storingData": {
"description": "Configure an external database as a feature store. Persist flag data across application restarts.",
"name": "Storing data"
},
"testDataSource": {
"description": "Mock data of an SDK. Useful for unit tests; cannot be used in production.",
"name": "Test data sources"
},
"track": {
"description": "Record actions taken in your application as events. You can connect to these events to metrics for use in experiments.",
"name": "Sending custom events"
},
"variationDetail": {
"description": "Receive information about how a flag variation was calculated, for example, because it matched a specific targeting rule.",
"name": "Flag evaluation reasons"
},
"webProxy": {
"description": "Configure the SDK to connect to LaunchDarkly through a web proxy.",
"name": "Web proxy configuration"
}
}
9 changes: 9 additions & 0 deletions api/sdkmeta/data/features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"dotnet-server-sdk": {
"hooks": {
"deprecated": null,
"introduced": "8.3",
"removed": null
}
}
}
94 changes: 94 additions & 0 deletions products/feature_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"allFlags": {
"description": "Return the flag variations for all feature flags for a given context.",
"name": "Getting all flags"
},
"appMetadata": {
"description": "Specify application and application version information.",
"name": "Application metadata"
},
"autoEnvAttrs": {
"description": "Automatically include device and application data in each evaluated context.",
"name": "Automatic environment attributes"
},
"bigSegments": {
"description": "Configure a persistent store to hold segments that are either synced from external tools, or that contain an arbitrarily large number of contexts of any one context kind.",
"name": "Big segments"
},
"bootstrapping": {
"description": "Provide an initial set of flag values that are immediately available during client initialization.",
"name": "Bootstrapping"
},
"contexts": {
"description": "Evaluate flags based on contexts. A context is a generalized way of referring to the people, services, machines, or other resources that encounter feature flags. SDKs without this feature only support flag evaluation for users.",
"name": "Contexts and context kinds"
},
"experimentation": {
"description": "Connect a flag with one or more metrics to measure end-user behavior for different variations of a flag. Requires minimum SDK versions, but no SDK configuration.",
"name": "Experimentation"
},
"fileDataSource": {
"description": "Use flag values, specified in JSON or YAML files, for all flag evaluations. Useful for testing or prototyping; do not use in production.",
"name": "Reading flags from a file"
},
"flagChanges": {
"description": "Use a listener pattern to subscribe to flag change notifications.",
"name": "Subscribing to flag changes"
},
"hooks": {
"description": "Define callbacks that are executed by the SDK at various points of interest, usually for metrics or tracing.",
"name": "Hooks"
},
"migrations": {
"description": "Configure how to read and write data for an old and new system, determine which stage of a migration the application is in, execute the correct read and write calls for each stage.",
"name": "Migration flags"
},
"multiEnv": {
"description": "Evaluate flags from multiple environments using a single client instance",
"name": "Multiple environments"
},
"offlineMode": {
"description": "Close the SDK's connection to LaunchDarkly. Use cached or fallback values for each flag evaluation.",
"name": "Offline mode"
},
"otel": {
"description": "Add flag evaluation information to OpenTelemetry spans.",
"name": "OpenTelemetry"
},
"privateAttrs": {
"description": "Use context attribute values for targeting, but do not send them to LaunchDarkly.",
"name": "Private attributes"
},
"relayProxyDaemon": {
"description": "Configure the SDK to connect to a persistent store, such as the Relay Proxy's data store.",
"name": "Relay Proxy in daemon mode"
},
"relayProxyProxy": {
"description": "Configure the SDK to connect to alternate service endpoints, such as the Relay Proxy.",
"name": "Relay Proxy in proxy mode"
},
"secureMode": {
"description": "For clent-side SDKs, require a hash, signed with the SDK key for the LaunchDarkly environment, to evaluate flag variations. For server-side or edge SDKs, generate a secure mode hash.",
"name": "Secure mode"
},
"storingData": {
"description": "Configure an external database as a feature store. Persist flag data across application restarts.",
"name": "Storing data"
},
"testDataSource": {
"description": "Mock data of an SDK. Useful for unit tests; cannot be used in production.",
"name": "Test data sources"
},
"track": {
"description": "Record actions taken in your application as events. You can connect to these events to metrics for use in experiments.",
"name": "Sending custom events"
},
"variationDetail": {
"description": "Receive information about how a flag variation was calculated, for example, because it matched a specific targeting rule.",
"name": "Flag evaluation reasons"
},
"webProxy": {
"description": "Configure the SDK to connect to LaunchDarkly through a web proxy.",
"name": "Web proxy configuration"
}
}
9 changes: 9 additions & 0 deletions products/features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"dotnet-server-sdk": {
"hooks": {
"deprecated": null,
"introduced": "8.3",
"removed": null
}
}
}
19 changes: 19 additions & 0 deletions schemas/feature_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://launchdarkly.com/sdk-meta/feature_info.json",
"title": "SDK Feature Info",
"description": "Description of SDK features",
"type": "object",
"$defs": {
"SDKFeature" : {
"type": "object",
"description": "Description of an individual feature",
"required" : ["name", "description"]
}
},
"patternProperties" : {
"^[a-z-]+$" : {
"$ref" : "#/$defs/SDKFeature"
}
}
}
10 changes: 8 additions & 2 deletions schemas/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@
},
"deprecated": {
"description": "The version that the feature was deprecated",
"$ref": "#/$defs/SDKVersion"
"anyOf": [
{ "$ref": "#/$defs/SDKVersion" },
{ "type": "null" }
]
},
"removed": {
"description": "The version that the feature was removed",
"$ref": "#/$defs/SDKVersion"
"anyOf": [
{ "$ref": "#/$defs/SDKVersion" },
{ "type": "null" }
]
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/check-json-schemas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ runTest ./schemas/names.json ./products/names.json
runTest ./schemas/languages.json ./products/languages.json
runTest ./schemas/repos.json ./products/repos.json
runTest ./schemas/releases.json ./products/releases.json
runTest ./schemas/features.json ./products/features.json
runTest ./schemas/feature_info.json ./products/feature_info.json
6 changes: 6 additions & 0 deletions scripts/generate-products.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ sqlite3 -json metadata.sqlite3 "SELECT * from sdk_types;" |
sqlite3 -json metadata.sqlite3 "SELECT * from sdk_repos;" |
jq -S 'reduce .[] as $item ({}; .[$item.id] += {github: $item.github})' > products/repos.json

sqlite3 -json metadata.sqlite3 "SELECT * from sdk_features;" |
jq -S 'reduce .[] as $item ({}; .[$item.id] += {($item.feature): {introduced: $item.introduced, deprecated: $item.deprecated, removed: $item.removed}})' > products/features.json

sqlite3 -json metadata.sqlite3 "SELECT * from sdk_feature_info;" |
jq -S 'reduce .[] as $item ({}; .[$item.id] += {name: $item.name, description: $item.description})' > products/feature_info.json

./scripts/eols.sh metadata.sqlite3 |
jq -n 'reduce inputs[] as $input ({}; .[$input.id] += [$input | del(.id)])' > products/releases.json

Expand Down

0 comments on commit 452cb06

Please sign in to comment.