小编Dav*_*New的帖子

请求遥测 - "durationMetric"?

从Blob存储解析导出的Application Insights遥测时,请求数据如下所示:

{
  "request": [
    {
      "id": "3Pc0MZMBJgQ=",
      "name": "POST Blah",
      "count": 6,
      "responseCode": 201,
      "success": true,
      "url": "https://example.com/api/blah",
      "durationMetric": {
        "value": 66359508.0,
        "count": 6.0,
        "min": 11059918.0,
        "max": 11059918.0,
        "stdDev": 0.0,
        "sampledValue": 11059918.0
      },
      ...
    }
  ],
  ...
}
Run Code Online (Sandbox Code Playgroud)

我正在寻找请求的持续时间,但我看到我被提供了一个durationMetric对象.

根据文档,request[0].durationMetric.value领域被描述为

从请求到达响应的时间.1e7 == 1s

但是,如果我使用Google Analytics查询,则该值与此字段不匹配:

在此输入图像描述

他们这样做,但是,匹配的min,maxsampledValue领域.

我应该使用哪个字段?"value": 66359508.0在上面的例子中,这个值代表什么?

azure azure-application-insights

7
推荐指数
1
解决办法
206
查看次数

发行人更改后,Kubernetes证书经理不更新证书

我使用cert-manager 0.5.2在我们的Kubernetes集群上管理Let的加密证书.

我使用的是Let's Encrypt暂存环境,但现在已经开始使用他们的生产证书了.问题是我的应用程序没有更新到新的有效证书.

在更新发行者,证书和入口资源时,我必须搞砸了一些东西,但我看不清楚是什么.我还重新安装了NGINX入口控制器和证书管理器,并重新创建了我的应用程序,但我仍然获得旧证书.我接下来该怎么办?

描述letsencrypt集群发行者:

Name:         letsencrypt
Namespace:
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"certmanager.k8s.io/v1alpha1","kind":"ClusterIssuer","metadata":{"annotations":{},"name":"letsencrypt","namespace":""},"spec":{"acme":{"e...
API Version:  certmanager.k8s.io/v1alpha1
Kind:         ClusterIssuer
Metadata:
  Cluster Name:
  Creation Timestamp:  2019-01-04T09:27:49Z
  Generation:          0
  Resource Version:    130088
  Self Link:           /apis/certmanager.k8s.io/v1alpha1/letsencrypt
  UID:                 00f0ea0f-1003-11e9-997f-ssh3b4bcc625
Spec:
  Acme:
    Email:  administrator@domain.com
    Http 01:
    Private Key Secret Ref:
      Key:
      Name:  letsencrypt
    Server:  https://acme-v02.api.letsencrypt.org/directory
Status:
  Acme:
    Uri:  https://acme-v02.api.letsencrypt.org/acme/acct/48899673
  Conditions:
    Last Transition Time:  2019-01-04T09:28:33Z
    Message:               The ACME account was registered with the ACME server
    Reason:                ACMEAccountRegistered
    Status:                True
    Type:                  Ready
Events:                    <none> …
Run Code Online (Sandbox Code Playgroud)

azure kubernetes azure-kubernetes azure-aks cert-manager

7
推荐指数
1
解决办法
1448
查看次数

从特定线程调用方法

我怎么能onCompleteCallBackSomeAsyncMethod被调用的同一个线程上调用该方法?

public void SomeAsycMethod ( Action<object> onCompleteCallBack )
{
    // get the current thread 
    /* var ThisThread = Thread.CurrentThread. */

    Task.Factory.StartNew( () =>
    {
        Thread.Sleep( 1000 );// do some work;

        // lastly call the onCompleteCallBack on 'ThisThread'
        onCompleteCallBack( "some result" );

        // I am looking for something like:
        /* ThisThread.Invoke("some result"); */
    });
}
Run Code Online (Sandbox Code Playgroud)

c# multithreading task-parallel-library

6
推荐指数
1
解决办法
2721
查看次数

一般的TryParse Nullable类型

我已经写了重载的静态TryParse方法如下Nullable类型:int?,short?,long?,double?,DateTime?,decimal?,float?,bool?,byte?char?.以下是一些实现:

protected static bool TryParse(string input, out int? value)
{
    int outValue;
    bool result = Int32.TryParse(input, out outValue);
    value = outValue;
    return result;
}

protected static bool TryParse(string input, out short? value)
{
    short outValue;
    bool result = Int16.TryParse(input, out outValue);
    value = outValue;
    return result;
}

protected static bool TryParse(string input, out long? value)
{ …
Run Code Online (Sandbox Code Playgroud)

.net c# generics parsing type-conversion

6
推荐指数
2
解决办法
8483
查看次数

管理用户项目权限

我刚刚创建了一个Visual Studio Online帐户并添加了一个新用户.

如何管理该用户的项目权限?

以管理员身份登录时,我浏览了每个可用页面,但找不到任何内容.我唯一能做的就是将用户添加为新项目的成员.

添加了新用户:

在此输入图像描述

添加用户作为新项目的成员:

在此输入图像描述

缺少权限的示例:

在此输入图像描述

tfs visual-studio-2013 azure-devops

6
推荐指数
1
解决办法
4603
查看次数

Unity:隐式ResolvedParameter用于未命名的注册

UserService构造函数有两个参数,一个是IUnitOfWorkIUserRepository:

public UserService(IUnitOfWork unitofWork, IUserRepository userRepository) 
{ ... }
Run Code Online (Sandbox Code Playgroud)

我使用命名注册来区分多个实例IUnitOfWork,因此在UserService使用Unity容器注册时,我需要使用以下命令显式指定参数InjectionConstructor:

container.RegisterType<IUserService, UserService>(
    new InjectionConstructor(
        new ResolvedParameter<IUnitOfWork>("someContext"),
        new ResolvedParameter<IUserRepository>()
    )
);
Run Code Online (Sandbox Code Playgroud)

有可能new ResolvedParameter<IUserRepository>()被省略吗?我希望Unity隐式推导出这个参数,因为不需要命名注册. 代码如下所示:

container.RegisterType<IUserService, UserService>(
    new InjectionConstructor(
        new ResolvedParameter<IUnitOfWork>("someContext")
    )
);
Run Code Online (Sandbox Code Playgroud)

当我不需要使用时,这将完成InjectionConstructor.

dependency-injection ioc-container inversion-of-control unity-container onion-architecture

6
推荐指数
1
解决办法
894
查看次数

AsParallel()按顺序执行

我有以下PLINQ查询:

// Let's get a few customers
List<Customer> customers = CustomerRepository.GetSomeCustomers();

// Let's get all of the items for all of these customers
List<CustomerItem> items = customers
    .AsParallel()
    .SelectMany(x => ItemRepository.GetItemsByCustomer(x))
    .ToList();
Run Code Online (Sandbox Code Playgroud)

我期望GetItemsByCustomer()为每个客户并行执行,但它会按顺序运行.

我试图强迫并行,但仍然没有运气:

List<CustomerItem> items = customers
    .AsParallel()
    .WithExecutionMode(ParallelExecutionMode.ForceParallelism)
    .SelectMany(x => ItemRepository.GetItemsByCustomer(x))
    .ToList();
Run Code Online (Sandbox Code Playgroud)

方法签名:

private IEnumerable<Item> GetItemsByCustomer(Customer customer)
{
    // Get all items for a customer...
}
Run Code Online (Sandbox Code Playgroud)

根据这篇文章,PLINQ当然可以采用顺序路由,如果它认为合适,但强制并行应该仍然覆盖它.

注意:以上示例纯粹是说明性的 - 假设customers是一个小列表并且GetItemsByCustomer是一种昂贵的方法.

.net c# linq plinq task-parallel-library

6
推荐指数
1
解决办法
1970
查看次数

VSO和单个产品团队的多个项目

我们有一个由大约10名开发人员组成的团队致力于开发新产品.

我们已将此产品拆分为Visual Studio Online上的两个团队项目.开发人员可以在任何一个sprint中处理这两个项目.虽然我们有两个团队项目,但整个团队作为一个敏捷单元一起工作.

我们为什么这样做?

  • 我们想要单独的产品积压
  • 每个项目都有自己的产品负责人

但这导致了两个问题:

  • 我们有两个烧伤,这可能使跟踪团队进度变得困难.
  • 我们必须在两个项目之间分配个人的能力,这在Sprint Planning中并不容易,并且很难跟踪个人进度.

我觉得这可能是一个常见的问题.有人有经验吗?有什么建议?

agile tfs scrum tfs2013 azure-devops

6
推荐指数
1
解决办法
2854
查看次数

在VSO的Host Agent Pool上缓存NuGet包

当在VSO的新主机代理池中运行构建时,我有一个powershell脚本来恢复每个project.json使用的NuGet包dnu restore.

此过程可能需要2分钟以上.

难道不能以某种方式在代理上缓存这些包吗?如果我们拥有自己的自定义代理,这是否可能?

tfs nuget-package-restore dnu azure-devops

6
推荐指数
1
解决办法
1298
查看次数

REST API包括和不包括子资源

我正在尝试确定一种RESTful方式,以便为特定请求包含和排除子资源.

例如,这可能是原始请求:

GET部门/ 321

200 (Ok)
{
    "id": "321",
    "name": "Sales",
    "building": "The Foundary"
    "subdepartments": [
       {
          "id": "123",
          "name": "Training"
       },
       {
          "id": "224",
          "name": "Book Sales"
       }
       ...
    ]
}
Run Code Online (Sandbox Code Playgroud)

可能有一个很大的子部门列表.GET departments然后,该资源还将包括每个部门和每个部门的子部门.很多数据.

这可以通过创建两个单独的资源来解决:

GET部门/ 321

200 (Ok)
{
    "id": "3",
    "name": "Sales",
    "building": "The Foundary"
}
Run Code Online (Sandbox Code Playgroud)

GET部门/ 321 /分部门

200 (Ok)
[
   {
      "id": "123",
      "name": "Training"
   },
   {
      "id": "224",
      "name": "Book Sales"
   }
   ...
]
Run Code Online (Sandbox Code Playgroud)

但有时客户端软件可能不愿意提出多个请求(出于性能原因).也许通过提供include过滤器:

GET部门/ 321?包括=子部门

200 (Ok)
{
    "id": …
Run Code Online (Sandbox Code Playgroud)

rest restful-architecture asp.net-web-api asp.net-web-api2

6
推荐指数
1
解决办法
786
查看次数