<commit_before>= Application environments
<NAME> <<EMAIL>>
:version: v0.1
:modified: 2021-04-14
:status: DRAFT
:toc:

<<<
== Document Info

|===
| Attribute | Value

| Status
| {status} {version} ({modified})

| Target Version
| 1.32

| Lead
| <NAME>
|===

<<<

== Overview

Desire to tag multiple servers and databases to show they belong to a specific environment on an application.

e.g. sever-1, server-2 and database-1 all belong to 'UAT'.


How is this different from the environment field on server_usage/database_information?

* Can give custom/multiple environment names = e.g. 'INT-1', 'INT-2'.
* Can show that servers/databases on used by other applications are a key part of the application environment


Changes:

* Need to be able to create/update/delete environment tags (app specific?)
* Need to be able to link this environment tag to servers and databases (even those not directly used by the application)
* Need screen to show databases and servers linked to an environment


Using existing tags:

* Currently, tags belong to an entityKind - for example 'APPLICATION' which indicates the entity it can be
applied to - wouldn't allow tags to be shared between databases and servers
** wouldn't link back to a specific application
** feels like we need something more like an app group but where the group belongs to a specific app and
you can add any servers or databases to be linked to it




<<<
== Proposal

=== Core Waltz changes

Environment tags will be linked to database_information table and server_usage table? Server information table doesn't give the
app-server information - one server information record can be linked to many apps?

If we're using server_usage though it will need an id...

Although think UAT and Dev2 same server... could just apply two tags to same server?
But say that server was also used by another app... does that matter... surely we want to link the
specific app server to show what is part of the env?

- Could offer warnings where an environment is constructed with servers both from dev and from prod?

Possible tables:

.app_environment_tag:
|===
| id | application_id | name | description | external_id

| 1
| 12345
| INT-1
| Second development environment without nightly database restore
| WALTZ_INT
|===


.app_environment_tag_usage:

|===
|tag_id|entity_id|entity_kind|created_at|created_by|provenance

|1
|678
|DATABASE
|2021-04-14
|admin
|waltz

|1
|91011
|SERVER
|2021-04-14
|admin
|waltz

|1
|121314
|SERVER<commit_msg>- Doc on env<commit_after>= Application environments
<NAME> <<EMAIL>>
:version: v0.1
:modified: 2021-04-14
:status: DRAFT
:toc:

<<<
== Document Info

|===
| Attribute | Value

| Status
| {status} {version} ({modified})

| Target Version
| 1.32

| Lead
| <NAME>
|===

<<<

== Overview

Desire to tag multiple servers and databases to show they belong to a specific environment on an application.

e.g. sever-1, server-2 and database-1 all belong to 'UAT'.


How is this different from the environment field on server_usage/database_information?

* Can give custom/multiple environment names = e.g. 'INT-1', 'INT-2'.
* Can show that servers/databases on used by other applications are a key part of the application environment
* For user organisation rather than from authoritative system

Changes:

* Need to be able to create/update/delete environment tags (app specific?)
* Need to be able to link this environment tag to servers and databases (even those not directly used by the application)
* Need screen to show databases and servers linked to an environment


Using existing tags:

* Currently, tags belong to an entityKind - for example 'APPLICATION' which indicates the entity it can be
applied to - wouldn't allow tags to be shared between databases and servers
** wouldn't link back to a specific application
** feels like we need something more like an app group but where the group belongs to a specific app and
you can add any servers or databases to be linked to it




<<<
== Proposal

=== Core Waltz changes

Environment tags will be linked to database_information table and server_usage table? Server information table doesn't give the
app-server information - one server information record can be linked to many apps?

If we're using server_usage though it will need an id...

[NOTE]
====
If a server is used by multiple apps (hundreds sometimes), we want to show which usage on that
server is important to the environment we are focused on.
====

- Could offer warnings where an environment is constructed with servers both from dev and from prod?
- Could use owning entity to suggest likely environment tags you might want (from other usages)

Possible tables:

.custom_environment:
|===
| id | owning_entity_id | owning_entity_kind | name | description | external_id

| 1
| 12345
| APPLICATION
| INT-1
| Second development environment without nightly database restore
| WALTZ_INT
|===


.custom_environment_usage:

|===
| custom_environment_id | entity_id | entity_kind | created_at | created_by | provenance

|1
|678
|DATABASE
|2021-04-14
|admin
|waltz

|1
|91011
|SERVER
|2021-04-14
|admin
|waltz

|1
|121314
|SERVER
{'fraction_non_alphanumeric': 0.07680311890838207, 'fraction_numerical': 0.02280701754385965, 'mean_word_length': 4.395373291272345, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7586014', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1416, 'n_words': 698}