s***@cards-star.com
s***@cards-star.com
  • 发布:2023-02-08 17:25
  • 更新:2023-02-09 10:39
  • 阅读:478

uni统计Not Found the cofnig file

分类:uniCloud

操作步骤:
1.按照文档一键部署uni-admin
2.Hbuilder中,右键项目,创建uni cloud云开发环境
3.右键uniCloud,关联云服务或空间项目

目前两个项目uni-admin和APP项目在同一个空间下(space id: mp-49c47afc-c730-484f-983e-b607353d9f80),uni统计网页一直没有数据。
根据文档排查,uni-stat-receiver有请求日志,uni-stat-cron有执行日志,但是报错:

[uni-stat-cron/timer1675846806448-aa9fd585-a570-4eec-83e7-21328406d1b9/82ms/ERROR] Not found the config file  
[uni-stat-cron/timer1675846806448-aa9fd585-a570-4eec-83e7-21328406d1b9/83ms/ERROR] Not found the config file  
[uni-stat-cron/timer1675846806448-aa9fd585-a570-4eec-83e7-21328406d1b9/83ms/ERROR] Not found the config file  
[uni-stat-cron/timer1675846806448-aa9fd585-a570-4eec-83e7-21328406d1b9/84ms/ERROR] Not found the config file  
[uni-stat-cron/timer1675846806448-aa9fd585-a570-4eec-83e7-21328406d1b9/85ms/ERROR] Not found the config file  
[uni-stat-cron/timer1675846806448-aa9fd585-a570-4eec-83e7-21328406d1b9/85ms/DEBUG] Cron start time:  2023-02-08 17:00:06  
[uni-stat-cron/timer1675846806448-aa9fd585-a570-4eec-83e7-21328406d1b9/85ms/DEBUG] Cron end time:  2023-02-08 17:00:06  
请求响应状态: success

文档是这么说的

业务App 和 admin 是2个工程。业务App是采集端,admin是报表端;这两个项目均包含uni-config-center;如果这两个项目关联(复用)相同的服务空间时,很容易出现uni-config-center的互相覆盖问题;此时建议单点维护,方案有2种:  

以业务App为主:将uni-admin项目中uni-config-center 下面的uni-stat文件夹,复制到业务App项目下的uni-config-center目录下,然后重新上传业务App项目下的uni-config-center公共模块即可。  
以uni-admin为主:将业务App项目下的uni-config-center,手动合并配置项到uni-admin项目下的uni-config-center中(注意:是手动合并配置项,不要整体覆盖文件),然后重新上传uni-admin项目下的uni-config-center公共模块即可。

问题是,我是一键部署啊,没有uni-admin工程,按照文档变成要手动搞一遍了

2023-02-08 17:25 负责人:DCloud_云服务_JRP 分享
已邀请:
DCloud_云服务_JRP

DCloud_云服务_JRP

这个错误是因为配置文件找不到了,你在HBuilderX 中有覆盖上传公共模块吗?

  • s***@cards-star.com (作者)

    没有,我的操作只有uni-admin一键部署,以及项目APP创建uni cloud云开发环境,并关联到同一个服务空间去


    请问如果我现在重新一键部署uni-admin能够修复吗

    2023-02-09 08:46

s***@cards-star.com

s***@cards-star.com (作者)

我尝试过新建uni-admin项目,将uni-stat拷贝到APP项目,APP项目uniCloud\cloudfunctions\common\uni-config-center\uni-stat\config.json下是如下内容

{  
    "debug": false,  
    "redis": false,  
    "cachetime": 604800,  
    "sessionExpireTime": 1800,  
    "realtimeStat": true,  
    "cronMin": false,  
    "cron": [  
        {  
            "type": "stat",  
            "time": "* * * 0"  
        },  
        {  
            "type": "stat",  
            "time": "* * 1 10"  
        },  
        {  
            "type": "stat",  
            "time": "1 * 1 20"  
        },  
        {  
            "type": "stat",  
            "time": "* 1 3 30"  
        },  
        {  
            "type": "active-device",  
            "time": "* * 0 10"  
        },  
        {  
            "type": "active-user",  
            "time": "* * 0 20"  
        },  
        {  
            "type": "page",  
            "time": "* * 3 20"  
        },  
        {  
            "type": "event",  
            "time": "* * 4 20"  
        },  
        {  
            "type": "error",  
            "time": "* * 5 20"  
        },  
        {  
            "type": "loyalty",  
            "time": "* * 6 20"  
        },  
        {  
            "type": "clean",  
            "time": "* * 5 30"  
        },  
        {  
            "type": "retention-device",  
            "time": "* * 2 20"  
        },  
        {  
            "type": "retention-device",  
            "time": "* 1 4 30"  
        },  
        {  
            "type": "retention-device",  
            "time": "1 * 2 30"  
        },  
        {  
            "type": "retention-user",  
            "time": "* * 3 40"  
        },  
        {  
            "type": "retention-user",  
            "time": "* 1 5 40"  
        },  
        {  
            "type": "retention-user",  
            "time": "1 * 6 30"  
        },  
        {  
            "type": "pay-result",  
            "time": "* * * 10",  
            "dimension": "hour",  
            "description": "每小时执行统计(会自动统计小时、天、周、月、季度、年度)",  
            "timely": true  
        }  
    ],  
    "batchInsertNum": 5000,  
    "errorCheck": {  
        "needCheck": true,  
        "checkTime": 5  
    },  
    "cleanLog": {  
        "open": true,  
        "reserveDays": {  
            "sessionLog": 31,  
            "userSessionLog": 31,  
            "pageLog": 7,  
            "eventLog": 7,  
            "shareLog": 7,  
            "errorLog": 7  
        }  
    }  
}  

上传公共模块后,uni-stat-cron还是同样报错无法跑起来。

  • DCloud_云服务_JRP

    我看你最近的请求没有报错了,是重新部署了吗?

    2023-02-09 10:18

s***@cards-star.com

s***@cards-star.com (作者)

是的,我重新手动按照文档部署了一遍uni-admin,uni-stat-cron日志如下

[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/2ms/DEBUG] Cron start time:  2023-02-09 10:32:00  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/2ms/DEBUG] stat--hour run  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/148ms/DEBUG] pay-result--hour run  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/149ms/DEBUG] -----------------支付统计开始(hour)-----------------  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/149ms/DEBUG] 本次统计时间: 2023-02-09 10:00:00 - 2023-02-09 10:59:59  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/149ms/DEBUG] 本次统计参数: type:hour date:1675909920711 reset:undefined  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/349ms/DEBUG] 耗时:0.201 秒  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/349ms/DEBUG] 本次共添加:0 条记录  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/349ms/DEBUG] -----------------支付统计结束(hour)-----------------  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/349ms/DEBUG] -----------------支付统计开始(day)-----------------  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/349ms/DEBUG] 本次统计时间: 2023-02-09 00:00:00 - 2023-02-09 23:59:59  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/349ms/DEBUG] 本次统计参数: type:day date:1675906320711 reset:true  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/404ms/DEBUG] Delete old data result: 0  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/545ms/DEBUG] 耗时:0.196 秒  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/545ms/DEBUG] 本次共添加:0 条记录  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/545ms/DEBUG] -----------------支付统计结束(day)-----------------  
[uni-stat-cron/timer1675909920563-6b8d1e1f-a70f-47ca-937a-3b20650e88d2/545ms/DEBUG] Cron end time:  2023-02-09 10:32:01  
请求响应状态: success  

这算成功了吗?在这个定时统计之前,我的APP是有统计请求的,uni-stat-receiver也有收到请求的日志,但是我看统计后台,今日的数据并没有,这个是明天才能看到今天的数据?

s***@cards-star.com

s***@cards-star.com (作者)

我的统计后台-- 应用管理里,已经添加了需要被统计的APP: UNIA28431B

筛选数据UNIA28431B并没有今天的任何数据

  • DCloud_云服务_JRP

    隔一个小时后再看看有没有,实时数据都是每小时统计一次,10点的数据到11点多才会统计

    2023-02-09 10:44

  • s***@cards-star.com (作者)

    回复 DCloud_云服务_JRP: 谢谢,解决了,uni-stat-cron有个定时周期,而统计指标自己也有个定时周期

    2023-02-09 11:08

  • DCloud_云服务_JRP

    回复 s***@cards-star.com: 是的,云函数的触发器是用来规定uni-stat-cron的触发时间点的,而配置文件中的周期是用来分发具体任务的

    2023-02-09 11:46

惊天

惊天 - uni 开发

你还在为工作中遇到不懂的地方没人解答而烦恼吗,快加入程序员家园- QQ频道吧 这里是大神的聚集地,也是萌新的福地,频道建设中,大家多多支持
点击链接加入QQ频道【程序员家园-技术交流】:https://pd.qq.com/s/261hcfskd

要回复问题请先登录注册