autoservice

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

README

一、autoservice

自动化服务框架,服务端支持http及grpc协议,使用中间技术,增加APM性能。减少服务开发时间。

二、服务配置

[grpc]
  enabled = true
  host = "0.0.0.0:50051"
  maxconcurrency = 10240
  readtimeout = 300
  writetimeout = 3000

[http]
  enabled = true
  host = "0.0.0.0:8888"
  maxconcurrency = 10240
  readtimeout = 300
  writetimeout = 3000

[[locations]]
  location = "/v1/static/*filepath"
  module = "static.lands"

[[locations]]
  location = "/v1/classify"
  module = "classify.lands"

[logfunc]
  path = "./configs/funclog.toml"

[logsys]
  path = "./configs/log.toml"

[[modules]]
  conf = "./configs/static.ini"
  name = "static.lands"

[[modules]]
  conf = "./configs/classify.ini"
  name = "classify.lands"

[pprof]
  enabled = true
  port = 8886


三、中间件

  • opentracing(链路性能)
  • pprof(golang 监控)
  • prometheus (性能监控)
  • recovery (故障恢复)
  • logger (自动日志)
  • lru(缓存)
  • redis
  • apollo

四、服务接口

type Plugin interface {
	// Init initialize plugin with specified configuration.
	// If error occurs in initialization, don't return, just PANIC!
	Init(conf string)

	// Serve http request
	ServeHTTP(ctx *gin.Context)

	// Serve http for debug online
	Debug(ctx *gin.Context)

	// serve gprc request
	RegisterGrpcService(s *grpc.Server)
}

Documentation

Overview

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL