Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fa24d29
Cria configuração de e-mail para coleção (será substituída no futuro …
May 10, 2024
78c1261
Cria referência temporal para a datetime representada por "two days a…
May 10, 2024
c8c08b8
Cria exceção para reportar situação em que apenas uma configuração at…
May 10, 2024
e90fea8
Cria filtro para obter arquivos de log de uma certa data, válidos
May 10, 2024
235e54b
Cria task que envia mensagem de email (para notificar ausência de logs)
May 10, 2024
2aaa254
Cria task que observa aruqivos de log faltantes e notifica e-mail (a …
May 10, 2024
1831783
Troca URL padrão de configuração local para 0.0.0.0
rafaelpezzuto May 24, 2024
9478ce1
Cria utilitário para obter um range de datas
rafaelpezzuto May 25, 2024
e390a4a
Substitui método que obtém data a partir de string por método numérico
rafaelpezzuto May 25, 2024
277a1e9
Adiciona método de classe para obter num de arquivos requeridos
rafaelpezzuto May 25, 2024
211a206
Adiciona método de classe para obter num de arquivos existentes
rafaelpezzuto May 25, 2024
6f61b0e
Cria modelo para acomodar relatório de arquivos faltantes
rafaelpezzuto May 25, 2024
73998b6
Corrige importações
rafaelpezzuto May 25, 2024
fe74e3f
Limpa choices e adiciona dados para novo modelo que armazena relatóri
rafaelpezzuto May 25, 2024
512fe2a
Substitui task para gerar relatórios de logs por 3 tasks menores
rafaelpezzuto May 25, 2024
5053f61
Cria modelo snippet para relatório de logs faltantes
rafaelpezzuto May 25, 2024
aa82517
Remove import desnecessário
rafaelpezzuto May 25, 2024
0469776
Merge branch 'scieloorg:main' into impl/report-missing-dates
pitangainnovare Jun 1, 2024
92eceea
Substitui termos existing e required por found e expected, respectiva…
rafaelpezzuto Jun 17, 2024
4501c20
Melhora comparações em contagem de arquivos existentes, extras e ok
rafaelpezzuto Jun 17, 2024
3ce8410
Marca mensagens para tradução (em disparo de exceções)
rafaelpezzuto Jun 17, 2024
13e1ccd
Cria property para retornar lista de acron2 e a utiliza em task
rafaelpezzuto Jun 17, 2024
fba9583
Renomeia outras variáveis com os termos required e existing
rafaelpezzuto Jun 17, 2024
3015aa1
Configura send para usar variável de ambiente de email da aplicação (…
rafaelpezzuto Jun 17, 2024
ff37340
Apresenta acron2 em listagem de coleções
rafaelpezzuto Jun 17, 2024
8e28675
Altera termo Core para Usage em template
rafaelpezzuto Jun 17, 2024
46e5da2
Corrige método que obtém número de arquivos exigidos para uma data. U…
rafaelpezzuto Jun 17, 2024
c6f5718
Marca outros termos para tradução
rafaelpezzuto Jun 17, 2024
941c8a8
Renomia outro termo existing para found
rafaelpezzuto Jun 17, 2024
3f2d57b
Altera ordem de menu para acomodar nova app metrics
pitangainnovare Jun 26, 2024
e926938
Importa app metrics em settings, inclui configurações básicas e ajust…
pitangainnovare Jun 26, 2024
3b456c6
Altera local de índice relacionado à app log_manager
pitangainnovare Jun 26, 2024
8712a58
Cria índice para app metrics
pitangainnovare Jun 26, 2024
064ce95
Remove atributo desnecessário em modelos log_manager
pitangainnovare Jun 26, 2024
b2bc593
Corrige template para povoar campo txt em schema Solr de log_manager
pitangainnovare Jun 26, 2024
cd67f5b
Adiciona estrutura básica de app metrics
pitangainnovare Jun 26, 2024
24701ca
Adiciona modelo para acomodar Top100Articles acessados
pitangainnovare Jun 26, 2024
8e175c6
Adiciona utilitário para carregar dados de arquivos extraídos do Matomo
pitangainnovare Jun 26, 2024
0cb32ef
Adiciona arquivo views.py
pitangainnovare Jun 26, 2024
6d2b8e6
Adiciona wagtailhooks
pitangainnovare Jun 26, 2024
e772c79
Cria arquivo search_indexes.py para aplicação metrics
pitangainnovare Jun 26, 2024
fe793c3
Cria template para povoar campo txt de Top100ArticlesIndex
pitangainnovare Jun 26, 2024
b7f4179
Adiciona índice Top100ArticlesIndex
pitangainnovare Jun 26, 2024
a061d76
Adiciona task para fazer carga de modelo Top100Articles a partir de csv
pitangainnovare Jun 26, 2024
2ff5fc1
Atualiza gitignore com pasta de dados de logs solr
pitangainnovare Jun 26, 2024
ac8006d
Corrige import
pitangainnovare Jun 26, 2024
7d0c401
Recupera arquivo perdido models.py com Top100Articles
pitangainnovare Jun 26, 2024
dfc76ae
Corrige imports quebrados
pitangainnovare Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Solr
index/usage/data
index/data/usage/data/
index/data/log_manager/data
index/data/metrics/data
index/logs

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
4 changes: 4 additions & 0 deletions collection/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,7 @@ def create_or_update(
@property
def name(self):
return CollectionName.objects.filter(collection=self).iterator()

@property
def acron2_list(self):
return [col.acron2 for col in Collection.objects.iterator()]
1 change: 1 addition & 0 deletions collection/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class CollectionSnippetViewSet(SnippetViewSet):
list_display = (
"main_name",
"acron3",
"acron2",
"code",
"status",
"collection_type",
Expand Down
7 changes: 4 additions & 3 deletions config/menu.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
WAGTAIL_MENU_APPS_ORDER = {
"collection": 100,
"log_manager": 200,
"tasks": 300,
"unexpected-error": 400,
"metrics": 200,
"log_manager": 300,
"tasks": 400,
"unexpected-error": 500,
}

def get_menu_order(app_name):
Expand Down
29 changes: 22 additions & 7 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"collection",
"core",
"log_manager",
"metrics",
"tracker",
]

Expand Down Expand Up @@ -403,7 +404,21 @@
HAYSTACK_CONNECTIONS = {
"default": {
"ENGINE": "haystack.backends.solr_backend.SolrEngine",
"URL": "%s%s" % (env("SOLR_URL", default="http://solr:8983/solr/"), "usage"),
"URL": "%s%s" % (env("SOLR_URL", default="http://solr:8983/solr/"), "metrics"),
"ADMIN_URL": "http://solr:8983/solr/admin/cores",
"SILENTLY_FAIL": False,
"SOLR_TIMEOUT": 10,
},
"metrics": {
"ENGINE": "haystack.backends.solr_backend.SolrEngine",
"URL": "%s%s" % (env("SOLR_URL", default="http://solr:8983/solr/"), "metrics"),
"ADMIN_URL": "http://solr:8983/solr/admin/cores",
"SILENTLY_FAIL": False,
"SOLR_TIMEOUT": 10,
},
"log_manager": {
"ENGINE": "haystack.backends.solr_backend.SolrEngine",
"URL": "%s%s" % (env("SOLR_URL", default="http://solr:8983/solr/"), "log_manager"),
"ADMIN_URL": "http://solr:8983/solr/admin/cores",
"SILENTLY_FAIL": False,
"SOLR_TIMEOUT": 10,
Expand All @@ -421,10 +436,10 @@

SEARCH_PAGINATION_ITEMS_PER_PAGE = 10

SEARCH_FACET_ITEMS_PER_MORE = 5
# SEARCH_FACET_ITEMS_PER_MORE = 5

SEARCH_FACET_LIST = [
"server_time",
"action_name",
"browser_name",
]
# SEARCH_FACET_LIST = [
# "server_time",
# "action_name",
# "browser_name",
# ]
4 changes: 3 additions & 1 deletion config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
EMAIL_HOST = env("EMAIL_HOST", default="mailhog")
# https://docs.djangoproject.com/en/dev/ref/settings/#email-port
EMAIL_PORT = 1025
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host-user
EMAIL_HOST_USER = env.str("DJANGO_EMAIL_HOST_USER", default="dev@scielo.org")

# ADMIN
# ------------------------------------------------------------------------------
# https://docs.wagtail.org/en/stable/reference/settings.html#wagtailadmin-base-url
WAGTAILADMIN_BASE_URL = 'https://usage.scielo.org'
WAGTAILADMIN_BASE_URL = 'http://0.0.0.0:8009'

# WhiteNoise
# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion core/templates/wagtailadmin/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

{% else %}

SciELO Core
SciELO Usage

{% endif %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="congre" version="1.5">
<schema name="log_manager" version="1.5">

<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
Expand Down
6 changes: 6 additions & 0 deletions index/data/log_manager/core.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Written by CorePropertiesLocator
#Fri Mar 29 13:50:09 UTC 2024
schema=schema.xml
dataDir=data
name=log_manager
config=solrconfig.xml
108 changes: 108 additions & 0 deletions index/data/metrics/conf/schema.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="metrics" version="1.5">

<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />

<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>

<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>

<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>

<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>

<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>

<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>

<fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>

<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>

<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>

<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>

<fieldtype name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>

<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldtype>

<fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>

<fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" />
</types>

<fields>
<field name="_version_" type="long" indexed="true" stored="true"/>

<!-- id unique field -->
<field name="id" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- default search -->
<field name="text" type="text" indexed="true" stored="true"/>
<field name="tw" type="text" indexed="true" stored="false" multiValued="true"/>

<!-- haystack -->
<field name="django_ct" type="string" indexed="true" stored="true" multiValued="false"/>
<field name="django_id" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- type of solr document: top100articles, tr_j1, tr_j4, ir_a1, ir_a4, gr_j1, gr_j4, lr_j1, lr_j4, cr_j1 -->
<fieldn name="metric_scope" type="string" index="true" stored="true" multiValued="false"/>

<!-- COUNTER R5 metrics -->
<field name="total_item_requests" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="total_item_investigations" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="unique_item_requests" type="int" indexed="true" stored="true" multiValued="false"/>
<field name="unique_item_investigations" type="int" indexed="true" stored="true" multiValued="false"/>

<!-- date of access -->
<field name="year_month_day" type="date" indexed="true" stored="true" multiValued="false"/>

<!-- country of origin of access -->
<field name="country" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- language of the accessed document -->
<field name="document_language" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- collection -->
<field name="collection" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- journal -->
<field name="key_issn" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- document identifier -->
<field name="pid" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- year of publication -->
<field name="yop" type="string" indexed="true" stored="true" multiValued="false"/>

<field name="priority" type="string" indexed="true" stored="true" multiValued="false"/>

<!-- dynamic field definitions -->
<dynamicField name="*" type="text" indexed="true" stored="true" multiValued="false"/>

</fields>

<uniqueKey>id</uniqueKey>
<copyField source="text" dest="tw"/>
<copyField source="*" dest="tw"/>

</schema>
98 changes: 98 additions & 0 deletions index/data/metrics/conf/solrconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
~ Copyright (c) 2013-2022. LA Referencia / Red CLARA and others
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
~
~ This file is part of LA Referencia software platform LRHarvester v4.x
~ For any further information please contact Lautaro Matas <lmatas@gmail.com>
-->

<!--
This is a stripped down config file used for a simple example...
It is *not* a good example to work from.
-->
<config>
<luceneMatchVersion>LUCENE_42</luceneMatchVersion>
<!-- The DirectoryFactory to use for indexes.
solr.StandardDirectoryFactory, the default, is filesystem based.
solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. -->
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>

<dataDir>${solr.core0.data.dir:}</dataDir>

<!-- To enable dynamic schema REST APIs, use the following for <schemaFactory>:

<schemaFactory class="ManagedIndexSchemaFactory">
<bool name="mutable">true</bool>
<str name="managedSchemaResourceName">managed-schema</str>
</schemaFactory>

When ManagedIndexSchemaFactory is specified, Solr will load the schema from
he resource named in 'managedSchemaResourceName', rather than from schema.xml.
Note that the managed schema resource CANNOT be named schema.xml. If the managed
schema does not exist, Solr will create it after reading schema.xml, then rename
'schema.xml' to 'schema.xml.bak'.

Do NOT hand edit the managed schema - external modifications will be ignored and
overwritten as a result of schema modification REST API calls.

When ManagedIndexSchemaFactory is specified with mutable = true, schema
modification REST API calls will be allowed; otherwise, error responses will be
sent back for these requests.
-->
<schemaFactory class="ClassicIndexSchemaFactory"/>

<updateHandler class="solr.DirectUpdateHandler2">
<updateLog>
<str name="dir">${solr.core0.data.dir:}</str>
</updateLog>
</updateHandler>

<!-- realtime get handler, guaranteed to return the latest stored fields
of any document, without the need to commit or open a new searcher. The current
implementation relies on the updateLog feature being enabled. -->
<requestHandler name="/get" class="solr.RealTimeGetHandler">
<lst name="defaults">
<str name="omitHeader">true</str>
</lst>
</requestHandler>

<requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />

<requestDispatcher handleSelect="true" >
<requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" formdataUploadLimitInKB="2048" />
</requestDispatcher>

<requestHandler name="standard" class="solr.StandardRequestHandler" default="true" />
<requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
<requestHandler name="/update" class="solr.UpdateRequestHandler" />

<requestHandler name="/admin/ping" class="solr.PingRequestHandler">
<lst name="invariants">
<str name="q">solrpingquery</str>
</lst>
<lst name="defaults">
<str name="echoParams">all</str>
</lst>
</requestHandler>

<!-- config for the admin interface -->
<admin>
<defaultQuery>solr</defaultQuery>
</admin>

</config>

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
#Fri Mar 29 13:50:09 UTC 2024
schema=schema.xml
dataDir=data
name=usage
name=metrics
config=solrconfig.xml
8 changes: 4 additions & 4 deletions local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
- solr
volumes:
- .:/app:z
- ../scms_data/usage/log_manager:/data
- ../scms_data/usage/data:/data
env_file:
- ./.envs/.local/.django
- ./.envs/.local/.postgres
Expand Down Expand Up @@ -60,7 +60,7 @@ services:
env_file:
- ./.envs/.local/.minio
volumes:
- ../scms_data/usage/minio:/data
- ../scms_data/minio:/data
command: server --console-address ":9001" /data

postgres:
Expand All @@ -70,8 +70,8 @@ services:
image: scielo_usage_local_postgres
container_name: scielo_usage_local_postgres
volumes:
- ../scms_data/usage/postgresql:/var/lib/postgresql/data:Z
- ../scms_data/usage/postgresql_backup:/backups:z
- ../scms_data/postgresql:/var/lib/postgresql/data:Z
- ../scms_data/postgresql_backup:/backups:z
ports:
- "5439:5432"
env_file:
Expand Down
Loading