小编Kim*_*Kim的帖子

Stackdriver execution_id和自定义标签

我正在使用Google Cloud Functions和模块@ google-cloud/logging-winston.

我的第一个问题是使用此模块属性

labels: {
  execution_id: "idHere"
}
Run Code Online (Sandbox Code Playgroud)

不在Stackdriver日志中,就像我使用常规console.log(''); 是否可以将execution_id恢复到日志中?

此外,我可以向日志添加自定义标签,例如用户ID.我正在尝试使我的日志记录过程更容易,因此我可以通过execution_id查看每个API端点请求的流程,并且还能够通过添加用户ID标签查看特定用户的所有日志.

我当前的日志代码是

'use strict'

import * as winston from 'winston';
const Logger = winston.Logger;
const Console = winston.transports.Console;

import { LoggingWinston } from '@google-cloud/logging-winston'
const loggingWinston = new LoggingWinston();

const logger = new Logger({
    level: 'debug', // log at 'debug' and above
    transports: [
        // Log to the console
        new Console(),
        // And log to Stackdriver Logging
        loggingWinston,
    ],
});

function formatMessage(message) {
    return message;
};

export const …
Run Code Online (Sandbox Code Playgroud)

logging google-cloud-platform google-cloud-functions stackdriver

9
推荐指数
1
解决办法
364
查看次数

使用默认tslint.json的Firebase类型和无隐式依赖项

阅读最新的Firebase博客文章为什么你应该使用TypeScript编写云函数,我决定尝试tslint它,这很神奇,虽然我的类型有问题.

我有一个import语句

import { DocumentSnapshot, DocumentReference, QuerySnapshot, WriteResult, Transaction, WriteBatch } from '@google-cloud/firestore';
Run Code Online (Sandbox Code Playgroud)

但即使我的代码工作正常,tslint告诉我以下内容.

[tslint]模块'@ google-cloud/firestore'未在package.json中列为依赖项(no-implicit-dependencies)

Firebase + TypeScript使用/导入类型的最佳做法是什么?

firebase typescript tslint google-cloud-firestore

4
推荐指数
2
解决办法
2248
查看次数

使用条件[class]将类添加到现有类中

我正在使用离子离子图标

<ion-icon name="checkmark" [class]="condition ? 'class1' : ''"></ion-icon>

如果条件为true,我想添加一个额外的类,但如果条件为false,则不要添加该额外的类。

问题是,如果条件为假,它将从Ionic Framework中删除图标上的所有预定义类。

ionic-framework angular

2
推荐指数
1
解决办法
1710
查看次数

爆炸式索引和 Unix 时间戳

我的每个实体都由许多单值属性和一个数组组成。

在每个实体中都有一个 unix 纪元时间戳和一个用户 ID。

我的问题是我希望能够进行这种查询

SELECT * FROM <kind> WHERE time >= value AND time <= value and userId = value

问题是我必须创建一个复合索引,但我也阅读了有关爆炸索引和存储空间的内容,但我不太明白。

有人可以向我解释一下,如果创建这样的复合索引是“爆炸式索引”,以及查询是否良好。

google-app-engine google-cloud-datastore google-cloud-platform

2
推荐指数
1
解决办法
331
查看次数